aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-26 22:19:44 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-26 22:19:44 +0000
commitfc705b84347e6fb4746a1a7e26949f64c2f2f358 (patch)
treee6ec475fb6c12bfe460fe56da06fc3b9cfd82e48 /lib/AST/Decl.cpp
parent8af2975d50270813ae6366d007e9e1f5b65ddc68 (diff)
Make the type associated with a ClassTemplateSpecializationDecl be a
nicely sugared type that shows how the user wrote the actual specialization. This sugared type won't actually show up until we start doing instantiations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65577 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 2732bf93c1..ab65492023 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -374,22 +374,24 @@ OverloadedOperatorKind FunctionDecl::getOverloadedOperator() const {
//===----------------------------------------------------------------------===//
void TagDecl::startDefinition() {
- cast<TagType>(TypeForDecl)->decl.setPointer(this);
- cast<TagType>(TypeForDecl)->decl.setInt(1);
+ TagType *TagT = const_cast<TagType *>(TypeForDecl->getAsTagType());
+ TagT->decl.setPointer(this);
+ TagT->getAsTagType()->decl.setInt(1);
}
void TagDecl::completeDefinition() {
assert((!TypeForDecl ||
- cast<TagType>(TypeForDecl)->decl.getPointer() == this) &&
+ TypeForDecl->getAsTagType()->decl.getPointer() == this) &&
"Attempt to redefine a tag definition?");
IsDefinition = true;
- cast<TagType>(TypeForDecl)->decl.setPointer(this);
- cast<TagType>(TypeForDecl)->decl.setInt(0);
+ TagType *TagT = const_cast<TagType *>(TypeForDecl->getAsTagType());
+ TagT->decl.setPointer(this);
+ TagT->decl.setInt(0);
}
TagDecl* TagDecl::getDefinition(ASTContext& C) const {
QualType T = C.getTypeDeclType(const_cast<TagDecl*>(this));
- TagDecl* D = cast<TagDecl>(cast<TagType>(T)->getDecl());
+ TagDecl* D = cast<TagDecl>(T->getAsTagType()->getDecl());
return D->isDefinition() ? D : 0;
}