-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[SE-0274] Update concise #file implementation in response to first round of review #29412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f34fa7f
8e5ca8a
54f5967
d590823
85599f7
62ab3df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,6 +321,12 @@ class SourceFile final : public FileUnit { | |
/// forwarded on to IRGen. | ||
ASTStage_t ASTStage = Unprocessed; | ||
|
||
/// Virtual filenames declared by #sourceLocation(file:) directives in this | ||
/// file. | ||
llvm::SmallVector<Located<StringRef>, 0> VirtualFilenames; | ||
|
||
llvm::StringMap<SourceFilePathInfo> getInfoForUsedFilePaths() const; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a brief doc comment explaining that this returns info for the physical and virtual file paths introduced by this file? |
||
|
||
SourceFile(ModuleDecl &M, SourceFileKind K, Optional<unsigned> bufferID, | ||
ImplicitModuleImportKind ModImpKind, bool KeepParsedTokens = false, | ||
bool KeepSyntaxTree = false, ParsingOptions parsingOpts = {}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,6 +131,9 @@ class LLVM_LIBRARY_VISIBILITY SILGenModule : public ASTVisitor<SILGenModule> { | |
|
||
ASTContext &getASTContext() { return M.getASTContext(); } | ||
|
||
llvm::StringMap<std::pair<std::string, /*isWinner=*/bool>> | ||
MagicFileStringsByFilePath; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: I believe |
||
|
||
static DeclName getMagicFunctionName(SILDeclRef ref); | ||
static DeclName getMagicFunctionName(DeclContext *dc); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// This file matches test/SILGen/magic_identifier_file_conflicting.swift. | ||
// It should be compiled with -verify. | ||
|
||
// We should diagnose cross-file conflicts. | ||
// expected-warning@+2 {{'#sourceLocation' directive produces '#file' string of 'Foo/other_file_c.swift', which conflicts with '#file' strings produced by other paths in the module}} | ||
// expected-note@+1 {{change file in '#sourceLocation' to 'first/other_file_c.swift'}} {{23-50="first/other_file_c.swift"}} | ||
#sourceLocation(file: "second/other_file_c.swift", line: 1) | ||
#sourceLocation() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth renaming this to
VirtualFilePaths
to clarify that it deals with the whole path passed to#sourceLocation
, and cannot be used in general to subscript e.ggetInfoForUsedFileNames
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, unrelated to this PR, but I think we should also consider renaming
SourceFile::getFilename
.