From c02670ed50f009eeb24ad7f0fe00cbf887e008d0 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 18 Nov 2015 16:14:27 +0000 Subject: [libclang] Add entry points that take a full command line including argv[0]. This provides both a more uniform interface and makes libclang behave like clang tooling wrt relative paths against argv[0]. This is necessary for finding paths to a c++ standard library relative to a clang binary given in a compilation database. It can also be used to find paths relative to libclang.so if the full path to it is passed in. Differential Revision: http://reviews.llvm.org/D14695 llvm-svn: 253466 --- clang/lib/Frontend/CreateInvocationFromCommandLine.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'clang/lib/Frontend/CreateInvocationFromCommandLine.cpp') diff --git a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp index 2afd23f..3019164 100644 --- a/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -39,15 +39,13 @@ clang::createInvocationFromCommandLine(ArrayRef ArgList, Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions); } - SmallVector Args; - Args.push_back(""); // FIXME: Remove dummy argument. - Args.insert(Args.end(), ArgList.begin(), ArgList.end()); + SmallVector Args(ArgList.begin(), ArgList.end()); // FIXME: Find a cleaner way to force the driver into restricted modes. Args.push_back("-fsyntax-only"); // FIXME: We shouldn't have to pass in the path info. - driver::Driver TheDriver("clang", llvm::sys::getDefaultTargetTriple(), + driver::Driver TheDriver(Args[0], llvm::sys::getDefaultTargetTriple(), *Diags); // Don't check that inputs exist, they may have been remapped. -- cgit v1.1