diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-06-09 23:19:58 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-06-09 23:19:58 +0000 |
commit | 39ba4aeca296b1c9f04bde7d9d3cbbf129f1abd3 (patch) | |
tree | 0bd41bdbfdd41514deb4fbd92ddf3bade3030d8b /lib/AST/Decl.cpp | |
parent | d3bb44f0f1a83cb208d3e61ee80afe6a4d20d2d8 (diff) |
-Changes to TagDecl:
Added TagKind enum.
Added getTagKind() method.
Added convenience methods: isEnum(), isStruct(), isUnion(), isClass().
-RecordDecl/CXXRecordDecl::Create() accept a TagKind enum instead of a DeclKind one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52160 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index b5dba1029b..47334f53cc 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -101,10 +101,17 @@ EnumDecl *EnumDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, return new (Mem) EnumDecl(DC, L, Id, PrevDecl); } -RecordDecl *RecordDecl::Create(ASTContext &C, Kind DK, DeclContext *DC, +RecordDecl *RecordDecl::Create(ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, ScopedDecl *PrevDecl) { void *Mem = C.getAllocator().Allocate<RecordDecl>(); + Kind DK; + switch (TK) { + 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; + } return new (Mem) RecordDecl(DK, DC, L, Id, PrevDecl); } |