[interface-gen] Support passing Swift compiler arguments for header file interface generation

Resolves rdar://problem/33249361.
This commit is contained in:
Nathan Hawes
2017-07-13 14:21:06 -07:00
parent c1dc8b30c5
commit 3de0ea7e1b
10 changed files with 29 additions and 3 deletions

View File

@@ -801,6 +801,7 @@ void SwiftLangSupport::editorOpenHeaderInterface(EditorConsumer &Consumer,
StringRef Name,
StringRef HeaderName,
ArrayRef<const char *> Args,
bool AreSwiftArgs,
bool SynthesizedExtensions,
Optional<unsigned> swiftVersion) {
CompilerInstance CI;
@@ -810,13 +811,15 @@ void SwiftLangSupport::editorOpenHeaderInterface(EditorConsumer &Consumer,
CompilerInvocation Invocation;
std::string Error;
if (getASTManager().initCompilerInvocation(Invocation, llvm::None, CI.getDiags(),
ArrayRef<const char *> SwiftArgs = AreSwiftArgs ? Args : llvm::None;
if (getASTManager().initCompilerInvocation(Invocation, SwiftArgs, CI.getDiags(),
StringRef(), Error)) {
Consumer.handleRequestError(Error.c_str());
return;
}
if (initInvocationByClangArguments(Args, Invocation, Error)) {
if (!AreSwiftArgs && initInvocationByClangArguments(Args, Invocation, Error)) {
Consumer.handleRequestError(Error.c_str());
return;
}