aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AST/StmtPrinter.cpp10
-rw-r--r--Driver/ASTConsumers.cpp2
-rw-r--r--Sema/SemaDecl.cpp2
3 files changed, 11 insertions, 3 deletions
diff --git a/AST/StmtPrinter.cpp b/AST/StmtPrinter.cpp
index d96a0486cf..fa3eb84b52 100644
--- a/AST/StmtPrinter.cpp
+++ b/AST/StmtPrinter.cpp
@@ -133,8 +133,16 @@ void StmtPrinter::PrintRawDecl(Decl *D) {
PrintExpr(V->getInit());
}
}
+ } else if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
+ // print a free standing tag decl (e.g. "struct x;").
+ OS << TD->getKindName();
+ OS << " ";
+ if (const IdentifierInfo *II = TD->getIdentifier())
+ OS << II->getName();
+ else
+ OS << "<anonymous>";
+ // FIXME: print tag bodies.
} else {
- // FIXME: "struct x;"
assert(0 && "Unexpected decl");
}
}
diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp
index e347ccb832..9175a08314 100644
--- a/Driver/ASTConsumers.cpp
+++ b/Driver/ASTConsumers.cpp
@@ -536,7 +536,7 @@ namespace {
} else if (FileVarDecl *FVD = dyn_cast<FileVarDecl>(D)) {
CodeGen::CodeGenGlobalVar(Builder, FVD);
} else {
- assert(isa<TypedefDecl>(D) && "Only expected typedefs here");
+ assert(isa<TypeDecl>(D) && "Only expected type decls here");
// don't codegen for now, eventually pass down for debug info.
//std::cerr << "Read top-level typedef decl: '" << D->getName() << "'\n";
}
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 2c016df781..bd6307f36b 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 0;
+ return DS.getTypeRep();
}
bool Sema::CheckSingleInitializer(Expr *&Init, bool isStatic,