aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-12-07 04:35:11 +0000
committerAnders Carlsson <andersca@mac.com>2009-12-07 04:35:11 +0000
commitf53df2398e07d13be9962b95aebc19b31706fa33 (patch)
treea9483fc6f2798e465696bab68b7dfba13e80e965 /lib/AST/ASTContext.cpp
parenta93c934af4fbf97cbe8e649d82e68ccacfe57c95 (diff)
Move key functions to a separate map.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90745 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r--lib/AST/ASTContext.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index cc96a5dc0e..490f338d38 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -1104,6 +1104,20 @@ const ASTRecordLayout &ASTContext::getASTRecordLayout(const RecordDecl *D) {
return *NewEntry;
}
+const CXXMethodDecl *ASTContext::getKeyFunction(const CXXRecordDecl *RD) {
+ RD = cast<CXXRecordDecl>(RD->getDefinition(*this));
+ assert(RD && "Cannot get key function for forward declarations!");
+
+ const CXXMethodDecl *&Entry = KeyFunctions[RD];
+ if (!Entry)
+ Entry = ASTRecordLayoutBuilder::ComputeKeyFunction(RD);
+ else
+ assert(Entry == ASTRecordLayoutBuilder::ComputeKeyFunction(RD) &&
+ "Key function changed!");
+
+ return Entry;
+}
+
//===----------------------------------------------------------------------===//
// Type creation/memoization methods
//===----------------------------------------------------------------------===//