Skip to content

Commit eb8e984

Browse files
authored
[Macros] Private discriminators for outermost-private MacroExpansionDecl (#64813)
Add a private discriminator to the mangling of an outermost-private `MacroExpansionDecl` so that declaration macros in different files won't have colliding macro expansion buffer names. rdar://107462515
1 parent 77bd312 commit eb8e984

24 files changed

+85
-50
lines changed

docs/ABI/Mangling.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -394,13 +394,15 @@ Entities
394394
RELATED-DISCRIMINATOR ::= [a-j]
395395
RELATED-DISCRIMINATOR ::= [A-J]
396396

397-
macro-discriminator-list ::= macro-discriminator-list? 'fM' macro-expansion-operator INDEX
398-
399-
macro-expansion-operator ::= identifier 'a' // accessor attached macro
400-
macro-expansion-operator ::= identifier 'A' // member-attribute attached macro
401-
macro-expansion-operator ::= identifier 'f' // freestanding macro
402-
macro-expansion-operator ::= identifier 'm' // member attached macro
403-
macro-expansion-operator ::= identifier 'u' // uniquely-named entity
397+
macro-discriminator-list ::= macro-discriminator-list? file-discriminator? macro-expansion-operator INDEX
398+
399+
macro-expansion-operator ::= identifier 'fMa' // attached accessor macro
400+
macro-expansion-operator ::= identifier 'fMA' // attached member-attribute macro
401+
macro-expansion-operator ::= identifier 'fMf' // freestanding macro
402+
macro-expansion-operator ::= identifier 'fMm' // attached member macro
403+
macro-expansion-operator ::= identifier 'fMp' // attached peer macro
404+
macro-expansion-operator ::= identifier 'fMc' // attached conformance macro
405+
macro-expansion-operator ::= identifier 'fMu' // uniquely-named entity
404406

405407
file-discriminator ::= identifier 'Ll' // anonymous file-discriminated declaration
406408

include/swift/AST/Decl.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,10 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
11561156

11571157
bool isAvailableAsSPI() const;
11581158

1159+
/// Determine whether this Decl has either Private or FilePrivate access,
1160+
/// and its DeclContext does not.
1161+
bool isOutermostPrivateOrFilePrivateScope() const;
1162+
11591163
/// Retrieve the @available attribute that provides the OS version range that
11601164
/// this declaration is available in.
11611165
///
@@ -2570,10 +2574,6 @@ class ValueDecl : public Decl {
25702574
/// \sa hasOpenAccess
25712575
AccessLevel getFormalAccess() const;
25722576

2573-
/// Determine whether this Decl has either Private or FilePrivate access,
2574-
/// and its DeclContext does not.
2575-
bool isOutermostPrivateOrFilePrivateScope() const;
2576-
25772577
/// Returns the outermost DeclContext from which this declaration can be
25782578
/// accessed, or null if the declaration is public.
25792579
///

include/swift/AST/FileUnit.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class FileUnit : public DeclContext, public ASTAllocated<FileUnit> {
200200
/// Since this value is used in name mangling, it should be a valid ASCII-only
201201
/// identifier.
202202
virtual Identifier
203-
getDiscriminatorForPrivateValue(const ValueDecl *D) const = 0;
203+
getDiscriminatorForPrivateDecl(const Decl *D) const = 0;
204204

205205
virtual bool shouldCollectDisplayDecls() const { return true; }
206206

@@ -389,7 +389,7 @@ class BuiltinUnit final : public FileUnit {
389389
SmallVectorImpl<AbstractFunctionDecl *> &results) const override;
390390

391391
Identifier
392-
getDiscriminatorForPrivateValue(const ValueDecl *D) const override {
392+
getDiscriminatorForPrivateDecl(const Decl *D) const override {
393393
llvm_unreachable("no private values in the Builtin module");
394394
}
395395

@@ -431,7 +431,7 @@ class LoadedFile : public FileUnit {
431431
return getModuleDefiningPath();
432432
}
433433

434-
virtual StringRef getFilenameForPrivateDecl(const ValueDecl *decl) const {
434+
virtual StringRef getFilenameForPrivateDecl(const Decl *decl) const {
435435
return StringRef();
436436
}
437437

include/swift/AST/SourceFile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ class SourceFile final : public FileUnit {
490490
virtual void
491491
collectLinkLibraries(ModuleDecl::LinkLibraryCallback callback) const override;
492492

493-
Identifier getDiscriminatorForPrivateValue(const ValueDecl *D) const override;
493+
Identifier getDiscriminatorForPrivateDecl(const Decl *D) const override;
494494
Identifier getPrivateDiscriminator() const { return PrivateDiscriminator; }
495495
Optional<ExternalSourceLocs::RawLocs>
496496
getExternalRawLocsForDecl(const Decl *D) const override;

include/swift/AST/SynthesizedFileUnit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class SynthesizedFileUnit final : public FileUnit {
5050
ObjCSelector selector,
5151
SmallVectorImpl<AbstractFunctionDecl *> &results) const override;
5252

53-
Identifier getDiscriminatorForPrivateValue(const ValueDecl *D) const override;
53+
Identifier getDiscriminatorForPrivateDecl(const Decl *D) const override;
5454

5555
void getTopLevelDecls(SmallVectorImpl<Decl*> &results) const override;
5656

include/swift/ClangImporter/ClangModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class ClangModuleUnit final : public LoadedFile {
104104
collectLinkLibraries(ModuleDecl::LinkLibraryCallback callback) const override;
105105

106106
Identifier
107-
getDiscriminatorForPrivateValue(const ValueDecl *D) const override {
107+
getDiscriminatorForPrivateDecl(const Decl *D) const override {
108108
llvm_unreachable("no private decls in Clang modules");
109109
}
110110

include/swift/Serialization/SerializedModuleLoader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ class SerializedASTFile final : public LoadedFile {
363363
SmallVectorImpl<ValueDecl*> &results) const override;
364364

365365
virtual StringRef
366-
getFilenameForPrivateDecl(const ValueDecl *decl) const override;
366+
getFilenameForPrivateDecl(const Decl *decl) const override;
367367

368368
virtual TypeDecl *lookupLocalType(StringRef MangledName) const override;
369369

@@ -456,7 +456,7 @@ class SerializedASTFile final : public LoadedFile {
456456

457457
virtual void loadDependenciesForTestable(SourceLoc diagLoc) const override;
458458

459-
Identifier getDiscriminatorForPrivateValue(const ValueDecl *D) const override;
459+
Identifier getDiscriminatorForPrivateDecl(const Decl *D) const override;
460460

461461
virtual StringRef getFilename() const override;
462462

lib/AST/ASTMangler.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ static unsigned getUnnamedParamIndex(const ParamDecl *D) {
959959
llvm_unreachable("param not found");
960960
}
961961

962-
static StringRef getPrivateDiscriminatorIfNecessary(const ValueDecl *decl) {
962+
static StringRef getPrivateDiscriminatorIfNecessary(const Decl *decl) {
963963
if (!decl->isOutermostPrivateOrFilePrivateScope())
964964
return StringRef();
965965

@@ -969,7 +969,7 @@ static StringRef getPrivateDiscriminatorIfNecessary(const ValueDecl *decl) {
969969
auto fileUnit = cast<FileUnit>(topLevelSubcontext);
970970

971971
Identifier discriminator =
972-
fileUnit->getDiscriminatorForPrivateValue(decl);
972+
fileUnit->getDiscriminatorForPrivateDecl(decl);
973973
assert(!discriminator.empty());
974974
assert(!isNonAscii(discriminator.str()) &&
975975
"discriminator contains non-ASCII characters");
@@ -4005,6 +4005,11 @@ std::string ASTMangler::mangleMacroExpansion(
40054005
const MacroExpansionDecl *expansion) {
40064006
beginMangling();
40074007
appendMacroExpansionContext(expansion->getLoc(), expansion->getDeclContext());
4008+
auto privateDiscriminator = getPrivateDiscriminatorIfNecessary(expansion);
4009+
if (!privateDiscriminator.empty()) {
4010+
appendIdentifier(privateDiscriminator);
4011+
appendOperator("Ll");
4012+
}
40084013
appendMacroExpansionOperator(
40094014
expansion->getMacroName().getBaseName().userFacingName(),
40104015
MacroRole::Declaration,

lib/AST/Decl.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,13 +2697,15 @@ void AbstractStorageDecl::visitOpaqueAccessors(
26972697
});
26982698
}
26992699

2700-
static bool hasPrivateOrFilePrivateFormalAccess(const ValueDecl *D) {
2701-
return D->getFormalAccess() <= AccessLevel::FilePrivate;
2700+
static bool hasPrivateOrFilePrivateFormalAccess(const Decl *D) {
2701+
if (auto *VD = dyn_cast<ValueDecl>(D))
2702+
return VD->getFormalAccess() <= AccessLevel::FilePrivate;
2703+
return isa<MacroExpansionDecl>(D);
27022704
}
27032705

27042706
/// Returns true if one of the ancestor DeclContexts of this ValueDecl is either
27052707
/// marked private or fileprivate or is a local context.
2706-
static bool isInPrivateOrLocalContext(const ValueDecl *D) {
2708+
static bool isInPrivateOrLocalContext(const Decl *D) {
27072709
const DeclContext *DC = D->getDeclContext();
27082710
if (!DC->isTypeContext()) {
27092711
assert((DC->isModuleScopeContext() || DC->isLocalContext()) &&
@@ -2720,7 +2722,7 @@ static bool isInPrivateOrLocalContext(const ValueDecl *D) {
27202722
return isInPrivateOrLocalContext(nominal);
27212723
}
27222724

2723-
bool ValueDecl::isOutermostPrivateOrFilePrivateScope() const {
2725+
bool Decl::isOutermostPrivateOrFilePrivateScope() const {
27242726
return hasPrivateOrFilePrivateFormalAccess(this) &&
27252727
!isInPrivateOrLocalContext(this);
27262728
}

lib/AST/Module.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ void ModuleDecl::lookupMember(SmallVectorImpl<ValueDecl*> &results,
990990
return true;
991991
auto enclosingFile =
992992
cast<FileUnit>(VD->getDeclContext()->getModuleScopeContext());
993-
auto discriminator = enclosingFile->getDiscriminatorForPrivateValue(VD);
993+
auto discriminator = enclosingFile->getDiscriminatorForPrivateDecl(VD);
994994
return discriminator != privateDiscriminator;
995995
});
996996
results.erase(newEnd, results.end());
@@ -3818,7 +3818,7 @@ ASTScope &SourceFile::getScope() {
38183818
}
38193819

38203820
Identifier
3821-
SourceFile::getDiscriminatorForPrivateValue(const ValueDecl *D) const {
3821+
SourceFile::getDiscriminatorForPrivateDecl(const Decl *D) const {
38223822
assert(D->getDeclContext()->getModuleScopeContext() == this ||
38233823
D->getDeclContext()->getModuleScopeContext() == getSynthesizedFile());
38243824

@@ -3947,15 +3947,15 @@ SynthesizedFileUnit::SynthesizedFileUnit(FileUnit &FU)
39473947
}
39483948

39493949
Identifier
3950-
SynthesizedFileUnit::getDiscriminatorForPrivateValue(const ValueDecl *D) const {
3950+
SynthesizedFileUnit::getDiscriminatorForPrivateDecl(const Decl *D) const {
39513951
assert(D->getDeclContext()->getModuleScopeContext() == this);
39523952

39533953
// Use cached primitive discriminator if it exists.
39543954
if (!PrivateDiscriminator.empty())
39553955
return PrivateDiscriminator;
39563956

39573957
// Start with the discriminator that the file we belong to would use.
3958-
auto ownerDiscriminator = getFileUnit().getDiscriminatorForPrivateValue(D);
3958+
auto ownerDiscriminator = getFileUnit().getDiscriminatorForPrivateDecl(D);
39593959

39603960
// Hash that with a special string to produce a different value that preserves
39613961
// the entropy of the original.

lib/AST/NameLookup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ static DiscriminatorMatch matchDiscriminator(Identifier discriminator,
990990
if (!containingFile)
991991
return DiscriminatorMatch::Different;
992992

993-
if (discriminator == containingFile->getDiscriminatorForPrivateValue(value))
993+
if (discriminator == containingFile->getDiscriminatorForPrivateDecl(value))
994994
return DiscriminatorMatch::Matches;
995995

996996
return DiscriminatorMatch::Different;

lib/ClangImporter/DWARFImporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class DWARFModuleUnit final : public LoadedFile {
7777
ModuleDecl::LinkLibraryCallback callback) const override {};
7878

7979
Identifier
80-
getDiscriminatorForPrivateValue(const ValueDecl *D) const override {
80+
getDiscriminatorForPrivateDecl(const Decl *D) const override {
8181
llvm_unreachable("no private decls in Clang modules");
8282
}
8383

lib/Demangling/Demangler.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4095,9 +4095,14 @@ NodePointer Demangler::demangleMacroExpansion() {
40954095
}
40964096

40974097
NodePointer name = popNode(Node::Kind::Identifier);
4098+
NodePointer privateDiscriminator = popNode(Node::Kind::PrivateDeclName);
40984099
NodePointer context = popNode(isMacroExpansionNodeKind);
40994100
if (!context)
41004101
context = popContext();
41014102
NodePointer discriminator = demangleIndexAsNode();
4102-
return createWithChildren(kind, context, name, discriminator);
4103+
auto result = createWithChildren(
4104+
kind, context, name, discriminator);
4105+
if (privateDiscriminator)
4106+
result->addChild(privateDiscriminator, *this);
4107+
return result;
41034108
}

lib/Demangling/Remangler.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2898,6 +2898,8 @@ ManglingError Remangler::mangleMacro(Node *node, unsigned depth) {
28982898
ManglingError Remangler::mangleFreestandingMacroExpansion(
28992899
Node *node, unsigned depth) {
29002900
RETURN_IF_ERROR(mangleChildNode(node, 0, depth + 1));
2901+
if (auto privateDiscriminator = node->getChild(3))
2902+
RETURN_IF_ERROR(mangle(privateDiscriminator, depth + 1));
29012903
RETURN_IF_ERROR(mangleChildNode(node, 1, depth + 1));
29022904
Buffer << "fMf";
29032905
return mangleChildNode(node, 2, depth + 1);
@@ -2906,6 +2908,8 @@ ManglingError Remangler::mangleFreestandingMacroExpansion(
29062908
ManglingError Remangler::mangleAccessorAttachedMacroExpansion(
29072909
Node *node, unsigned depth) {
29082910
RETURN_IF_ERROR(mangleChildNode(node, 0, depth + 1));
2911+
if (auto privateDiscriminator = node->getChild(3))
2912+
RETURN_IF_ERROR(mangle(privateDiscriminator, depth + 1));
29092913
RETURN_IF_ERROR(mangleChildNode(node, 1, depth + 1));
29102914
Buffer << "fMa";
29112915
return mangleChildNode(node, 2, depth + 1);
@@ -2914,6 +2918,8 @@ ManglingError Remangler::mangleAccessorAttachedMacroExpansion(
29142918
ManglingError Remangler::mangleMemberAttributeAttachedMacroExpansion(
29152919
Node *node, unsigned depth) {
29162920
RETURN_IF_ERROR(mangleChildNode(node, 0, depth + 1));
2921+
if (auto privateDiscriminator = node->getChild(3))
2922+
RETURN_IF_ERROR(mangle(privateDiscriminator, depth + 1));
29172923
RETURN_IF_ERROR(mangleChildNode(node, 1, depth + 1));
29182924
Buffer << "fMA";
29192925
return mangleChildNode(node, 2, depth + 1);
@@ -2922,6 +2928,8 @@ ManglingError Remangler::mangleMemberAttributeAttachedMacroExpansion(
29222928
ManglingError Remangler::mangleMemberAttachedMacroExpansion(
29232929
Node *node, unsigned depth) {
29242930
RETURN_IF_ERROR(mangleChildNode(node, 0, depth + 1));
2931+
if (auto privateDiscriminator = node->getChild(3))
2932+
RETURN_IF_ERROR(mangle(privateDiscriminator, depth + 1));
29252933
RETURN_IF_ERROR(mangleChildNode(node, 1, depth + 1));
29262934
Buffer << "fMm";
29272935
return mangleChildNode(node, 2, depth + 1);
@@ -2930,6 +2938,8 @@ ManglingError Remangler::mangleMemberAttachedMacroExpansion(
29302938
ManglingError Remangler::manglePeerAttachedMacroExpansion(
29312939
Node *node, unsigned depth) {
29322940
RETURN_IF_ERROR(mangleChildNode(node, 0, depth + 1));
2941+
if (auto privateDiscriminator = node->getChild(3))
2942+
RETURN_IF_ERROR(mangle(privateDiscriminator, depth + 1));
29332943
RETURN_IF_ERROR(mangleChildNode(node, 1, depth + 1));
29342944
Buffer << "fMp";
29352945
return mangleChildNode(node, 2, depth + 1);
@@ -2938,6 +2948,8 @@ ManglingError Remangler::manglePeerAttachedMacroExpansion(
29382948
ManglingError Remangler::mangleConformanceAttachedMacroExpansion(
29392949
Node *node, unsigned depth) {
29402950
RETURN_IF_ERROR(mangleChildNode(node, 0, depth + 1));
2951+
if (auto privateDiscriminator = node->getChild(3))
2952+
RETURN_IF_ERROR(mangle(privateDiscriminator, depth + 1));
29412953
RETURN_IF_ERROR(mangleChildNode(node, 1, depth + 1));
29422954
Buffer << "fMc";
29432955
return mangleChildNode(node, 2, depth + 1);
@@ -2946,6 +2958,8 @@ ManglingError Remangler::mangleConformanceAttachedMacroExpansion(
29462958
ManglingError Remangler::mangleMacroExpansionUniqueName(
29472959
Node *node, unsigned depth) {
29482960
RETURN_IF_ERROR(mangleChildNode(node, 0, depth + 1));
2961+
if (auto privateDiscriminator = node->getChild(3))
2962+
RETURN_IF_ERROR(mangle(privateDiscriminator, depth + 1));
29492963
RETURN_IF_ERROR(mangleChildNode(node, 1, depth + 1));
29502964
Buffer << "fMu";
29512965
return mangleChildNode(node, 2, depth + 1);

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1784,7 +1784,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
17841784
// Retrieve the private discriminator.
17851785
auto *MSC = Decl->getDeclContext()->getModuleScopeContext();
17861786
auto *FU = cast<FileUnit>(MSC);
1787-
Identifier PD = FU->getDiscriminatorForPrivateValue(Decl);
1787+
Identifier PD = FU->getDiscriminatorForPrivateDecl(Decl);
17881788
bool ExportSymbols = true;
17891789
return DBuilder.createNameSpace(Parent, PD.str(), ExportSymbols);
17901790
}

lib/Serialization/ModuleFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ ModuleFile::getGroupNameByUSR(StringRef USR) const {
13201320
return None;
13211321
}
13221322

1323-
Identifier ModuleFile::getDiscriminatorForPrivateValue(const ValueDecl *D) {
1323+
Identifier ModuleFile::getDiscriminatorForPrivateDecl(const Decl *D) {
13241324
Identifier discriminator = PrivateDiscriminatorsByValue.lookup(D);
13251325
assert(!discriminator.empty() && "no discriminator found for decl");
13261326
return discriminator;

lib/Serialization/ModuleFile.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ class ModuleFile
301301
llvm::DenseMap<uint32_t,
302302
std::unique_ptr<SerializedDeclMembersTable>> DeclMembersTables;
303303

304-
llvm::DenseMap<const ValueDecl *, Identifier> PrivateDiscriminatorsByValue;
305-
llvm::DenseMap<const ValueDecl *, StringRef> FilenamesForPrivateValues;
304+
llvm::DenseMap<const Decl *, Identifier> PrivateDiscriminatorsByValue;
305+
llvm::DenseMap<const Decl *, StringRef> FilenamesForPrivateValues;
306306

307307
TinyPtrVector<Decl *> ImportDecls;
308308

@@ -884,7 +884,7 @@ class ModuleFile
884884
Optional<StringRef> getGroupNameByUSR(StringRef USR) const;
885885
Optional<ExternalSourceLocs::RawLocs>
886886
getExternalRawLocsForDecl(const Decl *D) const;
887-
Identifier getDiscriminatorForPrivateValue(const ValueDecl *D);
887+
Identifier getDiscriminatorForPrivateDecl(const Decl *D);
888888
Optional<Fingerprint> loadFingerprint(const IterableDeclContext *IDC) const;
889889
void collectBasicSourceFileInfo(
890890
llvm::function_ref<void(const BasicSourceFileInfo &)> callback) const;

lib/Serialization/Serialization.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,7 +1968,7 @@ void Serializer::writeCrossReference(const DeclContext *DC, uint32_t pathLen) {
19681968
Identifier discriminator;
19691969
if (generic->isOutermostPrivateOrFilePrivateScope()) {
19701970
auto *containingFile = cast<FileUnit>(generic->getModuleScopeContext());
1971-
discriminator = containingFile->getDiscriminatorForPrivateValue(generic);
1971+
discriminator = containingFile->getDiscriminatorForPrivateDecl(generic);
19721972
}
19731973

19741974
bool isProtocolExt = DC->getParent()->getExtendedProtocolDecl();
@@ -2144,7 +2144,7 @@ void Serializer::writeCrossReference(const Decl *D) {
21442144
if (type->isOutermostPrivateOrFilePrivateScope()) {
21452145
auto *containingFile =
21462146
cast<FileUnit>(type->getDeclContext()->getModuleScopeContext());
2147-
discriminator = containingFile->getDiscriminatorForPrivateValue(type);
2147+
discriminator = containingFile->getDiscriminatorForPrivateDecl(type);
21482148
}
21492149

21502150
XRefTypePathPieceLayout::emitRecord(Out, ScratchRecord, abbrCode,
@@ -3057,7 +3057,7 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
30573057
if (auto *enclosingFile = dyn_cast<FileUnit>(topLevelSubcontext)) {
30583058
if (shouldEmitPrivateDiscriminator) {
30593059
Identifier discriminator =
3060-
enclosingFile->getDiscriminatorForPrivateValue(value);
3060+
enclosingFile->getDiscriminatorForPrivateDecl(value);
30613061
unsigned abbrCode =
30623062
S.DeclTypeAbbrCodes[PrivateDiscriminatorLayout::Code];
30633063
PrivateDiscriminatorLayout::emitRecord(

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ void SerializedASTFile::lookupValue(DeclName name, NLKind lookupKind,
15061506
}
15071507

15081508
StringRef
1509-
SerializedASTFile::getFilenameForPrivateDecl(const ValueDecl *decl) const {
1509+
SerializedASTFile::getFilenameForPrivateDecl(const Decl *decl) const {
15101510
return File.FilenamesForPrivateValues.lookup(decl);
15111511
}
15121512

@@ -1688,8 +1688,8 @@ const clang::Module *SerializedASTFile::getUnderlyingClangModule() const {
16881688
}
16891689

16901690
Identifier
1691-
SerializedASTFile::getDiscriminatorForPrivateValue(const ValueDecl *D) const {
1692-
Identifier discriminator = File.getDiscriminatorForPrivateValue(D);
1691+
SerializedASTFile::getDiscriminatorForPrivateDecl(const Decl *D) const {
1692+
Identifier discriminator = File.getDiscriminatorForPrivateDecl(D);
16931693
assert(!discriminator.empty() && "no discriminator found for value");
16941694
return discriminator;
16951695
}

test/Demangle/Inputs/manglings.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,3 +457,4 @@ $s9MacroUser016testFreestandingA9ExpansionyyF4Foo3L_V23bitwidthNumberedStructsfM
457457
@__swiftmacro_15accessor_macros8MyStructV4nameSSvp17myPropertyWrapperfMa_ ---> accessor macro expansion #1 of myPropertyWrapper in accessor_macros.MyStruct.name : Swift.String
458458
@__swiftmacro_18macro_expand_peers1SV1f1a3for_SSSi_SSSdtYaF20addCompletionHandlerfMp_ ---> peer macro expansion #1 of addCompletionHandler in macro_expand_peers.S.f(a: Swift.Int, for: Swift.String, _: Swift.Double) async -> Swift.String
459459
@__swiftmacro_25macro_expand_conformances7GenericV20DelegatedConformancefMc_ ---> conformance macro expansion #1 of DelegatedConformance in macro_expand_conformances.Generic
460+
@__swiftmacro_9MacroUser16MemberNotCoveredV33_4361AD9339943F52AE6186DD51E04E91Ll0dE0fMf0_ ---> freestanding macro expansion #2 of NotCovered(in _4361AD9339943F52AE6186DD51E04E91) in MacroUser.MemberNotCovered

0 commit comments

Comments
 (0)