authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-01-17 05:19:20+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-04-22 15:31:56+02:00
log1b7ec080c9dd2215482b66bbe0602acb9720a497
treec3748eb36e878b4dd4245fd5e52c0baae4916291
parent3e7678a761a37adcdd56aecdce87c1247d34f399
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

zig cc: update driver files to LLVM 22


5 files changed, 98 insertions(+), 69 deletions(-)

src/zig_clang_cc1_main.cpp+26-27
......@@ -12,19 +12,20 @@
1212//
1313//===----------------------------------------------------------------------===//
1414
15#include "clang/Basic/DiagnosticFrontend.h"
1516#include "clang/Basic/Stack.h"
1617#include "clang/Basic/TargetOptions.h"
1718#include "clang/CodeGen/ObjectFilePCHContainerWriter.h"
1819#include "clang/Config/config.h"
20#include "clang/Driver/Driver.h"
1921#include "clang/Driver/DriverDiagnostic.h"
20#include "clang/Driver/Options.h"
2122#include "clang/Frontend/CompilerInstance.h"
2223#include "clang/Frontend/CompilerInvocation.h"
23#include "clang/Frontend/FrontendDiagnostic.h"
2424#include "clang/Frontend/TextDiagnosticBuffer.h"
2525#include "clang/Frontend/TextDiagnosticPrinter.h"
2626#include "clang/Frontend/Utils.h"
2727#include "clang/FrontendTool/Utils.h"
28#include "clang/Options/Options.h"
2829#include "clang/Serialization/ObjectFilePCHContainerReader.h"
2930#include "llvm/ADT/Statistic.h"
3031#include "llvm/ADT/StringExtras.h"
......@@ -38,6 +39,7 @@
3839#include "llvm/Support/BuryPointer.h"
3940#include "llvm/Support/Compiler.h"
4041#include "llvm/Support/ErrorHandling.h"
42#include "llvm/Support/IOSandbox.h"
4143#include "llvm/Support/ManagedStatic.h"
4244#include "llvm/Support/Path.h"
4345#include "llvm/Support/Process.h"
......@@ -217,7 +219,7 @@ static int PrintEnabledExtensions(const TargetOptions& TargetOpts) {
217219int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
218220 ensureSufficientStack();
219221
220 IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
222 IntrusiveRefCntPtr<DiagnosticIDs> DiagID = DiagnosticIDs::create();
221223
222224 // Register the support for object-file-wrapped Clang modules.
223225 auto PCHOps = std::make_shared<PCHContainerOperations>();
......@@ -269,12 +271,17 @@ int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
269271 if (Clang->getHeaderSearchOpts().UseBuiltinIncludes &&
270272 Clang->getHeaderSearchOpts().ResourceDir.empty())
271273 Clang->getHeaderSearchOpts().ResourceDir =
272 CompilerInvocation::GetResourcesPath(Argv0, MainAddr);
274 GetResourcesPath(Argv0, MainAddr);
275
276 /// Create the actual file system.
277 auto VFS = [] {
278 auto BypassSandbox = llvm::sys::sandbox::scopedDisable();
279 return llvm::vfs::getRealFileSystem();
280 }();
281 Clang->createVirtualFileSystem(std::move(VFS), DiagsBuffer);
273282
274283 // Create the actual diagnostics engine.
275 Clang->createDiagnostics(*llvm::vfs::getRealFileSystem());
276 if (!Clang->hasDiagnostics())
277 return 1;
284 Clang->createDiagnostics();
278285
279286 // Set an error handler, so that any LLVM backend diagnostics go through our
280287 // error handler.
......@@ -299,29 +306,21 @@ int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
299306
300307 // If any timers were active but haven't been destroyed yet, print their
301308 // results now. This happens in -disable-free mode.
302 std::unique_ptr<raw_ostream> IOFile = llvm::CreateInfoOutputFile();
303 if (Clang->getCodeGenOpts().TimePassesJson) {
304 *IOFile << "{\n";
305 llvm::TimerGroup::printAllJSONValues(*IOFile, "");
306 *IOFile << "\n}\n";
307 } else {
308 llvm::TimerGroup::printAll(*IOFile);
309 {
310 // This isn't a formal input or output of the compiler.
311 auto BypassSandbox = llvm::sys::sandbox::scopedDisable();
312 std::unique_ptr<raw_ostream> IOFile = llvm::CreateInfoOutputFile();
313 if (Clang->getCodeGenOpts().TimePassesJson) {
314 *IOFile << "{\n";
315 llvm::TimerGroup::printAllJSONValues(*IOFile, "");
316 *IOFile << "\n}\n";
317 } else if (!Clang->getCodeGenOpts().TimePassesStatsFile) {
318 llvm::TimerGroup::printAll(*IOFile);
319 }
320 llvm::TimerGroup::clearAll();
309321 }
310 llvm::TimerGroup::clearAll();
311322
312323 if (llvm::timeTraceProfilerEnabled()) {
313 // It is possible that the compiler instance doesn't own a file manager here
314 // if we're compiling a module unit. Since the file manager are owned by AST
315 // when we're compiling a module unit. So the file manager may be invalid
316 // here.
317 //
318 // It should be fine to create file manager here since the file system
319 // options are stored in the compiler invocation and we can recreate the VFS
320 // from the compiler invocation.
321 if (!Clang->hasFileManager())
322 Clang->createFileManager(createVFSFromCompilerInvocation(
323 Clang->getInvocation(), Clang->getDiagnostics()));
324
325324 if (auto profilerOutput = Clang->createOutputFile(
326325 Clang->getFrontendOpts().TimeTracePath, /*Binary=*/false,
327326 /*RemoveFileOnSignal=*/false,
src/zig_clang_cc1as_main.cpp+48-27
......@@ -12,12 +12,12 @@
1212//===----------------------------------------------------------------------===//
1313
1414#include "clang/Basic/Diagnostic.h"
15#include "clang/Basic/DiagnosticFrontend.h"
1516#include "clang/Basic/DiagnosticOptions.h"
1617#include "clang/Driver/DriverDiagnostic.h"
17#include "clang/Driver/Options.h"
18#include "clang/Frontend/FrontendDiagnostic.h"
1918#include "clang/Frontend/TextDiagnosticPrinter.h"
2019#include "clang/Frontend/Utils.h"
20#include "clang/Options/Options.h"
2121#include "llvm/ADT/STLExtras.h"
2222#include "llvm/ADT/StringExtras.h"
2323#include "llvm/ADT/StringSwitch.h"
......@@ -45,6 +45,7 @@
4545#include "llvm/Support/ErrorHandling.h"
4646#include "llvm/Support/FileSystem.h"
4747#include "llvm/Support/FormattedStream.h"
48#include "llvm/Support/IOSandbox.h"
4849#include "llvm/Support/MemoryBuffer.h"
4950#include "llvm/Support/Path.h"
5051#include "llvm/Support/Process.h"
......@@ -59,8 +60,7 @@
5960#include <optional>
6061#include <system_error>
6162using namespace clang;
62using namespace clang::driver;
63using namespace clang::driver::options;
63using namespace clang::options;
6464using namespace llvm;
6565using namespace llvm::opt;
6666
......@@ -71,8 +71,8 @@ struct AssemblerInvocation {
7171 /// @name Target Options
7272 /// @{
7373
74 /// The name of the target triple to assemble for.
75 std::string Triple;
74 /// The target triple to assemble for.
75 llvm::Triple Triple;
7676
7777 /// If given, the name of the target CPU to determine which instructions
7878 /// are legal.
......@@ -163,6 +163,10 @@ struct AssemblerInvocation {
163163 LLVM_PREFERRED_TYPE(bool)
164164 unsigned EmitCompactUnwindNonCanonical : 1;
165165
166 // Whether to emit sframe unwind sections.
167 LLVM_PREFERRED_TYPE(bool)
168 unsigned EmitSFrameUnwind : 1;
169
166170 LLVM_PREFERRED_TYPE(bool)
167171 unsigned Crel : 1;
168172 LLVM_PREFERRED_TYPE(bool)
......@@ -192,9 +196,12 @@ struct AssemblerInvocation {
192196 std::string AsSecureLogFile;
193197 /// @}
194198
199 void setTriple(llvm::StringRef Str) {
200 Triple = llvm::Triple(llvm::Triple::normalize(Str));
201 }
202
195203public:
196204 AssemblerInvocation() {
197 Triple = "";
198205 NoInitialTextSection = 0;
199206 InputFile = "-";
200207 OutputPath = "-";
......@@ -261,7 +268,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
261268 // Construct the invocation.
262269
263270 // Target Options
264 Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
271 Opts.setTriple(Args.getLastArgValue(OPT_triple));
265272 if (Arg *A = Args.getLastArg(options::OPT_darwin_target_variant_triple))
266273 Opts.DarwinTargetVariantTriple = llvm::Triple(A->getValue());
267274 if (Arg *A = Args.getLastArg(OPT_darwin_target_variant_sdk_version_EQ)) {
......@@ -278,7 +285,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
278285
279286 // Use the default target triple if unspecified.
280287 if (Opts.Triple.empty())
281 Opts.Triple = llvm::sys::getDefaultTargetTriple();
288 Opts.setTriple(llvm::sys::getDefaultTargetTriple());
282289
283290 // Language Options
284291 Opts.IncludePaths = Args.getAllArgValues(OPT_I);
......@@ -385,6 +392,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
385392
386393 Opts.EmitCompactUnwindNonCanonical =
387394 Args.hasArg(OPT_femit_compact_unwind_non_canonical);
395 Opts.EmitSFrameUnwind = Args.hasArg(OPT_gsframe);
388396 Opts.Crel = Args.hasArg(OPT_crel);
389397 Opts.ImplicitMapsyms = Args.hasArg(OPT_mmapsyms_implicit);
390398 Opts.X86RelaxRelocations = !Args.hasArg(OPT_mrelax_relocations_no);
......@@ -414,15 +422,19 @@ getOutputStream(StringRef Path, DiagnosticsEngine &Diags, bool Binary) {
414422}
415423
416424static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
417 DiagnosticsEngine &Diags) {
425 DiagnosticsEngine &Diags,
426 IntrusiveRefCntPtr<vfs::FileSystem> VFS) {
418427 // Get the target specific parser.
419428 std::string Error;
420429 const Target *TheTarget = TargetRegistry::lookupTarget(Opts.Triple, Error);
421430 if (!TheTarget)
422 return Diags.Report(diag::err_target_unknown_triple) << Opts.Triple;
431 return Diags.Report(diag::err_target_unknown_triple) << Opts.Triple.str();
423432
424 ErrorOr<std::unique_ptr<MemoryBuffer>> Buffer =
425 MemoryBuffer::getFileOrSTDIN(Opts.InputFile, /*IsText=*/true);
433 ErrorOr<std::unique_ptr<MemoryBuffer>> Buffer = [&] {
434 // FIXME(sandboxing): Make this a proper input file.
435 auto BypassSandbox = sys::sandbox::scopedDisable();
436 return MemoryBuffer::getFileOrSTDIN(Opts.InputFile, /*IsText=*/true);
437 }();
426438
427439 if (std::error_code EC = Buffer.getError()) {
428440 return Diags.Report(diag::err_fe_error_reading)
......@@ -437,6 +449,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
437449 // Record the location of the include directories so that the lexer can find
438450 // it later.
439451 SrcMgr.setIncludeDirs(Opts.IncludePaths);
452 SrcMgr.setVirtualFileSystem(VFS);
440453
441454 std::unique_ptr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(Opts.Triple));
442455 assert(MRI && "Unable to create target register info!");
......@@ -445,11 +458,13 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
445458 MCOptions.MCRelaxAll = Opts.RelaxAll;
446459 MCOptions.EmitDwarfUnwind = Opts.EmitDwarfUnwind;
447460 MCOptions.EmitCompactUnwindNonCanonical = Opts.EmitCompactUnwindNonCanonical;
461 MCOptions.EmitSFrameUnwind = Opts.EmitSFrameUnwind;
448462 MCOptions.MCSaveTempLabels = Opts.SaveTemporaryLabels;
449463 MCOptions.Crel = Opts.Crel;
450464 MCOptions.ImplicitMapSyms = Opts.ImplicitMapsyms;
451465 MCOptions.X86RelaxRelocations = Opts.X86RelaxRelocations;
452466 MCOptions.X86Sse2Avx = Opts.X86Sse2Avx;
467 MCOptions.MCNoExecStack = Opts.NoExecStack;
453468 MCOptions.CompressDebugSections = Opts.CompressDebugSections;
454469 MCOptions.AsSecureLogFile = Opts.AsSecureLogFile;
455470
......@@ -477,7 +492,10 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
477492
478493 std::unique_ptr<MCSubtargetInfo> STI(
479494 TheTarget->createMCSubtargetInfo(Opts.Triple, Opts.CPU, FS));
480 assert(STI && "Unable to create subtarget info!");
495 if (!STI) {
496 return Diags.Report(diag::err_fe_unable_to_create_subtarget)
497 << Opts.CPU << FS.empty() << FS;
498 }
481499
482500 MCContext Ctx(Triple(Opts.Triple), MAI.get(), MRI.get(), STI.get(), &SrcMgr,
483501 &MCOptions);
......@@ -509,9 +527,8 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
509527 Ctx.setCompilationDir(Opts.DebugCompilationDir);
510528 else {
511529 // If no compilation dir is set, try to use the current directory.
512 SmallString<128> CWD;
513 if (!sys::fs::current_path(CWD))
514 Ctx.setCompilationDir(CWD);
530 if (auto CWD = VFS->getCurrentWorkingDirectory())
531 Ctx.setCompilationDir(*CWD);
515532 }
516533 if (!Opts.DebugPrefixMap.empty())
517534 for (const auto &KV : Opts.DebugPrefixMap)
......@@ -577,7 +594,6 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
577594 Triple T(Opts.Triple);
578595 Str.reset(TheTarget->createMCObjectStreamer(
579596 T, Ctx, std::move(MAB), std::move(OW), std::move(CE), *STI));
580 Str->initSections(Opts.NoExecStack, *STI);
581597 if (T.isOSBinFormatMachO() && T.isOSDarwin()) {
582598 Triple *TVT = Opts.DarwinTargetVariantTriple
583599 ? &*Opts.DarwinTargetVariantTriple
......@@ -605,7 +621,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
605621 std::unique_ptr<MCTargetAsmParser> TAP(
606622 TheTarget->createMCAsmParser(*STI, *Parser, *MCII, MCOptions));
607623 if (!TAP)
608 Failed = Diags.Report(diag::err_target_unknown_triple) << Opts.Triple;
624 Failed = Diags.Report(diag::err_target_unknown_triple) << Opts.Triple.str();
609625
610626 // Set values for symbols, if any.
611627 for (auto &S : Opts.SymbolDefs) {
......@@ -627,8 +643,9 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
627643}
628644
629645static bool ExecuteAssembler(AssemblerInvocation &Opts,
630 DiagnosticsEngine &Diags) {
631 bool Failed = ExecuteAssemblerImpl(Opts, Diags);
646 DiagnosticsEngine &Diags,
647 IntrusiveRefCntPtr<vfs::FileSystem> VFS) {
648 bool Failed = ExecuteAssemblerImpl(Opts, Diags, VFS);
632649
633650 // Delete output file if there were errors.
634651 if (Failed) {
......@@ -662,8 +679,12 @@ int cc1as_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
662679 TextDiagnosticPrinter *DiagClient =
663680 new TextDiagnosticPrinter(errs(), DiagOpts);
664681 DiagClient->setPrefix("clang -cc1as");
665 IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
666 DiagnosticsEngine Diags(DiagID, DiagOpts, DiagClient);
682 DiagnosticsEngine Diags(DiagnosticIDs::create(), DiagOpts, DiagClient);
683
684 auto VFS = [] {
685 auto BypassSandbox = sys::sandbox::scopedDisable();
686 return vfs::getRealFileSystem();
687 }();
667688
668689 // Set an error handler, so that any LLVM backend diagnostics go through our
669690 // error handler.
......@@ -679,8 +700,7 @@ int cc1as_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
679700 getDriverOptTable().printHelp(
680701 llvm::outs(), "clang -cc1as [options] file...",
681702 "Clang Integrated Assembler", /*ShowHidden=*/false,
682 /*ShowAllAliases=*/false,
683 llvm::opt::Visibility(driver::options::CC1AsOption));
703 /*ShowAllAliases=*/false, llvm::opt::Visibility(options::CC1AsOption));
684704
685705 return 0;
686706 }
......@@ -703,11 +723,12 @@ int cc1as_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
703723 for (unsigned i = 0; i != NumArgs; ++i)
704724 Args[i + 1] = Asm.LLVMArgs[i].c_str();
705725 Args[NumArgs + 1] = nullptr;
706 llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args.get());
726 llvm::cl::ParseCommandLineOptions(NumArgs + 1, Args.get(), /*Overview=*/"",
727 /*Errs=*/nullptr, /*VFS=*/VFS.get());
707728 }
708729
709730 // Execute the invocation, unless there were parsing errors.
710 bool Failed = Diags.hasErrorOccurred() || ExecuteAssembler(Asm, Diags);
731 bool Failed = Diags.hasErrorOccurred() || ExecuteAssembler(Asm, Diags, VFS);
711732
712733 // If any timers were active but haven't been destroyed yet, print their
713734 // results now.
src/zig_clang_driver.cpp+22-14
......@@ -18,13 +18,13 @@
1818#include "clang/Config/config.h"
1919#include "clang/Driver/Compilation.h"
2020#include "clang/Driver/DriverDiagnostic.h"
21#include "clang/Driver/Options.h"
2221#include "clang/Driver/ToolChain.h"
2322#include "clang/Frontend/ChainedDiagnosticConsumer.h"
2423#include "clang/Frontend/CompilerInvocation.h"
2524#include "clang/Frontend/SerializedDiagnosticPrinter.h"
2625#include "clang/Frontend/TextDiagnosticPrinter.h"
2726#include "clang/Frontend/Utils.h"
27#include "clang/Options/Options.h"
2828#include "llvm/ADT/ArrayRef.h"
2929#include "llvm/ADT/SmallString.h"
3030#include "llvm/ADT/SmallVector.h"
......@@ -38,6 +38,7 @@
3838#include "llvm/Support/CrashRecoveryContext.h"
3939#include "llvm/Support/ErrorHandling.h"
4040#include "llvm/Support/FileSystem.h"
41#include "llvm/Support/IOSandbox.h"
4142#include "llvm/Support/LLVMDriver.h"
4243#include "llvm/Support/Path.h"
4344#include "llvm/Support/PrettyStackTrace.h"
......@@ -201,7 +202,8 @@ static void FixupDiagPrefixExeName(TextDiagnosticPrinter *DiagClient,
201202}
202203
203204static int ExecuteCC1Tool(SmallVectorImpl<const char *> &ArgV,
204 const llvm::ToolContext &ToolContext) {
205 const llvm::ToolContext &ToolContext,
206 IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) {
205207 // If we call the cc1 tool from the clangDriver library (through
206208 // Driver::CC1Main), we need to clean up the options usage count. The options
207209 // are currently global, and they might have been used previously by the
......@@ -209,7 +211,8 @@ static int ExecuteCC1Tool(SmallVectorImpl<const char *> &ArgV,
209211 llvm::cl::ResetAllOptionOccurrences();
210212
211213 llvm::BumpPtrAllocator A;
212 llvm::cl::ExpansionContext ECtx(A, llvm::cl::TokenizeGNUCommandLine);
214 llvm::cl::ExpansionContext ECtx(A, llvm::cl::TokenizeGNUCommandLine,
215 VFS.get());
213216 if (llvm::Error Err = ECtx.expandResponseFiles(ArgV)) {
214217 llvm::errs() << toString(std::move(Err)) << '\n';
215218 return 1;
......@@ -249,14 +252,22 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
249252 bool ClangCLMode =
250253 IsClangCL(getDriverMode(ProgName, llvm::ArrayRef(Args).slice(1)));
251254
252 if (llvm::Error Err = expandResponseFiles(Args, ClangCLMode, A)) {
255 auto VFS = llvm::vfs::getRealFileSystem();
256
257 if (llvm::Error Err = expandResponseFiles(Args, ClangCLMode, A, VFS.get())) {
253258 llvm::errs() << toString(std::move(Err)) << '\n';
254259 return 1;
255260 }
256261
257262 // Handle -cc1 integrated tools.
258 if (Args.size() >= 2 && StringRef(Args[1]).starts_with("-cc1"))
259 return ExecuteCC1Tool(Args, ToolContext);
263 if (Args.size() >= 2 && StringRef(Args[1]).starts_with("-cc1")) {
264 // Note that this only enables the sandbox for direct -cc1 invocations and
265 // out-of-process -cc1 invocations launched by the driver. For in-process
266 // -cc1 invocations launched by the driver, the sandbox is enabled in
267 // CC1Command::Execute() for better crash recovery.
268 auto EnableSandbox = llvm::sys::sandbox::scopedEnable();
269 return ExecuteCC1Tool(Args, ToolContext, VFS);
270 }
260271
261272 // Handle options that need handling before the real command line parsing in
262273 // Driver::BuildCompilation()
......@@ -326,9 +337,7 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
326337 new TextDiagnosticPrinter(llvm::errs(), *DiagOpts);
327338 FixupDiagPrefixExeName(DiagClient, ProgName);
328339
329 IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
330
331 DiagnosticsEngine Diags(DiagID, *DiagOpts, DiagClient);
340 DiagnosticsEngine Diags(DiagnosticIDs::create(), *DiagOpts, DiagClient);
332341
333342 if (!DiagOpts->DiagnosticSerializationFile.empty()) {
334343 auto SerializedConsumer =
......@@ -338,7 +347,6 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
338347 Diags.takeClient(), std::move(SerializedConsumer)));
339348 }
340349
341 auto VFS = llvm::vfs::getRealFileSystem();
342350 ProcessWarningOptions(Diags, *DiagOpts, *VFS, /*ReportDiags=*/false);
343351
344352 Driver TheDriver(Path, llvm::sys::getDefaultTargetTriple(), Diags,
......@@ -358,10 +366,10 @@ static int clang_main(int Argc, char **Argv, const llvm::ToolContext &ToolContex
358366 if (!SetBackdoorDriverOutputsFromEnvVars(TheDriver))
359367 return 1;
360368
361 auto ExecuteCC1WithContext =
362 [&ToolContext](SmallVectorImpl<const char *> &ArgV) {
363 return ExecuteCC1Tool(ArgV, ToolContext);
364 };
369 auto ExecuteCC1WithContext = [&ToolContext,
370 &VFS](SmallVectorImpl<const char *> &ArgV) {
371 return ExecuteCC1Tool(ArgV, ToolContext, VFS);
372 };
365373 if (!UseNewCC1Process) {
366374 TheDriver.CC1Main = ExecuteCC1WithContext;
367375 // Ensure the CC1Command actually catches cc1 crashes
src/zig_llvm-ar.cpp+1
......@@ -12,6 +12,7 @@
1212//===----------------------------------------------------------------------===//
1313
1414#include "llvm/ADT/StringExtras.h"
15#include "llvm/ADT/StringMap.h"
1516#include "llvm/ADT/StringSwitch.h"
1617#include "llvm/BinaryFormat/Magic.h"
1718#include "llvm/IR/LLVMContext.h"
src/zig_llvm.cpp+1-1
......@@ -439,7 +439,7 @@ ZIG_EXTERN_C bool ZigLLVMTargetMachineEmitToFile(LLVMTargetMachineRef targ_machi
439439
440440void ZigLLVMSetOptBisectLimit(LLVMContextRef context_ref, int limit) {
441441 static OptBisect opt_bisect;
442 opt_bisect.setLimit(limit);
442 opt_bisect.setIntervals({0, limit});
443443 unwrap(context_ref)->setOptPassGate(opt_bisect);
444444}
445445