diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CodeGenTypes.cpp | 17 | ||||
-rw-r--r-- | lib/CodeGen/CodeGenTypes.h | 4 |
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp index 034e8ef622..a46dc726a4 100644 --- a/lib/CodeGen/CodeGenTypes.cpp +++ b/lib/CodeGen/CodeGenTypes.cpp @@ -481,12 +481,7 @@ bool CodeGenTypes::ContainsPointerToDataMember(QualType T) { if (const RecordType *RT = T->getAs<RecordType>()) { const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl()); - // FIXME: It would be better if there was a way to explicitly compute the - // record layout instead of converting to a type. - ConvertTagDeclType(RD); - - const CGRecordLayout &Layout = getCGRecordLayout(RD); - return Layout.containsPointerToDataMember(); + return ContainsPointerToDataMember(RD); } if (const MemberPointerType *MPT = T->getAs<MemberPointerType>()) @@ -494,3 +489,13 @@ bool CodeGenTypes::ContainsPointerToDataMember(QualType T) { return false; } + +bool CodeGenTypes::ContainsPointerToDataMember(const CXXRecordDecl *RD) { + + // FIXME: It would be better if there was a way to explicitly compute the + // record layout instead of converting to a type. + ConvertTagDeclType(RD); + + const CGRecordLayout &Layout = getCGRecordLayout(RD); + return Layout.containsPointerToDataMember(); +} diff --git a/lib/CodeGen/CodeGenTypes.h b/lib/CodeGen/CodeGenTypes.h index a2c222b9a6..fc28c3ae33 100644 --- a/lib/CodeGen/CodeGenTypes.h +++ b/lib/CodeGen/CodeGenTypes.h @@ -190,6 +190,10 @@ public: // These are internal details of CGT that shouldn't be used externally. /// ContainsPointerToDataMember - Return whether the given type contains a /// pointer to a data member. bool ContainsPointerToDataMember(QualType T); + + /// ContainsPointerToDataMember - Return whether the record decl contains a + /// pointer to a data member. + bool ContainsPointerToDataMember(const CXXRecordDecl *RD); }; } // end namespace CodeGen |