mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Only synthesize a private discriminator when needed
This commit is contained in:
@@ -3852,8 +3852,8 @@ ASTScope &SourceFile::getScope() {
|
||||
return *Scope.get();
|
||||
}
|
||||
|
||||
Identifier SourceFile::getPrivateDiscriminator() const {
|
||||
if (!PrivateDiscriminator.empty())
|
||||
Identifier SourceFile::getPrivateDiscriminator(bool createIfMissing) const {
|
||||
if (!PrivateDiscriminator.empty() || !createIfMissing)
|
||||
return PrivateDiscriminator;
|
||||
|
||||
StringRef name = getFilename();
|
||||
@@ -3894,7 +3894,7 @@ Identifier
|
||||
SourceFile::getDiscriminatorForPrivateDecl(const Decl *D) const {
|
||||
assert(D->getDeclContext()->getModuleScopeContext() == this ||
|
||||
D->getDeclContext()->getModuleScopeContext() == getSynthesizedFile());
|
||||
return getPrivateDiscriminator();
|
||||
return getPrivateDiscriminator(/*createIfMissing=*/true);
|
||||
}
|
||||
|
||||
SynthesizedFileUnit *FileUnit::getSynthesizedFile() const {
|
||||
|
||||
Reference in New Issue
Block a user