aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2021-07-22 12:05:27 +0200
committerKadir Cetinkaya <kadircet@google.com>2021-07-23 17:15:05 +0200
commitd2a6ec8eae75b60081e081eeb37022839f4f2d04 (patch)
tree7a9e4868023a749deceb98df194d0c0432f17096 /clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
parentf86570cd52419562b4c528c6e8a05ced00450c16 (diff)
downloadllvm-d2a6ec8eae75b60081e081eeb37022839f4f2d04.zip
llvm-d2a6ec8eae75b60081e081eeb37022839f4f2d04.tar.gz
llvm-d2a6ec8eae75b60081e081eeb37022839f4f2d04.tar.bz2
[clangd] Use CommandMangler in TestTU
This makes testing setup look closer to production. Differential Revision: https://reviews.llvm.org/D106535
Diffstat (limited to 'clang/lib/Frontend/CreateInvocationFromCommandLine.cpp')
-rw-r--r--clang/lib/Frontend/CreateInvocationFromCommandLine.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp
index ff0aa6f..2e23ebf 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<CompilerInvocation> clang::createInvocationFromCommandLine(
SmallVector<const char *, 16> 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,