[cfe-commits] r107769 - /cfe/trunk/lib/Frontend/ASTConsumers.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Wed Jul 7 04:31:23 PDT 2010
Author: akirtzidis
Date: Wed Jul 7 06:31:23 2010
New Revision: 107769
URL: http://llvm.org/viewvc/llvm-project?rev=107769&view=rev
Log:
Simplify code. FunctionDecl and ObjCMethodDecl have some common interfaces.
Modified:
cfe/trunk/lib/Frontend/ASTConsumers.cpp
Modified: cfe/trunk/lib/Frontend/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTConsumers.cpp?rev=107769&r1=107768&r2=107769&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTConsumers.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTConsumers.cpp Wed Jul 7 06:31:23 2010
@@ -109,25 +109,14 @@
}
void ASTViewer::HandleTopLevelSingleDecl(Decl *D) {
- if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
- FD->print(llvm::errs());
-
- if (Stmt *Body = FD->getBody()) {
+ if (isa<FunctionDecl>(D) || isa<ObjCMethodDecl>(D)) {
+ D->print(llvm::errs());
+
+ if (Stmt *Body = D->getBody()) {
llvm::errs() << '\n';
Body->viewAST();
llvm::errs() << '\n';
}
- return;
- }
-
- if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
- MD->print(llvm::errs());
-
- if (MD->getBody()) {
- llvm::errs() << '\n';
- MD->getBody()->viewAST();
- llvm::errs() << '\n';
- }
}
}
More information about the cfe-commits
mailing list