diff options
author | dim <dim@FreeBSD.org> | 2015-05-27 20:44:45 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-05-27 20:44:45 +0000 |
commit | fae9061769fe2114f1a7875c781cc369ff303a11 (patch) | |
tree | 50a603f7e1932cd42f58e26687ce907933014db0 /contrib/llvm/tools/clang/lib/Driver/Job.cpp | |
parent | 5ef8fd3549d38e883a31881636be3dc2a275de20 (diff) | |
parent | 3191b2b32a96e1a6ee833fcca73e5c8e0c67ba65 (diff) | |
download | FreeBSD-src-fae9061769fe2114f1a7875c781cc369ff303a11.zip FreeBSD-src-fae9061769fe2114f1a7875c781cc369ff303a11.tar.gz |
Merge clang trunk r238337 from ^/vendor/clang/dist, resolve conflicts,
and preserve our customizations, where necessary.
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Driver/Job.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Driver/Job.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/contrib/llvm/tools/clang/lib/Driver/Job.cpp b/contrib/llvm/tools/clang/lib/Driver/Job.cpp index c5b3f5a..6d18a41 100644 --- a/contrib/llvm/tools/clang/lib/Driver/Job.cpp +++ b/contrib/llvm/tools/clang/lib/Driver/Job.cpp @@ -34,7 +34,7 @@ Command::Command(const Action &_Source, const Tool &_Creator, Executable(_Executable), Arguments(_Arguments), ResponseFile(nullptr) {} -static int skipArgs(const char *Flag) { +static int skipArgs(const char *Flag, bool HaveCrashVFS) { // These flags are all of the form -Flag <Arg> and are treated as two // arguments. Therefore, we need to skip the flag and the next argument. bool Res = llvm::StringSwitch<bool>(Flag) @@ -43,9 +43,11 @@ static int skipArgs(const char *Flag) { .Cases("-fdebug-compilation-dir", "-idirafter", true) .Cases("-include", "-include-pch", "-internal-isystem", true) .Cases("-internal-externc-isystem", "-iprefix", "-iwithprefix", true) - .Cases("-iwithprefixbefore", "-isysroot", "-isystem", "-iquote", true) + .Cases("-iwithprefixbefore", "-isystem", "-iquote", true) .Cases("-resource-dir", "-serialize-diagnostic-file", true) .Cases("-dwarf-debug-flags", "-ivfsoverlay", true) + // Some include flags shouldn't be skipped if we have a crash VFS + .Case("-isysroot", !HaveCrashVFS) .Default(false); // Match found. @@ -164,11 +166,12 @@ void Command::Print(raw_ostream &OS, const char *Terminator, bool Quote, if (StringRef(Args[I]).equals("-main-file-name")) MainFilename = Args[I + 1]; + bool HaveCrashVFS = CrashInfo && !CrashInfo->VFSPath.empty(); for (size_t i = 0, e = Args.size(); i < e; ++i) { const char *const Arg = Args[i]; if (CrashInfo) { - if (int Skip = skipArgs(Arg)) { + if (int Skip = skipArgs(Arg, HaveCrashVFS)) { i += Skip - 1; continue; } else if (llvm::sys::path::filename(Arg) == MainFilename && @@ -185,7 +188,7 @@ void Command::Print(raw_ostream &OS, const char *Terminator, bool Quote, PrintArg(OS, Arg, Quote); } - if (CrashInfo && !CrashInfo->VFSPath.empty()) { + if (CrashInfo && HaveCrashVFS) { OS << ' '; PrintArg(OS, "-ivfsoverlay", Quote); OS << ' '; @@ -217,8 +220,7 @@ int Command::Execute(const StringRef **Redirects, std::string *ErrMsg, if (ResponseFile == nullptr) { Argv.push_back(Executable); - for (size_t i = 0, e = Arguments.size(); i != e; ++i) - Argv.push_back(Arguments[i]); + Argv.append(Arguments.begin(), Arguments.end()); Argv.push_back(nullptr); return llvm::sys::ExecuteAndWait(Executable, Argv.data(), /*env*/ nullptr, |