Clear any LLVMArgs when initializing the CompilerInvocation for SourceKit's ASTManager

SourceKit doesn't use them and if any unrecognised LLVM options are
passed to llvm::cl::ParseCommandLineOptions() it calls exit(), bringing
down SourceKit.

Also use fprintf instead of llvm::errs() in Logging.cpp as it uses a
global C++ object that had already been destructed when logging the
above failure.

Resolves rdar://problem/38314383
This commit is contained in:
Nathan Hawes
2018-03-09 18:30:00 -08:00
parent 4058407f8f
commit 17a6ef5c6e
3 changed files with 10 additions and 1 deletions

View File

@@ -63,7 +63,7 @@ Logger::~Logger() {
OS << llvm::format("%7.4f] ", TR.getWallTime() - sBeginTR.getWallTime());
OS << Msg.str();
llvm::errs() << LoggerName << ": " << LogMsg.str() << '\n';
fprintf(stderr, "%s: %s", LoggerName.c_str(), LogMsg.c_str());
#if __APPLE__
// Use the Apple System Log facility.