[PATCH] D130620: Fix lack of cc1 flag in llvmcmd sections when assertions are enabled

Aiden Grossman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 27 02:41:55 PDT 2022


aidengrossman created this revision.
Herald added a project: All.
aidengrossman requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Currently when assertions are enabled, the cc1 flag is not
inserted into the llvmcmd section of object files with embedded
bitcode. This deviates from the normal behavior where this is
the first flag that is inserted. This error stems from incorrect
use of the function generateCC1CommandLine() which requires
manually adding in the -cc1 flag which is currently not done.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130620

Files:
  clang/lib/Frontend/CompilerInvocation.cpp


Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -4544,7 +4544,10 @@
         return CreateFromArgsImpl(Invocation, CommandLineArgs, Diags, Argv0);
       },
       [](CompilerInvocation &Invocation, SmallVectorImpl<const char *> &Args,
-         StringAllocator SA) { Invocation.generateCC1CommandLine(Args, SA); },
+         StringAllocator SA) {
+        Invocation.generateCC1CommandLine(Args, SA);
+        Args.insert(Args.begin(), "-cc1");
+      },
       Invocation, DummyInvocation, CommandLineArgs, Diags, Argv0);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130620.447968.patch
Type: text/x-patch
Size: 693 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220727/1d00e517/attachment.bin>


More information about the cfe-commits mailing list