Skip to content

Commit b65a9c6

Browse files
committed
[NFC] Doc and style fixes for #filePath implementation
This addresses some late-breaking review comments left by @hamishknight on swiftlang#29412.
1 parent 000572d commit b65a9c6

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

include/swift/AST/SourceFile.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,13 @@ class SourceFile final : public FileUnit {
321321
/// forwarded on to IRGen.
322322
ASTStage_t ASTStage = Unprocessed;
323323

324-
/// Virtual filenames declared by #sourceLocation(file:) directives in this
325-
/// file.
326-
llvm::SmallVector<Located<StringRef>, 0> VirtualFilenames;
324+
/// Virtual file paths declared by \c #sourceLocation(file:) declarations in
325+
/// this source file.
326+
llvm::SmallVector<Located<StringRef>, 0> VirtualFilePaths;
327327

328+
/// Returns information about the file paths used for diagnostics and magic
329+
/// identifiers in this source file, including virtual filenames introduced by
330+
/// \c #sourceLocation(file:) declarations.
328331
llvm::StringMap<SourceFilePathInfo> getInfoForUsedFilePaths() const;
329332

330333
SourceFile(ModuleDecl &M, SourceFileKind K, Optional<unsigned> bufferID,

lib/AST/Module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1964,7 +1964,7 @@ SourceFile::getInfoForUsedFilePaths() const {
19641964
getASTContext().SourceMgr.getLocForBufferStart(BufferID);
19651965
}
19661966

1967-
for (auto &vpath : VirtualFilenames) {
1967+
for (auto &vpath : VirtualFilePaths) {
19681968
result[vpath.Item].virtualFileLocs.insert(vpath.Loc);
19691969
}
19701970

lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4827,7 +4827,7 @@ ParserStatus Parser::parseLineDirective(bool isLine) {
48274827
if (!Filename.hasValue())
48284828
return makeParserError();
48294829
SourceLoc filenameLoc = consumeToken(tok::string_literal);
4830-
SF.VirtualFilenames.emplace_back(*Filename, filenameLoc);
4830+
SF.VirtualFilePaths.emplace_back(*Filename, filenameLoc);
48314831

48324832
if (parseToken(tok::comma, diag::sourceLocation_expected, ",") ||
48334833
parseSpecificIdentifier("line", diag::sourceLocation_expected,

lib/SILGen/SILGen.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class LLVM_LIBRARY_VISIBILITY SILGenModule : public ASTVisitor<SILGenModule> {
132132
ASTContext &getASTContext() { return M.getASTContext(); }
133133

134134
llvm::StringMap<std::pair<std::string, /*isWinner=*/bool>>
135-
MagicFileStringsByFilePath;
135+
MagicFileStringsByFilePath;
136136

137137
static DeclName getMagicFunctionName(SILDeclRef ref);
138138
static DeclName getMagicFunctionName(DeclContext *dc);

0 commit comments

Comments
 (0)