summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-07-29 23:36:44 +0000
committerDouglas Gregor <dgregor@apple.com>2009-07-29 23:36:44 +0000
commitb6b8f9e2915c1c9dd91ddb100fc2f11d4d22881f (patch)
treecfa0b645a38514bf9dd8eba332d8c001e7a35b75 /clang/lib/AST/DeclTemplate.cpp
parente3493a91cccd7b9d197f07e4d69e09e1f81b44bb (diff)
downloadbcm5719-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/DeclTemplate.cpp')
-rw-r--r--clang/lib/AST/DeclTemplate.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index 686b78d0233..4677d17dc93 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -369,13 +369,15 @@ ClassTemplateSpecializationDecl::
ClassTemplateSpecializationDecl(ASTContext &Context, Kind DK,
DeclContext *DC, SourceLocation L,
ClassTemplateDecl *SpecializedTemplate,
- TemplateArgumentListBuilder &Builder)
+ TemplateArgumentListBuilder &Builder,
+ ClassTemplateSpecializationDecl *PrevDecl)
: CXXRecordDecl(DK,
SpecializedTemplate->getTemplatedDecl()->getTagKind(),
DC, L,
// FIXME: Should we use DeclarationName for the name of
// class template specializations?
- SpecializedTemplate->getIdentifier()),
+ SpecializedTemplate->getIdentifier(),
+ PrevDecl),
SpecializedTemplate(SpecializedTemplate),
TemplateArgs(Context, Builder, /*TakeArgs=*/true),
SpecializationKind(TSK_Undeclared) {
@@ -392,7 +394,8 @@ ClassTemplateSpecializationDecl::Create(ASTContext &Context,
ClassTemplateSpecialization,
DC, L,
SpecializedTemplate,
- Builder);
+ Builder,
+ PrevDecl);
Context.getTypeDeclType(Result, PrevDecl);
return Result;
}
@@ -411,7 +414,7 @@ Create(ASTContext &Context, DeclContext *DC, SourceLocation L,
= new (Context)ClassTemplatePartialSpecializationDecl(Context,
DC, L, Params,
SpecializedTemplate,
- Builder);
+ Builder, PrevDecl);
Result->setSpecializationKind(TSK_ExplicitSpecialization);
Context.getTypeDeclType(Result, PrevDecl);
return Result;
OpenPOWER on IntegriCloud