@@ -1527,6 +1527,11 @@ bool Driver::getCrashDiagnosticFile(StringRef ReproCrashFilename,
1527
1527
return false ;
1528
1528
}
1529
1529
1530
+ static const char BugReporMsg[] =
1531
+ " \n ********************\n\n "
1532
+ " PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:\n "
1533
+ " Preprocessed source(s) and associated run script(s) are located at:" ;
1534
+
1530
1535
// When clang crashes, produce diagnostic information including the fully
1531
1536
// preprocessed source file(s). Request that the developer attach the
1532
1537
// diagnostic information to a bug report.
@@ -1582,6 +1587,29 @@ void Driver::generateCompilationDiagnostics(
1582
1587
// Suppress tool output.
1583
1588
C.initCompilationForDiagnostics ();
1584
1589
1590
+ // If lld failed, rerun it again with --reproduce.
1591
+ if (IsLLD) {
1592
+ const char *TmpName = CreateTempFile (C, " linker-crash" , " tar" );
1593
+ Command NewLLDInvocation = Cmd;
1594
+ llvm::opt::ArgStringList ArgList = NewLLDInvocation.getArguments ();
1595
+ StringRef ReproduceOption =
1596
+ C.getDefaultToolChain ().getTriple ().isWindowsMSVCEnvironment ()
1597
+ ? " /reproduce:"
1598
+ : " --reproduce=" ;
1599
+ ArgList.push_back (Saver.save (Twine (ReproduceOption) + TmpName).data ());
1600
+ NewLLDInvocation.replaceArguments (std::move (ArgList));
1601
+
1602
+ // Redirect stdout/stderr to /dev/null.
1603
+ NewLLDInvocation.Execute ({None, {" " }, {" " }}, nullptr , nullptr );
1604
+ Diag (clang::diag::note_drv_command_failed_diag_msg) << BugReporMsg;
1605
+ Diag (clang::diag::note_drv_command_failed_diag_msg) << TmpName;
1606
+ Diag (clang::diag::note_drv_command_failed_diag_msg)
1607
+ << " \n\n ********************" ;
1608
+ if (Report)
1609
+ Report->TemporaryFiles .push_back (TmpName);
1610
+ return ;
1611
+ }
1612
+
1585
1613
// Construct the list of inputs.
1586
1614
InputList Inputs;
1587
1615
BuildInputs (C.getDefaultToolChain (), C.getArgs (), Inputs);
@@ -1659,33 +1687,14 @@ void Driver::generateCompilationDiagnostics(
1659
1687
return ;
1660
1688
}
1661
1689
1662
- // If lld failed, rerun it again with --reproduce.
1663
- if (IsLLD) {
1664
- const char *TmpName = CreateTempFile (C, " linker-crash" , " tar" );
1665
- Command NewLLDInvocation = Cmd;
1666
- llvm::opt::ArgStringList ArgList = NewLLDInvocation.getArguments ();
1667
- StringRef ReproduceOption =
1668
- C.getDefaultToolChain ().getTriple ().isWindowsMSVCEnvironment ()
1669
- ? " /reproduce:"
1670
- : " --reproduce=" ;
1671
- ArgList.push_back (Saver.save (Twine (ReproduceOption) + TmpName).data ());
1672
- NewLLDInvocation.replaceArguments (std::move (ArgList));
1673
-
1674
- // Redirect stdout/stderr to /dev/null.
1675
- NewLLDInvocation.Execute ({None, {" " }, {" " }}, nullptr , nullptr );
1676
- }
1677
-
1678
1690
const ArgStringList &TempFiles = C.getTempFiles ();
1679
1691
if (TempFiles.empty ()) {
1680
1692
Diag (clang::diag::note_drv_command_failed_diag_msg)
1681
1693
<< " Error generating preprocessed source(s)." ;
1682
1694
return ;
1683
1695
}
1684
1696
1685
- Diag (clang::diag::note_drv_command_failed_diag_msg)
1686
- << " \n ********************\n\n "
1687
- " PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:\n "
1688
- " Preprocessed source(s) and associated run script(s) are located at:" ;
1697
+ Diag (clang::diag::note_drv_command_failed_diag_msg) << BugReporMsg;
1689
1698
1690
1699
SmallString<128 > VFS;
1691
1700
SmallString<128 > ReproCrashFilename;
0 commit comments