[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
This commit is contained in:
Richard Wei
2023-03-31 20:36:29 -07:00
committed by GitHub
parent 77bd312a88
commit eb8e984b97
24 changed files with 84 additions and 49 deletions

View File

@@ -1506,7 +1506,7 @@ void SerializedASTFile::lookupValue(DeclName name, NLKind lookupKind,
}
StringRef
SerializedASTFile::getFilenameForPrivateDecl(const ValueDecl *decl) const {
SerializedASTFile::getFilenameForPrivateDecl(const Decl *decl) const {
return File.FilenamesForPrivateValues.lookup(decl);
}
@@ -1688,8 +1688,8 @@ const clang::Module *SerializedASTFile::getUnderlyingClangModule() const {
}
Identifier
SerializedASTFile::getDiscriminatorForPrivateValue(const ValueDecl *D) const {
Identifier discriminator = File.getDiscriminatorForPrivateValue(D);
SerializedASTFile::getDiscriminatorForPrivateDecl(const Decl *D) const {
Identifier discriminator = File.getDiscriminatorForPrivateDecl(D);
assert(!discriminator.empty() && "no discriminator found for value");
return discriminator;
}