diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-07-29 00:44:13 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-07-29 00:44:13 +0000 |
commit | a91d6a6619a91d0ca7102d8ab5678d855f04d850 (patch) | |
tree | a4a6d23ff32429ce61f5b0ab3d8c32a7af29f895 /lib/AST/Type.cpp | |
parent | 87e5732f3307c838fff6adea8ba50147110fe092 (diff) |
Code refactoring to define getCXXRecordDeclForPointerType
and use it in several places.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77411 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r-- | lib/AST/Type.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index c27df1fe2c..04961ed0fc 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -523,6 +523,13 @@ const TemplateTypeParmType *Type::getAsTemplateTypeParmType() const { return dyn_cast<TemplateTypeParmType>(CanonicalType); } +const CXXRecordDecl *Type::getCXXRecordDeclForPointerType() const { + if (const PointerType *PT = getAsPointerType()) + if (const RecordType *RT = PT->getPointeeType()->getAsRecordType()) + return dyn_cast<CXXRecordDecl>(RT->getDecl()); + return 0; +} + const TemplateSpecializationType * Type::getAsTemplateSpecializationType() const { // There is no sugar for class template specialization types, so |