Googler | fae1a55 | 2022-03-04 13:02:38 +0000 | [diff] [blame] | 1 | // 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 Gribenko | e4e77d0 | 2022-03-17 14:09:39 +0000 | [diff] [blame] | 5 | #ifndef CRUBIT_LIFETIME_ANNOTATIONS_POINTEE_TYPE_H_ |
| 6 | #define CRUBIT_LIFETIME_ANNOTATIONS_POINTEE_TYPE_H_ |
Googler | fae1a55 | 2022-03-04 13:02:38 +0000 | [diff] [blame] | 7 | |
Lukasz Anforowicz | cec7a8a | 2022-04-27 10:24:51 -0700 | [diff] [blame] | 8 | #include "clang/AST/Type.h" |
Googler | fae1a55 | 2022-03-04 13:02:38 +0000 | [diff] [blame] | 9 | |
Martin Brænne | 1a207c5 | 2022-04-19 00:05:38 -0700 | [diff] [blame] | 10 | namespace clang { |
| 11 | namespace tidy { |
| 12 | namespace lifetimes { |
Googler | fae1a55 | 2022-03-04 13:02:38 +0000 | [diff] [blame] | 13 | |
Googler | 3c90143 | 2022-03-04 13:03:16 +0000 | [diff] [blame] | 14 | // If `type` is a pointer or reference type, returns the type of its pointee. |
Googler | fae1a55 | 2022-03-04 13:02:38 +0000 | [diff] [blame] | 15 | // Otherwise, returns a null type. |
Googler | 3c90143 | 2022-03-04 13:03:16 +0000 | [diff] [blame] | 16 | // 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". |
Googler | fae1a55 | 2022-03-04 13:02:38 +0000 | [diff] [blame] | 21 | clang::QualType PointeeType(clang::QualType type); |
| 22 | |
Martin Brænne | 1a207c5 | 2022-04-19 00:05:38 -0700 | [diff] [blame] | 23 | } // namespace lifetimes |
| 24 | } // namespace tidy |
| 25 | } // namespace clang |
Googler | fae1a55 | 2022-03-04 13:02:38 +0000 | [diff] [blame] | 26 | |
Dmitri Gribenko | e4e77d0 | 2022-03-17 14:09:39 +0000 | [diff] [blame] | 27 | #endif // CRUBIT_LIFETIME_ANNOTATIONS_POINTEE_TYPE_H_ |