mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SourceKit] Allow module references to be indexed (#19243)
Module references get indexed as a 'module' symbol; they get USRs similar to how clang would assign a USR for a module reference. JIRA: https://bugs.swift.org/browse/SR-8677
This commit is contained in:
committed by
Argyrios Kyrtzidis
parent
bb36ddfc17
commit
bf84b297f8
@@ -365,6 +365,10 @@ ModuleDecl::ModuleDecl(Identifier name, ASTContext &ctx)
|
||||
setAccess(AccessLevel::Public);
|
||||
}
|
||||
|
||||
bool ModuleDecl::isClangModule() const {
|
||||
return findUnderlyingClangModule() != nullptr;
|
||||
}
|
||||
|
||||
void ModuleDecl::addFile(FileUnit &newFile) {
|
||||
// Require Main and REPL files to be the first file added.
|
||||
assert(Files.empty() ||
|
||||
@@ -1636,6 +1640,13 @@ const ModuleDecl* ModuleEntity::getAsSwiftModule() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const clang::Module* ModuleEntity::getAsClangModule() const {
|
||||
assert(!Mod.isNull());
|
||||
if (Mod.is<const ModuleDecl*>())
|
||||
return nullptr;
|
||||
return getClangModule(Mod);
|
||||
}
|
||||
|
||||
// See swift/Basic/Statistic.h for declaration: this enables tracing SourceFiles, is
|
||||
// defined here to avoid too much layering violation / circular linkage
|
||||
// dependency.
|
||||
|
||||
Reference in New Issue
Block a user