blob: f33d48b37d638ee55ad32818ea612ddac824e562 [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
5#include "lifetime_annotations/pointee_type.h"
6
Martin Brænne1a207c52022-04-19 00:05:38 -07007namespace clang {
8namespace tidy {
9namespace lifetimes {
Googlerfae1a552022-03-04 13:02:38 +000010
Googlerfae1a552022-03-04 13:02:38 +000011clang::QualType PointeeType(clang::QualType type) {
Googlerfae1a552022-03-04 13:02:38 +000012 if (auto ptr_type = type->getAs<clang::PointerType>()) {
13 return ptr_type->getPointeeType();
14 } else if (auto ref_type = type->getAs<clang::ReferenceType>()) {
15 return ref_type->getPointeeType();
16 }
17
Googlerfae1a552022-03-04 13:02:38 +000018 return clang::QualType();
19}
20
Martin Brænne1a207c52022-04-19 00:05:38 -070021} // namespace lifetimes
22} // namespace tidy
23} // namespace clang