[cfe-commits] r81588 - in /cfe/trunk: include/clang/AST/Decl.h lib/AST/Decl.cpp lib/Analysis/PathDiagnostic.cpp lib/Frontend/ASTConsumers.cpp

Douglas Gregor dgregor at apple.com
Fri Sep 11 17:08:48 PDT 2009


Author: dgregor
Date: Fri Sep 11 19:08:48 2009
New Revision: 81588

URL: http://llvm.org/viewvc/llvm-project?rev=81588&view=rev
Log:
Eliminate FunctionDecl::getBodyIfAvailable

Modified:
    cfe/trunk/include/clang/AST/Decl.h
    cfe/trunk/lib/AST/Decl.cpp
    cfe/trunk/lib/Analysis/PathDiagnostic.cpp
    cfe/trunk/lib/Frontend/ASTConsumers.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=81588&r1=81587&r2=81588&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Fri Sep 11 19:08:48 2009
@@ -886,10 +886,6 @@
     return getBody(Definition);
   }
 
-  /// \brief If the function has a body that is immediately available,
-  /// return it.
-  Stmt *getBodyIfAvailable() const;
-
   /// isThisDeclarationADefinition - Returns whether this specific
   /// declaration of the function is also a definition. This does not
   /// determine whether the function has been defined (e.g., in a

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=81588&r1=81587&r2=81588&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Sep 11 19:08:48 2009
@@ -438,16 +438,6 @@
   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)

Modified: cfe/trunk/lib/Analysis/PathDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PathDiagnostic.cpp?rev=81588&r1=81587&r2=81588&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/PathDiagnostic.cpp (original)
+++ cfe/trunk/lib/Analysis/PathDiagnostic.cpp Fri Sep 11 19:08:48 2009
@@ -207,7 +207,7 @@
         // 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

Modified: cfe/trunk/lib/Frontend/ASTConsumers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTConsumers.cpp?rev=81588&r1=81587&r2=81588&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/ASTConsumers.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTConsumers.cpp Fri Sep 11 19:08:48 2009
@@ -115,9 +115,9 @@
   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;





More information about the cfe-commits mailing list