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

@@ -459,6 +459,9 @@ bool SwiftASTManager::initCompilerInvocation(CompilerInvocation &Invocation,
// SwiftONoneSupport module.
FrontendOpts.RequestedAction = FrontendOptions::ActionType::Typecheck;
// We don't care about LLVMArgs
FrontendOpts.LLVMArgs.clear();
return false;
}