blob: b68d1ed3c1f329fe6208c20f5ca747af46b0012e [file] [log] [blame]
Googlerfae1a552022-03-04 13:02:38 +00001// Part of the Crubit project, under the Apache License v2.0 with LLVM
2// Exceptions. See /LICENSE for license information.
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
Dmitri Gribenkoe4e77d02022-03-17 14:09:39 +00005#ifndef CRUBIT_LIFETIME_ANNOTATIONS_POINTEE_TYPE_H_
6#define CRUBIT_LIFETIME_ANNOTATIONS_POINTEE_TYPE_H_
Googlerfae1a552022-03-04 13:02:38 +00007
Lukasz Anforowiczcec7a8a2022-04-27 10:24:51 -07008#include "clang/AST/Type.h"
Googlerfae1a552022-03-04 13:02:38 +00009
Martin Brænne1a207c52022-04-19 00:05:38 -070010namespace clang {
11namespace tidy {
12namespace lifetimes {
Googlerfae1a552022-03-04 13:02:38 +000013
Googler3c901432022-03-04 13:03:16 +000014// If `type` is a pointer or reference type, returns the type of its pointee.
Googlerfae1a552022-03-04 13:02:38 +000015// Otherwise, returns a null type.
Googler3c901432022-03-04 13:03:16 +000016// Unlike `type->getPointeeType()`, this returns a null type if `type`, though
17// it has a pointee type, is not a type for which we infer lifetimes, such as
18// a pointer-to-member type. In other words, this function can be used to
19// succinctly answer the question "does `type` have pointee type and do we infer
20// lifetimes for it".
Googlerfae1a552022-03-04 13:02:38 +000021clang::QualType PointeeType(clang::QualType type);
22
Martin Brænne1a207c52022-04-19 00:05:38 -070023} // namespace lifetimes
24} // namespace tidy
25} // namespace clang
Googlerfae1a552022-03-04 13:02:38 +000026
Dmitri Gribenkoe4e77d02022-03-17 14:09:39 +000027#endif // CRUBIT_LIFETIME_ANNOTATIONS_POINTEE_TYPE_H_