diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-07 11:31:34 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-07 11:31:34 +0000 |
commit | 568bc8456288b97f77164288ce0e0f3a9bbc73d5 (patch) | |
tree | dde4b7cec6ea45b9c54a6101a89c245c643037d7 /clang/lib | |
parent | 6fbc8fa53e5e1d8eeb226e1aa103c40576748ea6 (diff) | |
download | bcm5719-llvm-568bc8456288b97f77164288ce0e0f3a9bbc73d5.tar.gz bcm5719-llvm-568bc8456288b97f77164288ce0e0f3a9bbc73d5.zip |
Remove Decl::getCompoundBody().
This has 2 (slight) advantages:
-Make explicit at getBody()'s callsite that we expect/handle only CompoundStmt and not CXXTryStmt.
-Better tracking of Decl::getBody()'s callsites.
llvm-svn: 107771
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/AST/DeclBase.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Checker/BugReporter.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Rewrite/RewriteObjC.cpp | 2 |
3 files changed, 2 insertions, 6 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 96c88c9b346..9027a131434 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -447,10 +447,6 @@ DeclContext *Decl::castToDeclContext(const Decl *D) { } } -CompoundStmt* Decl::getCompoundBody() const { - return dyn_cast_or_null<CompoundStmt>(getBody()); -} - SourceLocation Decl::getBodyRBrace() const { // Special handling of FunctionDecl to avoid de-serializing the body from PCH. // FunctionDecl stores EndRangeLoc for this purpose. diff --git a/clang/lib/Checker/BugReporter.cpp b/clang/lib/Checker/BugReporter.cpp index 560953f358a..0422d80ae26 100644 --- a/clang/lib/Checker/BugReporter.cpp +++ b/clang/lib/Checker/BugReporter.cpp @@ -925,7 +925,7 @@ public: // statement (if it doesn't already exist). // FIXME: Should handle CXXTryStmt if analyser starts supporting C++. if (const CompoundStmt *CS = - PDB.getCodeDecl().getCompoundBody()) + dyn_cast_or_null<CompoundStmt>(PDB.getCodeDecl().getBody())) if (!CS->body_empty()) { SourceLocation Loc = (*CS->body_begin())->getLocStart(); rawAddEdge(PathDiagnosticLocation(Loc, PDB.getSourceManager())); diff --git a/clang/lib/Rewrite/RewriteObjC.cpp b/clang/lib/Rewrite/RewriteObjC.cpp index d6fe4e3b283..204ec264156 100644 --- a/clang/lib/Rewrite/RewriteObjC.cpp +++ b/clang/lib/Rewrite/RewriteObjC.cpp @@ -5651,7 +5651,7 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) { RewriteBlocksInFunctionProtoType(FD->getType(), FD); // FIXME: If this should support Obj-C++, support CXXTryStmt - if (CompoundStmt *Body = FD->getCompoundBody()) { + if (CompoundStmt *Body = dyn_cast_or_null<CompoundStmt>(FD->getBody())) { CurFunctionDef = FD; CurFunctionDeclToDeclareForBlock = FD; CollectPropertySetters(Body); |