Skip to content

Commit 057ca60

Browse files
committed
[Frontend] Inline recordPrimarySourceFile
And remove an unnecessary call to `recordPrimaryInputBuffer`.
1 parent a6b3236 commit 057ca60

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

include/swift/Frontend/Frontend.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,6 @@ class CompilerInstance {
466466
/// If \p BufID is already in the set, do nothing.
467467
void recordPrimaryInputBuffer(unsigned BufID);
468468

469-
/// Record in PrimarySourceFiles the fact that \p SF is a primary, and
470-
/// call recordPrimaryInputBuffer on \p SF's buffer (if it exists).
471-
void recordPrimarySourceFile(SourceFile *SF);
472-
473469
bool isWholeModuleCompilation() { return PrimaryBufferIDs.empty(); }
474470

475471
public:

lib/Frontend/Frontend.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,6 @@ void CompilerInstance::recordPrimaryInputBuffer(unsigned BufID) {
198198
PrimaryBufferIDs.insert(BufID);
199199
}
200200

201-
void CompilerInstance::recordPrimarySourceFile(SourceFile *SF) {
202-
assert(MainModule && "main module not created yet");
203-
PrimarySourceFiles.push_back(SF);
204-
SF->enableInterfaceHash();
205-
SF->createReferencedNameTracker();
206-
if (SF->getBufferID().hasValue())
207-
recordPrimaryInputBuffer(SF->getBufferID().getValue());
208-
}
209-
210201
bool CompilerInstance::setUpASTContextIfNeeded() {
211202
if (Invocation.getFrontendOptions().RequestedAction ==
212203
FrontendOptions::ActionType::CompileModuleFromInterface) {
@@ -966,8 +957,11 @@ SourceFile *CompilerInstance::createSourceFileForMainModule(
966957
Invocation.getLangOptions().BuildSyntaxTree, opts);
967958
MainModule->addFile(*inputFile);
968959

969-
if (isPrimary)
970-
recordPrimarySourceFile(inputFile);
960+
if (isPrimary) {
961+
PrimarySourceFiles.push_back(inputFile);
962+
inputFile->enableInterfaceHash();
963+
inputFile->createReferencedNameTracker();
964+
}
971965

972966
if (bufferID == SourceMgr.getCodeCompletionBufferID()) {
973967
assert(!CodeCompletionFile && "Multiple code completion files?");

0 commit comments

Comments
 (0)