[PATCH] D110458: [clang] Put original flags on 'Driver args:' crash report line
Nico Weber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 27 07:25:08 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG63bb2d585e97: [clang] Put original flags on 'Driver args:' crash report line (authored by thakis).
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110458/new/
https://reviews.llvm.org/D110458
Files:
clang/lib/Driver/Driver.cpp
clang/test/Driver/crash-report-clang-cl.c
Index: clang/test/Driver/crash-report-clang-cl.c
===================================================================
--- /dev/null
+++ clang/test/Driver/crash-report-clang-cl.c
@@ -0,0 +1,24 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+
+// RUN: env TMPDIR=%t TEMP=%t TMP=%t RC_DEBUG_OPTIONS=1 \
+// RUN: not %clang_cl -fsyntax-only /Brepro /source-charset:utf-8 \
+// RUN: -- %s 2>&1 | FileCheck %s
+// RUN: cat %t/crash-report-*.sh | FileCheck --check-prefix=CHECKSH %s
+
+// REQUIRES: crash-recovery
+
+#pragma clang __debug crash
+
+// CHECK: Preprocessed source(s) and associated run script(s) are located at:
+// CHECK-NEXT: note: diagnostic msg: {{.*}}crash-report-clang-cl-{{.*}}.c
+// CHECKSH: # Crash reproducer
+// CHECKSH-NEXT: # Driver args: {{.*}}"-fsyntax-only"
+// CHECKSH-SAME: /Brepro
+// CHECKSH-SAME: /source-charset:utf-8
+// CHECKSH-NOT: -mno-incremental-linker-compatible
+// CHECKSH-NOT: -finput-charset=utf-8
+// CHECKSH-NEXT: # Original command: {{.*$}}
+// CHECKSH-NEXT: "-cc1"
+// CHECKSH: "-main-file-name" "crash-report-clang-cl.c"
+// CHECKSH: "crash-report-{{[^ ]*}}.c"
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1216,8 +1216,14 @@
static void printArgList(raw_ostream &OS, const llvm::opt::ArgList &Args) {
llvm::opt::ArgStringList ASL;
- for (const auto *A : Args)
+ for (const auto *A : Args) {
+ // Use user's original spelling of flags. For example, use
+ // `/source-charset:utf-8` instead of `-finput-charset=utf-8` if the user
+ // wrote the former.
+ while (A->getAlias())
+ A = A->getAlias();
A->render(Args, ASL);
+ }
for (auto I = ASL.begin(), E = ASL.end(); I != E; ++I) {
if (I != ASL.begin())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110458.375250.patch
Type: text/x-patch
Size: 1819 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210927/204b1977/attachment.bin>
More information about the cfe-commits
mailing list