From: Rafael Espindola Date: Sat, 19 Oct 2013 01:37:17 +0000 (+0000) Subject: Simplify FunctionDecl::getBody. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65d1096dcfaf5f1f58ed8859e30db735a057e962;p=clang Simplify FunctionDecl::getBody. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193025 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index c3a462defc..484248f09f 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -2233,15 +2233,11 @@ bool FunctionDecl::isDefined(const FunctionDecl *&Definition) const { } 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; }