[PATCH] D74076: [Clang][Driver] Remove -M group options before generating crash diagnostics

Alexandre Ganea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 6 13:29:51 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGf41ec709d9d3: [Clang][Driver] Remove -M group options before generating crash diagnostics (authored by aganea).

Changed prior to commit:
  https://reviews.llvm.org/D74076?vs=242676&id=242992#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74076/new/

https://reviews.llvm.org/D74076

Files:
  clang/lib/Driver/Compilation.cpp
  clang/test/Driver/output-file-cleanup.c


Index: clang/test/Driver/output-file-cleanup.c
===================================================================
--- clang/test/Driver/output-file-cleanup.c
+++ clang/test/Driver/output-file-cleanup.c
@@ -1,7 +1,4 @@
 
-// Temporarily disable this test until the -MF flag is properly removed from the diagnostics generation.
-// XFAIL: *
-
 // RUN: rm -f "%t.d" "%t1.s" "%t2.s" "%t3.s" "%t4.s" "%t5.s"
 //
 // RUN: touch %t.s
Index: clang/lib/Driver/Compilation.cpp
===================================================================
--- clang/lib/Driver/Compilation.cpp
+++ clang/lib/Driver/Compilation.cpp
@@ -258,14 +258,23 @@
 
   // Remove any user specified output.  Claim any unclaimed arguments, so as
   // to avoid emitting warnings about unused args.
-  OptSpecifier OutputOpts[] = { options::OPT_o, options::OPT_MD,
-                                options::OPT_MMD };
+  OptSpecifier OutputOpts[] = {
+      options::OPT_o,  options::OPT_MD, options::OPT_MMD, options::OPT_M,
+      options::OPT_MM, options::OPT_MF, options::OPT_MG,  options::OPT_MJ,
+      options::OPT_MQ, options::OPT_MT, options::OPT_MV};
   for (unsigned i = 0, e = llvm::array_lengthof(OutputOpts); i != e; ++i) {
     if (TranslatedArgs->hasArg(OutputOpts[i]))
       TranslatedArgs->eraseArg(OutputOpts[i]);
   }
   TranslatedArgs->ClaimAllArgs();
 
+  // Force re-creation of the toolchain Args, otherwise our modifications just
+  // above will have no effect.
+  for (auto Arg : TCArgs)
+    if (Arg.second != TranslatedArgs)
+      delete Arg.second;
+  TCArgs.clear();
+
   // Redirect stdout/stderr to /dev/null.
   Redirects = {None, {""}, {""}};
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74076.242992.patch
Type: text/x-patch
Size: 1647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200206/671b46be/attachment.bin>


More information about the cfe-commits mailing list