aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-09-12 00:08:48 +0000
committerDouglas Gregor <dgregor@apple.com>2009-09-12 00:08:48 +0000
commitaf3280fadbdab6305581955c973e1229970958eb (patch)
tree5b98022d356f7ba17de7c06f017596a995584020 /lib
parentc7cba15f5fd86b96c03c57a1d307dde468f7399b (diff)
Eliminate FunctionDecl::getBodyIfAvailable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81588 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/Decl.cpp10
-rw-r--r--lib/Analysis/PathDiagnostic.cpp2
-rw-r--r--lib/Frontend/ASTConsumers.cpp4
3 files changed, 3 insertions, 13 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index a7d8216b00..66f20364a6 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -438,16 +438,6 @@ Stmt *FunctionDecl::getBody(const FunctionDecl *&Definition) const {
return 0;
}
-Stmt *FunctionDecl::getBodyIfAvailable() const {
- for (redecl_iterator I = redecls_begin(), E = redecls_end(); I != E; ++I) {
- if (I->Body && !I->Body.isOffset()) {
- return I->Body.get(0);
- }
- }
-
- return 0;
-}
-
void FunctionDecl::setBody(Stmt *B) {
Body = B;
if (B)
diff --git a/lib/Analysis/PathDiagnostic.cpp b/lib/Analysis/PathDiagnostic.cpp
index 1c2f6bfca0..ceead6a3ac 100644
--- a/lib/Analysis/PathDiagnostic.cpp
+++ b/lib/Analysis/PathDiagnostic.cpp
@@ -207,7 +207,7 @@ PathDiagnosticRange PathDiagnosticLocation::asRange() const {
// FIXME: We would like to always get the function body, even
// when it needs to be de-serialized, but getting the
// ASTContext here requires significant changes.
- if (Stmt *Body = FD->getBodyIfAvailable()) {
+ if (Stmt *Body = FD->getBody()) {
if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Body))
return CS->getSourceRange();
else
diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp
index 954ebd6997..3abd2b36e6 100644
--- a/lib/Frontend/ASTConsumers.cpp
+++ b/lib/Frontend/ASTConsumers.cpp
@@ -115,9 +115,9 @@ void ASTViewer::HandleTopLevelSingleDecl(Decl *D) {
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
FD->print(llvm::errs());
- if (FD->getBodyIfAvailable()) {
+ if (Stmt *Body = FD->getBody()) {
llvm::errs() << '\n';
- FD->getBodyIfAvailable()->viewAST();
+ Body->viewAST();
llvm::errs() << '\n';
}
return;