From: Michael Liao Date: Wed, 25 Jan 2023 15:19:44 +0000 (+0000) Subject: [clang][CodeGen][NFC] Fix `llvm-else-after-return` X-Git-Tag: upstream/17.0.6~19601 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd61d2abe0fdfcee52e16998f7f3fda82572cd6f;p=platform%2Fupstream%2Fllvm.git [clang][CodeGen][NFC] Fix `llvm-else-after-return` --- diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 12d602f..38e6ec6 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -3318,7 +3318,8 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { if (MustBeEmitted(Global)) EmitOMPDeclareReduction(DRD); return; - } else if (auto *DMD = dyn_cast(Global)) { + } + if (auto *DMD = dyn_cast(Global)) { if (MustBeEmitted(Global)) EmitOMPDeclareMapper(DMD); return; @@ -4687,16 +4688,17 @@ LangAS CodeGenModule::GetGlobalVarAddressSpace(const VarDecl *D) { return LangAS::sycl_global; if (LangOpts.CUDA && LangOpts.CUDAIsDevice) { - if (D && D->hasAttr()) - return LangAS::cuda_constant; - else if (D && D->hasAttr()) - return LangAS::cuda_shared; - else if (D && D->hasAttr()) - return LangAS::cuda_device; - else if (D && D->getType().isConstQualified()) - return LangAS::cuda_constant; - else - return LangAS::cuda_device; + if (D) { + if (D->hasAttr()) + return LangAS::cuda_constant; + if (D->hasAttr()) + return LangAS::cuda_shared; + if (D->hasAttr()) + return LangAS::cuda_device; + if (D->getType().isConstQualified()) + return LangAS::cuda_constant; + } + return LangAS::cuda_device; } if (LangOpts.OpenMP) {