summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-10-08 23:50:27 +0000
committerDouglas Gregor <dgregor@apple.com>2010-10-08 23:50:27 +0000
commit0bf3140424a0a13a928a4e6bf0f112e6167a5636 (patch)
treeaef7f4fa057fc4672999ce4ec62b01064035c242 /clang/lib/AST/Decl.cpp
parent959fcc6c634cb4d4fd8bd8c8b4bc3e6b99ebc228 (diff)
downloadbcm5719-llvm-0bf3140424a0a13a928a4e6bf0f112e6167a5636.tar.gz
bcm5719-llvm-0bf3140424a0a13a928a4e6bf0f112e6167a5636.zip
Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked a
bit by me). llvm-svn: 116122
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 081e5ee6ad4..f4554730595 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1615,14 +1615,16 @@ void TagDecl::setQualifierInfo(NestedNameSpecifier *Qualifier,
EnumDecl *EnumDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, SourceLocation TKL,
- EnumDecl *PrevDecl) {
- EnumDecl *Enum = new (C) EnumDecl(DC, L, Id, PrevDecl, TKL);
+ EnumDecl *PrevDecl, bool IsScoped, bool IsFixed) {
+ EnumDecl *Enum = new (C) EnumDecl(DC, L, Id, PrevDecl, TKL,
+ IsScoped, IsFixed);
C.getTypeDeclType(Enum, PrevDecl);
return Enum;
}
EnumDecl *EnumDecl::Create(ASTContext &C, EmptyShell Empty) {
- return new (C) EnumDecl(0, SourceLocation(), 0, 0, SourceLocation());
+ return new (C) EnumDecl(0, SourceLocation(), 0, 0, SourceLocation(),
+ false, false);
}
void EnumDecl::completeDefinition(QualType NewType,
@@ -1630,7 +1632,8 @@ void EnumDecl::completeDefinition(QualType NewType,
unsigned NumPositiveBits,
unsigned NumNegativeBits) {
assert(!isDefinition() && "Cannot redefine enums!");
- IntegerType = NewType;
+ if (!IntegerType)
+ IntegerType = NewType.getTypePtr();
PromotionType = NewPromotionType;
setNumPositiveBits(NumPositiveBits);
setNumNegativeBits(NumNegativeBits);
OpenPOWER on IntegriCloud