// spelling of each argument; re-rendering is lossy for aliased flags.
// E.g. in CL mode, /W4 maps to -Wall.
auto OptTable = clang::driver::createDriverOptTable();
- Cmd.CommandLine.emplace_back(OldArgs.front());
+ if (!OldArgs.empty())
+ Cmd.CommandLine.emplace_back(OldArgs.front());
for (unsigned Pos = 1; Pos < OldArgs.size();) {
using namespace driver::options;
}
// Otherwise just check the clang executable file name.
- return llvm::sys::path::stem(CmdLine.front()).endswith_lower("cl");
+ return !CmdLine.empty() &&
+ llvm::sys::path::stem(CmdLine.front()).endswith_lower("cl");
}
// Map the language from the --std flag to that of the -x flag.
if (OverlayFileSystem->setCurrentWorkingDirectory(
CompileCommand.Directory))
llvm::report_fatal_error("Cannot chdir into \"" +
- Twine(CompileCommand.Directory) + "\n!");
+ Twine(CompileCommand.Directory) + "\"!");
// Now fill the in-memory VFS with the relative file mappings so it will
// have the correct relative paths. We never remove mappings but that