Add EnumDecl, warn about forward references to enums:
t.c:2:6: warning: ISO C forbids forward references to 'enum' types
enum foo22* X;
^
llvm-svn: 39299
diff --git a/clang/AST/SemaDecl.cpp b/clang/AST/SemaDecl.cpp
index ca87fc4..b0f80c8 100644
--- a/clang/AST/SemaDecl.cpp
+++ b/clang/AST/SemaDecl.cpp
@@ -334,7 +334,12 @@
TagDecl *New;
switch (Kind) {
default: assert(0 && "Unknown tag kind!");
- case Decl::Enum: assert(0 && "Enum tags not implemented yet!");
+ case Decl::Enum:
+ New = new EnumDecl(Loc, Name);
+ // If this is an undefined enum, warn.
+ if (TK != TK_Definition)
+ Diag(Loc, diag::ext_forward_ref_enum);
+ break;
case Decl::Union:
case Decl::Struct:
case Decl::Class:
@@ -342,9 +347,6 @@
break;
}
- //if (TK == TK_Definition)
- // New->setDefinition(true);
-
// If this has an identifier, add it to the scope stack.
if (Name) {
New->setNext(Name->getFETokenInfo<Decl>());