From: Yaron Keren Date: Sat, 24 Dec 2016 15:32:39 +0000 (+0000) Subject: Deduplicate several GD.getDecl() calls into Decl * local variable. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6fe1d0dfe645112ce97fb2638b6f6c7cff5ba45e;p=clang Deduplicate several GD.getDecl() calls into Decl * local variable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290495 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index f66cfef776..ab29d2dbb5 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -2300,29 +2300,30 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, llvm::Constant * CodeGenModule::GetAddrOfGlobal(GlobalDecl GD, ForDefinition_t IsForDefinition) { - if (isa(GD.getDecl())) - return getAddrOfCXXStructor(cast(GD.getDecl()), + const Decl *D = GD.getDecl(); + if (isa(D)) + return getAddrOfCXXStructor(cast(D), getFromCtorType(GD.getCtorType()), /*FnInfo=*/nullptr, /*FnType=*/nullptr, /*DontDefer=*/false, IsForDefinition); - else if (isa(GD.getDecl())) - return getAddrOfCXXStructor(cast(GD.getDecl()), + else if (isa(D)) + return getAddrOfCXXStructor(cast(D), getFromDtorType(GD.getDtorType()), /*FnInfo=*/nullptr, /*FnType=*/nullptr, /*DontDefer=*/false, IsForDefinition); - else if (isa(GD.getDecl())) { + else if (isa(D)) { auto FInfo = &getTypes().arrangeCXXMethodDeclaration( - cast(GD.getDecl())); + cast(D)); auto Ty = getTypes().GetFunctionType(*FInfo); return GetAddrOfFunction(GD, Ty, /*ForVTable=*/false, /*DontDefer=*/false, IsForDefinition); - } else if (isa(GD.getDecl())) { + } else if (isa(D)) { const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(GD); llvm::FunctionType *Ty = getTypes().GetFunctionType(FI); return GetAddrOfFunction(GD, Ty, /*ForVTable=*/false, /*DontDefer=*/false, IsForDefinition); } else - return GetAddrOfGlobalVar(cast(GD.getDecl()), /*Ty=*/nullptr, + return GetAddrOfGlobalVar(cast(D), /*Ty=*/nullptr, IsForDefinition); }