From 65d1096dcfaf5f1f58ed8859e30db735a057e962 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Sat, 19 Oct 2013 01:37:17 +0000 Subject: [PATCH] Simplify FunctionDecl::getBody. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193025 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/Decl.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) 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; } -- 2.40.0