diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-07-29 23:36:44 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-07-29 23:36:44 +0000 |
commit | b6b8f9e2915c1c9dd91ddb100fc2f11d4d22881f (patch) | |
tree | cfa0b645a38514bf9dd8eba332d8c001e7a35b75 /clang/lib/AST/DeclCXX.cpp | |
parent | e3493a91cccd7b9d197f07e4d69e09e1f81b44bb (diff) | |
download | bcm5719-llvm-b6b8f9e2915c1c9dd91ddb100fc2f11d4d22881f.tar.gz bcm5719-llvm-b6b8f9e2915c1c9dd91ddb100fc2f11d4d22881f.zip |
Make tag declarations redeclarable. This change has three purposes:
1) Allow the Index library (and any other interested client) to walk
the set of declarations for a given tag (enum, union, class,
whatever). At the moment, this information is not readily available.
2) Reduce our dependence on TagDecl::TypeForDecl being mapped down
to a TagType (for which getDecl() will return the tag definition, if
one exists). This property won't exist for class template partial
specializations.
3) Make the canonical declaration of a TagDecl actually canonical,
e.g., so that it does not change when the tag is defined.
llvm-svn: 77523
Diffstat (limited to 'clang/lib/AST/DeclCXX.cpp')
-rw-r--r-- | clang/lib/AST/DeclCXX.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index 57897b04608..11c7e6dfc2b 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -25,8 +25,9 @@ using namespace clang; CXXRecordDecl::CXXRecordDecl(Kind K, TagKind TK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, + CXXRecordDecl *PrevDecl, SourceLocation TKL) - : RecordDecl(K, TK, DC, L, Id, TKL), + : RecordDecl(K, TK, DC, L, Id, PrevDecl, TKL), UserDeclaredConstructor(false), UserDeclaredCopyConstructor(false), UserDeclaredCopyAssignment(false), UserDeclaredDestructor(false), Aggregate(true), PlainOldData(true), Polymorphic(false), Abstract(false), @@ -41,7 +42,10 @@ CXXRecordDecl *CXXRecordDecl::Create(ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation TKL, CXXRecordDecl* PrevDecl, bool DelayTypeCreation) { - CXXRecordDecl* R = new (C) CXXRecordDecl(CXXRecord, TK, DC, L, Id, TKL); + CXXRecordDecl* R = new (C) CXXRecordDecl(CXXRecord, TK, DC, L, Id, + PrevDecl, TKL); + + // FIXME: DelayTypeCreation seems like such a hack if (!DelayTypeCreation) C.getTypeDeclType(R, PrevDecl); return R; |