[PATCH] D107841: CodeGen: No need to check for isExternC if HasStrictReturn is already false

Arnold Schwaighofer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 10 09:39:02 PDT 2021


aschwaighofer created this revision.
aschwaighofer added a reviewer: rjmccall.
aschwaighofer requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

NFC intended.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107841

Files:
  clang/lib/CodeGen/CGCall.cpp


Index: clang/lib/CodeGen/CGCall.cpp
===================================================================
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -2241,7 +2241,7 @@
   // 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))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107841.365513.patch
Type: text/x-patch
Size: 633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210810/775899cc/attachment.bin>


More information about the cfe-commits mailing list