[Clang][NFC] Some const for IdentifierInfo *s feeding DeclarationName

`DeclarationName` already takes `const IdentifierInfo *`. Propagate the
`const` outward to various APIs.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D122261
This commit is contained in:
Hubert Tong 2022-03-23 11:03:44 -04:00
parent 5737ce259b
commit da167a53c8
4 changed files with 10 additions and 11 deletions

View file

@ -1041,7 +1041,7 @@ protected:
}; };
VarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, VarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
SourceLocation IdLoc, IdentifierInfo *Id, QualType T, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T,
TypeSourceInfo *TInfo, StorageClass SC); TypeSourceInfo *TInfo, StorageClass SC);
using redeclarable_base = Redeclarable<VarDecl>; using redeclarable_base = Redeclarable<VarDecl>;
@ -1071,8 +1071,8 @@ public:
static VarDecl *Create(ASTContext &C, DeclContext *DC, static VarDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation StartLoc, SourceLocation IdLoc, SourceLocation StartLoc, SourceLocation IdLoc,
IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, const IdentifierInfo *Id, QualType T,
StorageClass S); TypeSourceInfo *TInfo, StorageClass S);
static VarDecl *CreateDeserialized(ASTContext &C, unsigned ID); static VarDecl *CreateDeserialized(ASTContext &C, unsigned ID);

View file

@ -10175,7 +10175,7 @@ public:
void ActOnPragmaVisibility(const IdentifierInfo* VisType, void ActOnPragmaVisibility(const IdentifierInfo* VisType,
SourceLocation PragmaLoc); SourceLocation PragmaLoc);
NamedDecl *DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II, NamedDecl *DeclClonePragmaWeak(NamedDecl *ND, const IdentifierInfo *II,
SourceLocation Loc); SourceLocation Loc);
void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W); void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W);

View file

@ -2020,7 +2020,7 @@ const char *VarDecl::getStorageClassSpecifierString(StorageClass SC) {
VarDecl::VarDecl(Kind DK, ASTContext &C, DeclContext *DC, VarDecl::VarDecl(Kind DK, ASTContext &C, DeclContext *DC,
SourceLocation StartLoc, SourceLocation IdLoc, SourceLocation StartLoc, SourceLocation IdLoc,
IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo,
StorageClass SC) StorageClass SC)
: DeclaratorDecl(DK, DC, IdLoc, Id, T, TInfo, StartLoc), : DeclaratorDecl(DK, DC, IdLoc, Id, T, TInfo, StartLoc),
redeclarable_base(C) { redeclarable_base(C) {
@ -2035,10 +2035,9 @@ VarDecl::VarDecl(Kind DK, ASTContext &C, DeclContext *DC,
// Everything else is implicitly initialized to false. // Everything else is implicitly initialized to false.
} }
VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC, VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation StartL,
SourceLocation StartL, SourceLocation IdL, SourceLocation IdL, const IdentifierInfo *Id,
IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, QualType T, TypeSourceInfo *TInfo, StorageClass S) {
StorageClass S) {
return new (C, DC) VarDecl(Var, C, DC, StartL, IdL, Id, T, TInfo, S); return new (C, DC) VarDecl(Var, C, DC, StartL, IdL, Id, T, TInfo, S);
} }

View file

@ -9016,8 +9016,8 @@ void Sema::checkUnusedDeclAttributes(Declarator &D) {
/// DeclClonePragmaWeak - clone existing decl (maybe definition), /// DeclClonePragmaWeak - clone existing decl (maybe definition),
/// \#pragma weak needs a non-definition decl and source may not have one. /// \#pragma weak needs a non-definition decl and source may not have one.
NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II, NamedDecl *Sema::DeclClonePragmaWeak(NamedDecl *ND, const IdentifierInfo *II,
SourceLocation Loc) { SourceLocation Loc) {
assert(isa<FunctionDecl>(ND) || isa<VarDecl>(ND)); assert(isa<FunctionDecl>(ND) || isa<VarDecl>(ND));
NamedDecl *NewD = nullptr; NamedDecl *NewD = nullptr;
if (auto *FD = dyn_cast<FunctionDecl>(ND)) { if (auto *FD = dyn_cast<FunctionDecl>(ND)) {