mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SourceKit] Use "-" as fallback complier argument
Since compiler arguments are processed by Driver, arbitrary filename passed as 'request.name' (e.g. "", "-1", etc.) may cause problems. Using '-' guarantees successful initialization of 'CompilerInvocation'. rdar://problem/40646921 rdar://problem/40955808
This commit is contained in:
@@ -1749,8 +1749,11 @@ void SwiftEditorDocument::parse(ImmutableTextSnapshotRef Snapshot,
|
||||
Impl.SemanticInfo->getInvocation()->applyTo(CompInv);
|
||||
Impl.SemanticInfo->getInvocation()->raw(Args, PrimaryFile);
|
||||
} else {
|
||||
// Use stdin as a .swift input to satisfy the driver. Note that we don't
|
||||
// use Impl.FilePath here because it may be invalid filename for driver
|
||||
// like "" or "-foobar".
|
||||
SmallVector<const char *, 1> Args;
|
||||
Args.push_back(Impl.FilePath.c_str()); // Input
|
||||
Args.push_back("-");
|
||||
std::string Error;
|
||||
// Ignore possible error(s)
|
||||
Lang.getASTManager().
|
||||
|
||||
Reference in New Issue
Block a user