aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-10-15 00:42:39 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-10-15 00:42:39 +0000
commit35bc0821c4f80041724cd4c5c4889b2581546a41 (patch)
treed7137778d1d806d227e05eb0389e83ca4da8ce9e /lib/AST/Decl.cpp
parent00231ee34cefea1bffc4653c0149d5a8fc22516e (diff)
Simplify handling of struct/union/class tags.
Instead of using two sets of Decl kinds (Struct/Union/Class and CXXStruct/CXXUnion/CXXClass), use one 'Record' and one 'CXXRecord' Decl kind and make tag kind a property of TagDecl. Cleans up the code a bit and better reflects that Decl class structure. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57541 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 382b9ebd51..3713776298 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -221,9 +221,9 @@ TagDecl* TagDecl::getDefinition(ASTContext& C) const {
// RecordDecl Implementation
//===----------------------------------------------------------------------===//
-RecordDecl::RecordDecl(Kind DK, DeclContext *DC, SourceLocation L,
+RecordDecl::RecordDecl(Kind DK, TagKind TK, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id)
-: TagDecl(DK, DC, L, Id, 0) {
+: TagDecl(DK, TK, DC, L, Id, 0) {
HasFlexibleArrayMember = false;
assert(classof(static_cast<Decl*>(this)) && "Invalid Kind!");
@@ -236,16 +236,7 @@ RecordDecl *RecordDecl::Create(ASTContext &C, TagKind TK, DeclContext *DC,
RecordDecl* PrevDecl) {
void *Mem = C.getAllocator().Allocate<RecordDecl>();
- Kind DK;
- switch (TK) {
- default: assert(0 && "Invalid TagKind!");
- case TK_enum: assert(0 && "Enum TagKind passed for Record!");
- case TK_struct: DK = Struct; break;
- case TK_union: DK = Union; break;
- case TK_class: DK = Class; break;
- }
-
- RecordDecl* R = new (Mem) RecordDecl(DK, DC, L, Id);
+ RecordDecl* R = new (Mem) RecordDecl(Record, TK, DC, L, Id);
C.getTypeDeclType(R, PrevDecl);
return R;
}