[clang] 377dddf - [clang][Driver] Pass correct reproduce flag to lld-link

Alex Brachet via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 18 13:12:33 PDT 2022


Author: Alex Brachet
Date: 2022-08-18T20:12:23Z
New Revision: 377dddf4a08335a79180dd1d7907cb98ceaa641a

URL: https://github.com/llvm/llvm-project/commit/377dddf4a08335a79180dd1d7907cb98ceaa641a
DIFF: https://github.com/llvm/llvm-project/commit/377dddf4a08335a79180dd1d7907cb98ceaa641a.diff

LOG: [clang][Driver] Pass correct reproduce flag to lld-link

Additionally, the explicit linux target has been removed from the test.

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

Added: 
    

Modified: 
    clang/lib/Driver/Driver.cpp
    clang/test/Driver/lld-repro.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 31cd5865c8168..d00f08d15ae58 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1631,7 +1631,11 @@ void Driver::generateCompilationDiagnostics(
     const char *TmpName = CreateTempFile(C, "linker-crash", "tar");
     Command NewLLDInvocation = Cmd;
     llvm::opt::ArgStringList ArgList = NewLLDInvocation.getArguments();
-    ArgList.push_back(Saver.save(Twine{"--reproduce="} + TmpName).data());
+    StringRef ReproduceOption =
+        C.getDefaultToolChain().getTriple().isWindowsMSVCEnvironment()
+            ? "/reproduce:"
+            : "--reproduce=";
+    ArgList.push_back(Saver.save(Twine(ReproduceOption) + TmpName).data());
     NewLLDInvocation.replaceArguments(std::move(ArgList));
 
     // Redirect stdout/stderr to /dev/null.

diff  --git a/clang/test/Driver/lld-repro.c b/clang/test/Driver/lld-repro.c
index 65d562996e62f..26b5846e8a496 100644
--- a/clang/test/Driver/lld-repro.c
+++ b/clang/test/Driver/lld-repro.c
@@ -1,6 +1,7 @@
-// REQUIRES: lld, x86-registered-target
+// REQUIRES: lld
+// UNSUPPORTED: ps4
 
-// RUN: not %clang %s -target x86_64-linux -nostartfiles -nostdlib -fuse-ld=lld -gen-reproducer=error -fcrash-diagnostics-dir=%t -fcrash-diagnostics=all 2>&1 \
+// RUN: not %clang %s -nostartfiles -nostdlib -fuse-ld=lld -gen-reproducer=error -fcrash-diagnostics-dir=%t -fcrash-diagnostics=all 2>&1 \
 // RUN:   | FileCheck %s
 
 // check that we still get lld's output
@@ -13,9 +14,9 @@
 // CHECK-NEXT: note: diagnostic msg:
 // CHECK: ********************
 
-// RUN: not %clang %s -target x86_64-linux -nostartfiles -nostdlib -fuse-ld=lld -gen-reproducer=error -fcrash-diagnostics-dir=%t -fcrash-diagnostics=compiler 2>&1 \
+// RUN: not %clang %s -nostartfiles -nostdlib -fuse-ld=lld -gen-reproducer=error -fcrash-diagnostics-dir=%t -fcrash-diagnostics=compiler 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=NO-LINKER
-// RUN: not %clang %s -target x86_64-linux -nostartfiles -nostdlib -fuse-ld=lld -gen-reproducer=error -fcrash-diagnostics-dir=%t 2>&1 \
+// RUN: not %clang %s -nostartfiles -nostdlib -fuse-ld=lld -gen-reproducer=error -fcrash-diagnostics-dir=%t 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=NO-LINKER
 
 // NO-LINKER-NOT: Preprocessed source(s) and associated run script(s) are located at:


        


More information about the cfe-commits mailing list