From 344a3780b2e33f6ca763666c380202b18aab72a3 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 29 Jul 2021 22:15:26 +0200 Subject: Vendor import of llvm-project main 88e66fa60ae5, the last commit before the upstream release/13.x branch was created. --- clang/lib/Frontend/CreateInvocationFromCommandLine.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'clang/lib/Frontend/CreateInvocationFromCommandLine.cpp') diff --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp index ff0aa6faf33f..2e23ebfdf160 100644 --- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -10,15 +10,17 @@ // //===----------------------------------------------------------------------===// -#include "clang/Frontend/Utils.h" #include "clang/Basic/DiagnosticOptions.h" +#include "clang/Driver/Action.h" #include "clang/Driver/Compilation.h" #include "clang/Driver/Driver.h" -#include "clang/Driver/Action.h" #include "clang/Driver/Options.h" #include "clang/Driver/Tool.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/FrontendDiagnostic.h" +#include "clang/Frontend/Utils.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Option/ArgList.h" #include "llvm/Support/Host.h" using namespace clang; @@ -37,7 +39,10 @@ std::unique_ptr clang::createInvocationFromCommandLine( SmallVector Args(ArgList.begin(), ArgList.end()); // FIXME: Find a cleaner way to force the driver into restricted modes. - Args.push_back("-fsyntax-only"); + Args.insert( + llvm::find_if( + Args, [](const char *Elem) { return llvm::StringRef(Elem) == "--"; }), + "-fsyntax-only"); // FIXME: We shouldn't have to pass in the path info. driver::Driver TheDriver(Args[0], llvm::sys::getDefaultTargetTriple(), *Diags, -- cgit v1.2.3