Skip to content

Commit c63b737

Browse files
committed
Collapse all indirect equivalents to ValueDecl::getBaseIdentifier
1 parent d0ae3ee commit c63b737

23 files changed

+44
-44
lines changed

include/swift/AST/Decl.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2497,7 +2497,7 @@ class ValueDecl : public Decl {
24972497
DeclBaseName getBaseName() const { return Name.getBaseName(); }
24982498

24992499
Identifier getBaseIdentifier() const {
2500-
return getFullName().getBaseIdentifier();
2500+
return Name.getBaseIdentifier();
25012501
}
25022502

25032503
/// Generates a DeclNameRef referring to this declaration with as much
@@ -2828,12 +2828,12 @@ class TypeDecl : public ValueDecl {
28282828
ValueDecl(K, context, name, NameLoc), Inherited(inherited) {}
28292829

28302830
public:
2831-
Identifier getName() const { return getFullName().getBaseIdentifier(); }
2831+
Identifier getName() const { return getBaseIdentifier(); }
28322832

28332833
/// Returns the string for the base name, or "_" if this is unnamed.
28342834
StringRef getNameStr() const {
28352835
assert(!getFullName().isSpecial() && "Cannot get string for special names");
2836-
return hasName() ? getBaseName().getIdentifier().str() : "_";
2836+
return hasName() ? getBaseIdentifier().str() : "_";
28372837
}
28382838

28392839
/// The type of this declaration's values. For the type of the
@@ -4915,12 +4915,12 @@ class VarDecl : public AbstractStorageDecl {
49154915

49164916
SourceRange getSourceRange() const;
49174917

4918-
Identifier getName() const { return getFullName().getBaseIdentifier(); }
4918+
Identifier getName() const { return getBaseIdentifier(); }
49194919

49204920
/// Returns the string for the base name, or "_" if this is unnamed.
49214921
StringRef getNameStr() const {
49224922
assert(!getFullName().isSpecial() && "Cannot get string for special names");
4923-
return hasName() ? getBaseName().getIdentifier().str() : "_";
4923+
return hasName() ? getBaseIdentifier().str() : "_";
49244924
}
49254925

49264926
/// Get the type of the variable within its context. If the context is generic,
@@ -5895,7 +5895,7 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
58955895
/// Returns the string for the base name, or "_" if this is unnamed.
58965896
StringRef getNameStr() const {
58975897
assert(!getFullName().isSpecial() && "Cannot get string for special names");
5898-
return hasName() ? getBaseName().getIdentifier().str() : "_";
5898+
return hasName() ? getBaseIdentifier().str() : "_";
58995899
}
59005900

59015901
/// Should this declaration be treated as if annotated with transparent
@@ -6588,7 +6588,7 @@ class EnumElementDecl : public DeclContext, public ValueDecl {
65886588
/// Returns the string for the base name, or "_" if this is unnamed.
65896589
StringRef getNameStr() const {
65906590
assert(!getFullName().isSpecial() && "Cannot get string for special names");
6591-
return hasName() ? getBaseName().getIdentifier().str() : "_";
6591+
return hasName() ? getBaseIdentifier().str() : "_";
65926592
}
65936593

65946594
Type getArgumentInterfaceType() const;

lib/AST/Decl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ bool Decl::hasUnderscoredNaming() const {
760760
}
761761

762762
if (!VD->getBaseName().isSpecial() &&
763-
VD->getBaseName().getIdentifier().str().startswith("_")) {
763+
VD->getBaseIdentifier().str().startswith("_")) {
764764
return true;
765765
}
766766

@@ -3167,7 +3167,7 @@ bool ValueDecl::shouldHideFromEditor() const {
31673167

31683168
// '$__' names are reserved by compiler internal.
31693169
if (!getBaseName().isSpecial() &&
3170-
getBaseName().getIdentifier().str().startswith("$__"))
3170+
getBaseIdentifier().str().startswith("$__"))
31713171
return true;
31723172

31733173
return false;
@@ -3586,8 +3586,8 @@ int TypeDecl::compare(const TypeDecl *type1, const TypeDecl *type2) {
35863586
return result;
35873587
}
35883588

3589-
if (int result = type1->getBaseName().getIdentifier().str().compare(
3590-
type2->getBaseName().getIdentifier().str()))
3589+
if (int result = type1->getBaseIdentifier().str().compare(
3590+
type2->getBaseIdentifier().str()))
35913591
return result;
35923592

35933593
// Error case: two type declarations that cannot be distinguished.

lib/AST/SwiftNameTranslation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ getNameForObjC(const ValueDecl *VD, CustomNamesOnly_t customNamesOnly) {
4949
return anonTypedef->getIdentifier()->getName();
5050
}
5151

52-
return VD->getBaseName().getIdentifier().str();
52+
return VD->getBaseIdentifier().str();
5353
}
5454

5555
std::string swift::objc_translation::

lib/AST/USRGeneration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ swift::USRGenerationRequest::evaluate(Evaluator &evaluator,
225225

226226
auto ClangMacroInfo = ClangN.getAsMacro();
227227
bool Ignore = clang::index::generateUSRForMacro(
228-
D->getBaseName().getIdentifier().str(),
228+
D->getBaseIdentifier().str(),
229229
ClangMacroInfo->getDefinitionLoc(),
230230
Importer.getClangASTContext().getSourceManager(), Buffer);
231231
if (!Ignore)

lib/ClangImporter/ClangImporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2414,7 +2414,7 @@ class DarwinLegacyFilterDeclConsumer : public swift::VisibleDeclConsumer {
24142414
if (clangModule->Name == "MacTypes") {
24152415
if (!VD->hasName() || VD->getBaseName().isSpecial())
24162416
return true;
2417-
return llvm::StringSwitch<bool>(VD->getBaseName().getIdentifier().str())
2417+
return llvm::StringSwitch<bool>(VD->getBaseIdentifier().str())
24182418
.Cases("OSErr", "OSStatus", "OptionBits", false)
24192419
.Cases("FourCharCode", "OSType", false)
24202420
.Case("Boolean", false)

lib/ClangImporter/ImportDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3202,7 +3202,7 @@ namespace {
32023202
// context.
32033203
if (errorWrapper) {
32043204
auto enumeratorValue = cast<ValueDecl>(enumeratorDecl);
3205-
auto name = enumeratorValue->getBaseName().getIdentifier();
3205+
auto name = enumeratorValue->getBaseIdentifier();
32063206
auto alias = importEnumCaseAlias(name,
32073207
constant,
32083208
enumeratorValue,

lib/IRGen/GenReflection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ class FieldTypeMetadataBuilder : public ReflectionMetadataBuilder {
693693
}
694694

695695
if (IGM.IRGen.Opts.EnableReflectionNames) {
696-
auto name = value->getBaseName().getIdentifier().str();
696+
auto name = value->getBaseIdentifier().str();
697697
auto fieldName = IGM.getAddrOfFieldName(name);
698698
B.addRelativeAddress(fieldName);
699699
} else {

lib/Migrator/APIDiffMigratorPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ struct APIDiffMigratorPass : public ASTMigratorPass, public SourceEntityWalker {
386386
for (auto *D: TopDecls) {
387387
if (auto *FD = dyn_cast<FuncDecl>(D)) {
388388
InsertedFunctions.insert(
389-
std::string(FD->getBaseName().getIdentifier()));
389+
std::string(FD->getBaseIdentifier()));
390390
}
391391
}
392392

lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3519,7 +3519,7 @@ void Parser::setLocalDiscriminator(ValueDecl *D) {
35193519
if (!getScopeInfo().isInactiveConfigBlock())
35203520
SF.LocalTypeDecls.insert(TD);
35213521

3522-
Identifier name = D->getBaseName().getIdentifier();
3522+
const Identifier name = D->getBaseIdentifier();
35233523
unsigned discriminator = CurLocalContext->claimNextNamedDiscriminator(name);
35243524
D->setLocalDiscriminator(discriminator);
35253525
}

lib/SILGen/SILGenBuiltin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ SpecializedEmitter::forDecl(SILGenModule &SGM, SILDeclRef function) {
13551355
if (!isa<BuiltinUnit>(decl->getDeclContext()))
13561356
return None;
13571357

1358-
auto name = decl->getBaseName().getIdentifier();
1358+
const auto name = decl->getBaseIdentifier();
13591359
const BuiltinInfo &builtin = SGM.M.getBuiltinInfo(name);
13601360
switch (builtin.ID) {
13611361
// All the non-SIL, non-type-trait builtins should use the

0 commit comments

Comments
 (0)