Skip to content

Commit 513d108

Browse files
committed
[NFC] Drop SourceFileKind from getMainSourceFile
The parameter here was derived from the CompilerInvocation-level parsing bits, which doesn't make any sense. This state is going away soon, so drop the parameter.
1 parent 99147a8 commit 513d108

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

include/swift/AST/Module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ class ModuleDecl : public DeclContext, public TypeDecl {
458458

459459
/// Convenience accessor for clients that know what kind of file they're
460460
/// dealing with.
461-
SourceFile &getMainSourceFile(SourceFileKind expectedKind) const;
461+
SourceFile &getMainSourceFile() const;
462462

463463
/// Convenience accessor for clients that know what kind of file they're
464464
/// dealing with.

include/swift/AST/SourceFile.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,10 +624,8 @@ inline SourceFile::ParsingOptions operator|(SourceFile::ParsingFlags lhs,
624624
return SourceFile::ParsingOptions(lhs) | rhs;
625625
}
626626

627-
inline SourceFile &
628-
ModuleDecl::getMainSourceFile(SourceFileKind expectedKind) const {
627+
inline SourceFile &ModuleDecl::getMainSourceFile() const {
629628
assert(!Files.empty() && "No files added yet");
630-
assert(cast<SourceFile>(Files.front())->Kind == expectedKind);
631629
return *cast<SourceFile>(Files.front());
632630
}
633631

tools/swift-ide-test/ModuleAPIDiff.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,8 +931,7 @@ int swift::doGenerateModuleAPIDescription(StringRef MainExecutablePath,
931931
PrintOptions Options = PrintOptions::printEverything();
932932

933933
ModuleDecl *M = CI.getMainModule();
934-
M->getMainSourceFile(Invocation.getSourceFileKind()).print(llvm::outs(),
935-
Options);
934+
M->getMainSourceFile().print(llvm::outs(), Options);
936935

937936
auto SMAModel = createSMAModel(M);
938937
llvm::yaml::Output YOut(llvm::outs());

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,8 +2158,7 @@ static int doPrintAST(const CompilerInvocation &InitInvok,
21582158

21592159
if (MangledNameToFind.empty()) {
21602160
ModuleDecl *M = CI.getMainModule();
2161-
M->getMainSourceFile(Invocation.getSourceFileKind()).print(llvm::outs(),
2162-
Options);
2161+
M->getMainSourceFile().print(llvm::outs(), Options);
21632162
return EXIT_SUCCESS;
21642163
}
21652164

0 commit comments

Comments
 (0)