summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-02-04 22:26:26 +0000
committerJohn McCall <rjmccall@apple.com>2010-02-04 22:26:26 +0000
commit67da35c832e66d3310ed67486cb46306f20cc642 (patch)
treefb9a44adb34cad6cc2686e6cca6427c8c0c489ed /clang/lib/AST/Decl.cpp
parent1de1707bfc789e9cf9467c2d37af2a584db6520b (diff)
downloadbcm5719-llvm-67da35c832e66d3310ed67486cb46306f20cc642.tar.gz
bcm5719-llvm-67da35c832e66d3310ed67486cb46306f20cc642.zip
Extract a common structure for holding information about the definition
of a C++ record. Exposed a lot of problems where various routines were silently doing The Wrong Thing (or The Acceptable Thing in The Wrong Order) when presented with a non-definition. Also cuts down on memory usage. llvm-svn: 95330
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index c3e976a080a..ba1def643e1 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1373,6 +1373,16 @@ void TagDecl::startDefinition() {
TagT->decl.setPointer(this);
TagT->decl.setInt(1);
}
+
+ if (isa<CXXRecordDecl>(this)) {
+ CXXRecordDecl *D = cast<CXXRecordDecl>(this);
+ struct CXXRecordDecl::DefinitionData *Data =
+ new (getASTContext()) struct CXXRecordDecl::DefinitionData(D);
+ do {
+ D->DefinitionData = Data;
+ D = cast_or_null<CXXRecordDecl>(D->getPreviousDeclaration());
+ } while (D);
+ }
}
void TagDecl::completeDefinition() {
OpenPOWER on IntegriCloud