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
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
index 034e8ef..a46dc72 100644
--- a/lib/CodeGen/CodeGenTypes.cpp
+++ b/lib/CodeGen/CodeGenTypes.cpp
@@ -481,12 +481,7 @@
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 @@
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 a2c222b..fc28c3a 100644
--- a/lib/CodeGen/CodeGenTypes.h
+++ b/lib/CodeGen/CodeGenTypes.h
@@ -190,6 +190,10 @@
/// 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