Sema: Change a couple of Identifier usages to DeclName instead

This commit is contained in:
Slava Pestov
2025-05-29 13:49:44 -04:00
parent 14f6dbfc3a
commit 0e1561f05a
4 changed files with 9 additions and 9 deletions

View File

@@ -7891,7 +7891,7 @@ ERROR(expected_macro_expansion_expr,PointsToFirstBadToken,
ERROR(expected_macro_expansion_decls,PointsToFirstBadToken,
"expected macro expansion to produce a declaration", ())
ERROR(macro_undefined,PointsToFirstBadToken,
"no macro named %0", (Identifier))
"no macro named %0", (DeclName))
ERROR(external_macro_not_found,none,
"external macro implementation type '%0.%1' could not be found for "
"macro %2; %3", (StringRef, StringRef, DeclName, StringRef))

View File

@@ -520,7 +520,7 @@ struct ASTContext::Implementation {
llvm::DenseMap<const AbstractFunctionDecl *, SourceRange> OriginalBodySourceRanges;
/// Macro discriminators per context.
llvm::DenseMap<std::pair<const void *, Identifier>, unsigned>
llvm::DenseMap<std::pair<const void *, DeclBaseName>, unsigned>
NextMacroDiscriminator;
/// Local and closure discriminators per context.
@@ -2286,8 +2286,8 @@ unsigned ASTContext::getNextMacroDiscriminator(
MacroDiscriminatorContext context,
DeclBaseName baseName
) {
std::pair<const void *, Identifier> key(
context.getOpaqueValue(), baseName.getIdentifier());
std::pair<const void *, DeclBaseName> key(
context.getOpaqueValue(), baseName);
return getImpl().NextMacroDiscriminator[key]++;
}

View File

@@ -4068,8 +4068,8 @@ namespace {
}
/// Lookup all macros with the given macro name.
SmallVector<OverloadChoice, 1> lookupMacros(Identifier moduleName,
Identifier macroName,
SmallVector<OverloadChoice, 1> lookupMacros(DeclName moduleName,
DeclName macroName,
FunctionRefInfo functionRefInfo,
MacroRoles roles) {
SmallVector<OverloadChoice, 1> choices;
@@ -4100,8 +4100,8 @@ namespace {
CS.associateArgumentList(locator, expr->getArgs());
// Look up the macros with this name.
auto moduleIdent = expr->getModuleName().getBaseIdentifier();
auto macroIdent = expr->getMacroName().getBaseIdentifier();
auto moduleIdent = expr->getModuleName().getBaseName();
auto macroIdent = expr->getMacroName().getBaseName();
FunctionRefInfo functionRefInfo = FunctionRefInfo::singleBaseNameApply();
auto macros = lookupMacros(moduleIdent, macroIdent, functionRefInfo,
expr->getMacroRoles());

View File

@@ -1,3 +1,3 @@
// {"signature":"swift::DeclAndTypePrinter::Implementation::visitVarDecl(swift::VarDecl*)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
// RUN: not %target-swift-frontend -typecheck %s
#init