diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Driver/Driver.cpp | 12 | ||||
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 6 |
2 files changed, 7 insertions, 11 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index ef647d8c06..ef777149d7 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -30,6 +30,7 @@ #include "clang/Basic/Version.h" #include "llvm/Config/config.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringSet.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/Support/PrettyStackTrace.h" @@ -100,11 +101,10 @@ Driver::~Driver() { delete Host; } -InputArgList *Driver::ParseArgStrings(const char **ArgBegin, - const char **ArgEnd) { +InputArgList *Driver::ParseArgStrings(llvm::ArrayRef<const char *> ArgList) { llvm::PrettyStackTraceString CrashInfo("Command line argument parsing"); unsigned MissingArgIndex, MissingArgCount; - InputArgList *Args = getOpts().ParseArgs(ArgBegin, ArgEnd, + InputArgList *Args = getOpts().ParseArgs(ArgList.begin(), ArgList.end(), MissingArgIndex, MissingArgCount); // Check for missing argument error. @@ -206,7 +206,7 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const { return DAL; } -Compilation *Driver::BuildCompilation(int argc, const char **argv) { +Compilation *Driver::BuildCompilation(llvm::ArrayRef<const char *> ArgList) { llvm::PrettyStackTraceString CrashInfo("Compilation construction"); // FIXME: Handle environment options which effect driver behavior, somewhere @@ -218,9 +218,7 @@ Compilation *Driver::BuildCompilation(int argc, const char **argv) { // FIXME: This stuff needs to go into the Compilation, not the driver. bool CCCPrintOptions = false, CCCPrintActions = false; - const char **Start = argv + 1, **End = argv + argc; - - InputArgList *Args = ParseArgStrings(Start, End); + InputArgList *Args = ParseArgStrings(ArgList.slice(1)); // -no-canonical-prefixes is used very early in main. Args->ClaimAllArgs(options::OPT_no_canonical_prefixes); diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 2713aa6c6f..21a45b2962 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -36,6 +36,7 @@ #include "clang/Basic/TargetOptions.h" #include "clang/Basic/TargetInfo.h" #include "clang/Basic/Diagnostic.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSet.h" #include "llvm/Support/Atomic.h" @@ -1661,10 +1662,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, // Don't check that inputs exist, they have been remapped. TheDriver.setCheckInputsExist(false); - llvm::OwningPtr<driver::Compilation> C( - TheDriver.BuildCompilation( - Args->size(), - Args->size() ? &(*Args)[0] : 0 )); // std::vector::data() not portable + llvm::OwningPtr<driver::Compilation> C(TheDriver.BuildCompilation(*Args)); // Just print the cc1 options if -### was present. if (C->getArgs().hasArg(driver::options::OPT__HASH_HASH_HASH)) { |