[cfe-commits] r70095 - /cfe/trunk/tools/clang-cc/ASTConsumers.cpp
Chris Lattner
sabre at nondot.org
Sat Apr 25 16:31:28 PDT 2009
Author: lattner
Date: Sat Apr 25 18:31:28 2009
New Revision: 70095
URL: http://llvm.org/viewvc/llvm-project?rev=70095&view=rev
Log:
minor cleanups to ast-dump, use getBody(context).
Modified:
cfe/trunk/tools/clang-cc/ASTConsumers.cpp
Modified: cfe/trunk/tools/clang-cc/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/ASTConsumers.cpp?rev=70095&r1=70094&r2=70095&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/ASTConsumers.cpp (original)
+++ cfe/trunk/tools/clang-cc/ASTConsumers.cpp Sat Apr 25 18:31:28 2009
@@ -590,12 +590,12 @@
namespace {
class ASTDumper : public ASTConsumer, public DeclPrinter {
- SourceManager *SM;
+ ASTContext *Ctx;
public:
ASTDumper() : DeclPrinter() {}
void Initialize(ASTContext &Context) {
- SM = &Context.getSourceManager();
+ Ctx = &Context;
}
virtual void HandleTopLevelDecl(DeclGroupRef D) {
@@ -610,10 +610,10 @@
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
PrintFunctionDeclStart(FD);
- if (FD->getBodyIfAvailable()) {
+ if (Stmt *Body = FD->getBody(*Ctx)) {
Out << '\n';
- // FIXME: convert dumper to use std::ostream?
- FD->getBodyIfAvailable()->dumpAll(*SM);
+ // FIXME: convert dumper to use raw_ostream.
+ Body->dumpAll(Ctx->getSourceManager());
Out << '\n';
}
} else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
@@ -633,9 +633,9 @@
} else if (ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(D)) {
Out << "Read objc method decl: '" << MD->getSelector().getAsString()
<< "'\n";
- if (MD->getBody()) {
- // FIXME: convert dumper to use std::ostream?
- MD->getBody()->dumpAll(*SM);
+ if (Stmt *S = MD->getBody()) {
+ // FIXME: convert dumper to use raw_ostream.
+ S->dumpAll(Ctx->getSourceManager());
Out << '\n';
}
} else if (isa<ObjCImplementationDecl>(D)) {
More information about the cfe-commits
mailing list