diff options
-rw-r--r-- | AST/StmtDumper.cpp | 10 | ||||
-rw-r--r-- | Sema/SemaDecl.cpp | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/AST/StmtDumper.cpp b/AST/StmtDumper.cpp index a30b901c1c..c6ab29880d 100644 --- a/AST/StmtDumper.cpp +++ b/AST/StmtDumper.cpp @@ -219,8 +219,16 @@ void StmtDumper::DumpDeclarator(Decl *D) { } } fprintf(F, "\""); + } else if (TagDecl *TD = dyn_cast<TagDecl>(D)) { + // print a free standing tag decl (e.g. "struct x;"). + const char *tagname; + if (const IdentifierInfo *II = TD->getIdentifier()) + tagname = II->getName(); + else + tagname = "<anonymous>"; + fprintf(F, "\"%s %s;\"", TD->getKindName(), tagname); + // FIXME: print tag bodies. } else { - // FIXME: "struct x;" assert(0 && "Unexpected decl"); } } diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index bd6307f36b..2c3b335fb7 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -347,7 +347,7 @@ Sema::DeclTy *Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) { // TODO: emit error on 'typedef int;' // if (!DS.isMissingDeclaratorOk()) Diag(...); - return DS.getTypeRep(); + return dyn_cast_or_null<TagDecl>(static_cast<Decl *>(DS.getTypeRep())); } bool Sema::CheckSingleInitializer(Expr *&Init, bool isStatic, |