[cfe-commits] r44208 - in /cfe/trunk: AST/StmtPrinter.cpp Driver/ASTConsumers.cpp Sema/SemaDecl.cpp
Steve Naroff
snaroff at apple.com
Sat Nov 17 13:21:02 PST 2007
Author: snaroff
Date: Sat Nov 17 15:21:01 2007
New Revision: 44208
URL: http://llvm.org/viewvc/llvm-project?rev=44208&view=rev
Log:
Make sure Sema::ParsedFreeStandingDeclSpec() returns a decl representing the type.
Adding basic printing to StmtPrinter::PrintRawDecl().
Modified:
cfe/trunk/AST/StmtPrinter.cpp
cfe/trunk/Driver/ASTConsumers.cpp
cfe/trunk/Sema/SemaDecl.cpp
Modified: cfe/trunk/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/StmtPrinter.cpp?rev=44208&r1=44207&r2=44208&view=diff
==============================================================================
--- cfe/trunk/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/AST/StmtPrinter.cpp Sat Nov 17 15:21:01 2007
@@ -133,8 +133,16 @@
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");
}
}
Modified: cfe/trunk/Driver/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/ASTConsumers.cpp?rev=44208&r1=44207&r2=44208&view=diff
==============================================================================
--- cfe/trunk/Driver/ASTConsumers.cpp (original)
+++ cfe/trunk/Driver/ASTConsumers.cpp Sat Nov 17 15:21:01 2007
@@ -536,7 +536,7 @@
} 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";
}
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=44208&r1=44207&r2=44208&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Sat Nov 17 15:21:01 2007
@@ -347,7 +347,7 @@
// TODO: emit error on 'typedef int;'
// if (!DS.isMissingDeclaratorOk()) Diag(...);
- return 0;
+ return DS.getTypeRep();
}
bool Sema::CheckSingleInitializer(Expr *&Init, bool isStatic,
More information about the cfe-commits
mailing list