diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -4611,17 +4611,10 @@ } std::vector CompilerInvocation::getCC1CommandLine() const { - // Set up string allocator. - llvm::BumpPtrAllocator Alloc; - llvm::StringSaver Strings(Alloc); - auto SA = [&Strings](const Twine &Arg) { return Strings.save(Arg).data(); }; - - // Synthesize full command line from the CompilerInvocation, including "-cc1". - SmallVector Args{"-cc1"}; - generateCC1CommandLine(Args, SA); - - // Convert arguments to the return type. - return std::vector{Args.begin(), Args.end()}; + std::vector Args{"-cc1"}; + generateCC1CommandLine( + [&Args](const Twine &Arg) { Args.push_back(Arg.str()); }); + return Args; } void CompilerInvocation::resetNonModularOptions() {