Browse Source

Add CodeGenTypes::ContainsPointerToDataMember overload that takes a CXXRecordDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104011 91177308-0d34-0410-b5e6-96231b3b80d8
Anders Carlsson 15 years ago
parent
commit
c39211d2ae
2 changed files with 15 additions and 6 deletions
  1. 11 6
      lib/CodeGen/CodeGenTypes.cpp
  2. 4 0
      lib/CodeGen/CodeGenTypes.h

+ 11 - 6
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();
+}

+ 4 - 0
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