File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -496,7 +496,7 @@ class SourceFile final : public FileUnit {
496
496
collectLinkLibraries (ModuleDecl::LinkLibraryCallback callback) const override ;
497
497
498
498
Identifier getDiscriminatorForPrivateDecl (const Decl *D) const override ;
499
- Identifier getPrivateDiscriminator () const ;
499
+ Identifier getPrivateDiscriminator (bool createIfMissing = false ) const ;
500
500
Optional<ExternalSourceLocs::RawLocs>
501
501
getExternalRawLocsForDecl (const Decl *D) const override ;
502
502
Original file line number Diff line number Diff line change @@ -4009,7 +4009,8 @@ static StringRef getPrivateDiscriminatorIfNecessary(
4009
4009
if (!sf)
4010
4010
return StringRef ();
4011
4011
4012
- Identifier discriminator = sf->getPrivateDiscriminator ();
4012
+ Identifier discriminator =
4013
+ sf->getPrivateDiscriminator (/* createIfMissing=*/ true );
4013
4014
assert (!discriminator.empty ());
4014
4015
assert (!isNonAscii (discriminator.str ()) &&
4015
4016
" discriminator contains non-ASCII characters" );
Original file line number Diff line number Diff line change @@ -3852,8 +3852,8 @@ ASTScope &SourceFile::getScope() {
3852
3852
return *Scope.get ();
3853
3853
}
3854
3854
3855
- Identifier SourceFile::getPrivateDiscriminator () const {
3856
- if (!PrivateDiscriminator.empty ())
3855
+ Identifier SourceFile::getPrivateDiscriminator (bool createIfMissing ) const {
3856
+ if (!PrivateDiscriminator.empty () || !createIfMissing )
3857
3857
return PrivateDiscriminator;
3858
3858
3859
3859
StringRef name = getFilename ();
@@ -3894,7 +3894,7 @@ Identifier
3894
3894
SourceFile::getDiscriminatorForPrivateDecl (const Decl *D) const {
3895
3895
assert (D->getDeclContext ()->getModuleScopeContext () == this ||
3896
3896
D->getDeclContext ()->getModuleScopeContext () == getSynthesizedFile ());
3897
- return getPrivateDiscriminator ();
3897
+ return getPrivateDiscriminator (/* createIfMissing= */ true );
3898
3898
}
3899
3899
3900
3900
SynthesizedFileUnit *FileUnit::getSynthesizedFile () const {
You can’t perform that action at this time.
0 commit comments