diff --git a/toolchain/driver/clang_runner.cpp b/toolchain/driver/clang_runner.cpp index a4f05bbc65c1..83347d581639 100644 --- a/toolchain/driver/clang_runner.cpp +++ b/toolchain/driver/clang_runner.cpp @@ -146,13 +146,14 @@ auto ClangRunner::Run(llvm::ArrayRef args) -> bool { // Note the subprocessing will effectively call `clang -cc1`, which turns into // `carbon-busybox clang -cc1`, which results in an equivalent `clang_main` // call. - driver.CC1Main = [](llvm::SmallVectorImpl& cc1_args) -> int { + auto cc1_main = [](llvm::SmallVectorImpl& cc1_args) -> int { // cc1_args[0] will be the `clang_path` so we don't need the prepend arg. llvm::ToolContext tool_context = { .Path = cc1_args[0], .PrependArg = "clang", .NeedsPrependArg = false}; return clang_main(cc1_args.size(), const_cast(cc1_args.data()), tool_context); }; + driver.CC1Main = cc1_main; std::unique_ptr compilation( driver.BuildCompilation(cstr_args));