r193025 - Simplify FunctionDecl::getBody.

Rafael Espindola rafael.espindola at gmail.com
Fri Oct 18 18:37:17 PDT 2013


Author: rafael
Date: Fri Oct 18 20:37:17 2013
New Revision: 193025

URL: http://llvm.org/viewvc/llvm-project?rev=193025&view=rev
Log:
Simplify FunctionDecl::getBody.

Modified:
    cfe/trunk/lib/AST/Decl.cpp

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=193025&r1=193024&r2=193025&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Oct 18 20:37:17 2013
@@ -2233,15 +2233,11 @@ bool FunctionDecl::isDefined(const Funct
 }
 
 Stmt *FunctionDecl::getBody(const FunctionDecl *&Definition) const {
-  for (redecl_iterator I = redecls_begin(), E = redecls_end(); I != E; ++I) {
-    if (I->Body) {
-      Definition = *I;
-      return I->Body.get(getASTContext().getExternalSource());
-    } else if (I->IsLateTemplateParsed) {
-      Definition = *I;
-      return 0;
-    }
-  }
+  if (!hasBody(Definition))
+    return 0;
+
+  if (Definition->Body)
+    return Definition->Body.get(getASTContext().getExternalSource());
 
   return 0;
 }





More information about the cfe-commits mailing list