Skip to content

Commit

Permalink
[clang][AST][NFC] const-qualify some local references
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaederr committed Dec 21, 2023
1 parent b3769ad commit d5c98e7
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions clang/lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2943,7 +2943,7 @@ bool ParmVarDecl::isDestroyedInCallee() const {

// FIXME: isParamDestroyedInCallee() should probably imply
// isDestructedType()
auto *RT = getType()->getAs<RecordType>();
const auto *RT = getType()->getAs<RecordType>();
if (RT && RT->getDecl()->isParamDestroyedInCallee() &&
getType().isDestructedType())
return true;
Expand Down Expand Up @@ -3105,7 +3105,7 @@ FunctionDecl::getDefaultedFunctionInfo() const {
}

bool FunctionDecl::hasBody(const FunctionDecl *&Definition) const {
for (auto *I : redecls()) {
for (const auto *I : redecls()) {
if (I->doesThisDeclarationHaveABody()) {
Definition = I;
return true;
Expand All @@ -3116,7 +3116,7 @@ bool FunctionDecl::hasBody(const FunctionDecl *&Definition) const {
}

bool FunctionDecl::hasTrivialBody() const {
Stmt *S = getBody();
const Stmt *S = getBody();
if (!S) {
// Since we don't have a body for this function, we don't know if it's
// trivial or not.
Expand Down Expand Up @@ -3212,7 +3212,7 @@ void FunctionDecl::setPure(bool P) {

template<std::size_t Len>
static bool isNamed(const NamedDecl *ND, const char (&Str)[Len]) {
IdentifierInfo *II = ND->getIdentifier();
const IdentifierInfo *II = ND->getIdentifier();
return II && II->isStr(Str);
}

Expand Down Expand Up @@ -3305,9 +3305,9 @@ bool FunctionDecl::isReservedGlobalPlacementOperator() const {
if (proto->getNumParams() != 2 || proto->isVariadic())
return false;

ASTContext &Context =
cast<TranslationUnitDecl>(getDeclContext()->getRedeclContext())
->getASTContext();
const ASTContext &Context =
cast<TranslationUnitDecl>(getDeclContext()->getRedeclContext())
->getASTContext();

// The result type and first argument type are constant across all
// these operators. The second argument must be exactly void*.
Expand Down Expand Up @@ -3342,7 +3342,7 @@ bool FunctionDecl::isReplaceableGlobalAllocationFunction(

unsigned Params = 1;
QualType Ty = FPT->getParamType(Params);
ASTContext &Ctx = getASTContext();
const ASTContext &Ctx = getASTContext();

auto Consume = [&] {
++Params;
Expand Down Expand Up @@ -3388,7 +3388,8 @@ bool FunctionDecl::isReplaceableGlobalAllocationFunction(
QualType T = Ty;
while (const auto *TD = T->getAs<TypedefType>())
T = TD->getDecl()->getUnderlyingType();
IdentifierInfo *II = T->castAs<EnumType>()->getDecl()->getIdentifier();
const IdentifierInfo *II =
T->castAs<EnumType>()->getDecl()->getIdentifier();
if (II && II->isStr("__hot_cold_t"))
Consume();
}
Expand Down Expand Up @@ -3586,7 +3587,7 @@ unsigned FunctionDecl::getBuiltinID(bool ConsiderWrapperFunctions) const {
(!hasAttr<ArmBuiltinAliasAttr>() && !hasAttr<BuiltinAliasAttr>()))
return 0;

ASTContext &Context = getASTContext();
const ASTContext &Context = getASTContext();
if (!Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
return BuiltinID;

Expand Down Expand Up @@ -3745,7 +3746,7 @@ bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
assert(!doesThisDeclarationHaveABody() &&
"Must have a declaration without a body.");

ASTContext &Context = getASTContext();
const ASTContext &Context = getASTContext();

if (Context.getLangOpts().MSVCCompat) {
const FunctionDecl *Definition;
Expand Down

0 comments on commit d5c98e7

Please sign in to comment.