authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-12-16 10:40:56+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-12-16 12:18:14+01:00
log83ff94406e13e18c8826cd48a68c2c8d676feaac
tree2d59a8986d026dc8831d6cabb2fbacf703c3ab18
parent9c2d8056ce177fef2a1b859016b11362686213b1

Update clang drivers

llvm commit b2851aea80e5a8f0cfd6c3c5a56a6b00fb28c6b6

2 files changed, 21 insertions(+), 15 deletions(-)

src/zig_clang_cc1as_main.cpp+14-15
......@@ -221,19 +221,13 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
221221 // Any DebugInfoKind implies GenDwarfForAssembly.
222222 Opts.GenDwarfForAssembly = Args.hasArg(OPT_debug_info_kind_EQ);
223223
224 if (const Arg *A = Args.getLastArg(OPT_compress_debug_sections,
225 OPT_compress_debug_sections_EQ)) {
226 if (A->getOption().getID() == OPT_compress_debug_sections) {
227 // TODO: be more clever about the compression type auto-detection
228 Opts.CompressDebugSections = llvm::DebugCompressionType::GNU;
229 } else {
230 Opts.CompressDebugSections =
231 llvm::StringSwitch<llvm::DebugCompressionType>(A->getValue())
232 .Case("none", llvm::DebugCompressionType::None)
233 .Case("zlib", llvm::DebugCompressionType::Z)
234 .Case("zlib-gnu", llvm::DebugCompressionType::GNU)
235 .Default(llvm::DebugCompressionType::None);
236 }
224 if (const Arg *A = Args.getLastArg(OPT_compress_debug_sections_EQ)) {
225 Opts.CompressDebugSections =
226 llvm::StringSwitch<llvm::DebugCompressionType>(A->getValue())
227 .Case("none", llvm::DebugCompressionType::None)
228 .Case("zlib", llvm::DebugCompressionType::Z)
229 .Case("zlib-gnu", llvm::DebugCompressionType::GNU)
230 .Default(llvm::DebugCompressionType::None);
237231 }
238232
239233 Opts.RelaxELFRelocations = Args.hasArg(OPT_mrelax_relocations);
......@@ -434,8 +428,11 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts,
434428 std::unique_ptr<MCStreamer> Str;
435429
436430 std::unique_ptr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo());
431 assert(MCII && "Unable to create instruction info!");
432
437433 std::unique_ptr<MCSubtargetInfo> STI(
438434 TheTarget->createMCSubtargetInfo(Opts.Triple, Opts.CPU, FS));
435 assert(STI && "Unable to create subtarget info!");
439436
440437 raw_pwrite_stream *Out = FDOS.get();
441438 std::unique_ptr<buffer_ostream> BOS;
......@@ -474,6 +471,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts,
474471 TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx));
475472 std::unique_ptr<MCAsmBackend> MAB(
476473 TheTarget->createMCAsmBackend(*STI, *MRI, MCOptions));
474 assert(MAB && "Unable to create asm backend!");
475
477476 std::unique_ptr<MCObjectWriter> OW =
478477 DwoOS ? MAB->createDwoObjectWriter(*Out, *DwoOS)
479478 : MAB->createObjectWriter(*Out);
......@@ -526,8 +525,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts,
526525 Failed = Parser->Run(Opts.NoInitialTextSection);
527526 }
528527
529 // Close Streamer first.
530 // It might have a reference to the output stream.
528 // Parser has a reference to the output stream (Str), so close Parser first.
529 Parser.reset();
531530 Str.reset();
532531 // Close the output stream early.
533532 BOS.reset();
src/zig_clang_driver.cpp+7
......@@ -528,6 +528,13 @@ int ZigClang_main(int argc_, const char **argv_) {
528528 IsCrash = CommandRes < 0 || CommandRes == 70;
529529#ifdef _WIN32
530530 IsCrash |= CommandRes == 3;
531#endif
532#if LLVM_ON_UNIX
533 // When running in integrated-cc1 mode, the CrashRecoveryContext returns
534 // the same codes as if the program crashed. See section "Exit Status for
535 // Commands":
536 // https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html
537 IsCrash |= CommandRes > 128;
531538#endif
532539 if (IsCrash) {
533540 TheDriver.generateCompilationDiagnostics(*C, *FailingCommand);