summaryrefslogtreecommitdiff
path: root/lib/Frontend/ASTConsumers.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-07 11:31:23 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-07 11:31:23 +0000
commit9d96f9239e9250864435b25ed93bf6d08c4e5feb (patch)
tree364d74af4a68bde1f8f5d2103e6a5033b6238510 /lib/Frontend/ASTConsumers.cpp
parent06a54a38be5054c910ffc92db60edab23f9ea105 (diff)
downloadclang-9d96f9239e9250864435b25ed93bf6d08c4e5feb.tar.gz
Simplify code. FunctionDecl and ObjCMethodDecl have some common interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107769 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ASTConsumers.cpp')
-rw-r--r--lib/Frontend/ASTConsumers.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp
index bf2b3f2319..87b01d4a6a 100644
--- a/lib/Frontend/ASTConsumers.cpp
+++ b/lib/Frontend/ASTConsumers.cpp
@@ -109,25 +109,14 @@ namespace {
}
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';
- }
}
}