Author: Michael Liao Date: 2020-06-24T13:13:42-04:00 New Revision: ebc9e0f1f0786b892b4a6eaf50013a18aed31aa5
URL: https://github.com/llvm/llvm-project/commit/ebc9e0f1f0786b892b4a6eaf50013a18aed31aa5 DIFF: https://github.com/llvm/llvm-project/commit/ebc9e0f1f0786b892b4a6eaf50013a18aed31aa5.diff LOG: Fix coding style. NFC. - Remove `else` after `return`. Added: Modified: clang/lib/CodeGen/CodeGenModule.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index f0ab5165584c..5e902aa15bcf 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -3656,26 +3656,29 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName, } llvm::Constant * -CodeGenModule::GetAddrOfGlobal(GlobalDecl GD, - ForDefinition_t IsForDefinition) { +CodeGenModule::GetAddrOfGlobal(GlobalDecl GD, ForDefinition_t IsForDefinition) { const Decl *D = GD.getDecl(); + if (isa<CXXConstructorDecl>(D) || isa<CXXDestructorDecl>(D)) return getAddrOfCXXStructor(GD, /*FnInfo=*/nullptr, /*FnType=*/nullptr, /*DontDefer=*/false, IsForDefinition); - else if (isa<CXXMethodDecl>(D)) { - auto FInfo = &getTypes().arrangeCXXMethodDeclaration( - cast<CXXMethodDecl>(D)); + + if (isa<CXXMethodDecl>(D)) { + auto FInfo = + &getTypes().arrangeCXXMethodDeclaration(cast<CXXMethodDecl>(D)); auto Ty = getTypes().GetFunctionType(*FInfo); return GetAddrOfFunction(GD, Ty, /*ForVTable=*/false, /*DontDefer=*/false, IsForDefinition); - } else if (isa<FunctionDecl>(D)) { + } + + if (isa<FunctionDecl>(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<VarDecl>(D), /*Ty=*/nullptr, - IsForDefinition); + } + + return GetAddrOfGlobalVar(cast<VarDecl>(D), /*Ty=*/nullptr, IsForDefinition); } llvm::GlobalVariable *CodeGenModule::CreateOrReplaceCXXRuntimeVariable( _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits