From e5274ba3457d6c18ecadfb44f1cf8f7e0e689111 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Tue, 8 Jul 2014 20:23:18 +0000 Subject: [PATCH] Remove unnecessary check for NULL git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212564 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 4b202e136d..0987673bb2 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -788,16 +788,13 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, // of the declaration as the location for the subprogram. A function // may lack a declaration in the source code if it is created by code // gen. (examples: _GLOBAL__I_a, __cxx_global_array_dtor, thunk). - SourceLocation Loc; - if (FD) { - Loc = FD->getLocation(); - - // If this is a function specialization then use the pattern body - // as the location for the function. - if (const FunctionDecl *SpecDecl = FD->getTemplateInstantiationPattern()) - if (SpecDecl->hasBody(SpecDecl)) - Loc = SpecDecl->getLocation(); - } + SourceLocation Loc = FD->getLocation(); + + // If this is a function specialization then use the pattern body + // as the location for the function. + if (const FunctionDecl *SpecDecl = FD->getTemplateInstantiationPattern()) + if (SpecDecl->hasBody(SpecDecl)) + Loc = SpecDecl->getLocation(); // Emit the standard function prologue. StartFunction(GD, ResTy, Fn, FnInfo, Args, Loc, BodyRange.getBegin()); -- 2.40.0