[clang] 9eb99d2 - CodeGen: No need to check for isExternC if HasStrictReturn is already false

Arnold Schwaighofer via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 11 07:44:23 PDT 2021


Author: Arnold Schwaighofer
Date: 2021-08-11T07:42:48-07:00
New Revision: 9eb99d2e73b5598076fbdd8abceb3549afa8f0ae

URL: https://github.com/llvm/llvm-project/commit/9eb99d2e73b5598076fbdd8abceb3549afa8f0ae
DIFF: https://github.com/llvm/llvm-project/commit/9eb99d2e73b5598076fbdd8abceb3549afa8f0ae.diff

LOG: CodeGen: No need to check for isExternC if HasStrictReturn is already false

NFC intended.

Differential Revision: https://reviews.llvm.org/D107841

Added: 
    

Modified: 
    clang/lib/CodeGen/CGCall.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 1296dfa18b9a5..43be6755a0745 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2241,7 +2241,7 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
   // C++ explicitly makes returning undefined values UB. C's rule only applies
   // to used values, so we never mark them noundef for now.
   bool HasStrictReturn = getLangOpts().CPlusPlus;
-  if (TargetDecl) {
+  if (TargetDecl && HasStrictReturn) {
     if (const FunctionDecl *FDecl = dyn_cast<FunctionDecl>(TargetDecl))
       HasStrictReturn &= !FDecl->isExternC();
     else if (const VarDecl *VDecl = dyn_cast<VarDecl>(TargetDecl))


        


More information about the cfe-commits mailing list