[clang] [Clang] Rename SecondArgIsLastNamedArgument for clarity and consistency (PR #131346)
Imad Aldij via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 14 08:52:20 PDT 2025
https://github.com/imdj updated https://github.com/llvm/llvm-project/pull/131346
>From 3b2f0f906d24b812f1806540f88b0668198dfa42 Mon Sep 17 00:00:00 2001
From: Imad Aldij <os at imadij.com>
Date: Fri, 14 Mar 2025 17:51:34 +0200
Subject: [PATCH] [Clang] Rename SecondArgIsLastNamedArgument for clarity
Update the variable and description to reflect its meaning and align with the corresponding warning diagnostic message
---
clang/lib/Sema/SemaChecking.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index e99e30d75df94..c8e8cb6f4c150 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -4867,14 +4867,14 @@ bool Sema::BuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall) {
// current function or method. In C23 mode, if the second argument is an
// integer constant expression with value 0, then we don't bother with this
// check.
- bool SecondArgIsLastNamedArgument = false;
+ bool SecondArgIsLastNonVariadicArgument = false;
const Expr *Arg = TheCall->getArg(1)->IgnoreParenCasts();
if (std::optional<llvm::APSInt> Val =
TheCall->getArg(1)->getIntegerConstantExpr(Context);
Val && LangOpts.C23 && *Val == 0)
return false;
- // These are valid if SecondArgIsLastNamedArgument is false after the next
+ // These are valid if SecondArgIsLastNonVariadicArgument is false after the next
// block.
QualType Type;
SourceLocation ParamLoc;
@@ -4882,7 +4882,7 @@ bool Sema::BuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall) {
if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(Arg)) {
if (const ParmVarDecl *PV = dyn_cast<ParmVarDecl>(DR->getDecl())) {
- SecondArgIsLastNamedArgument = PV == LastParam;
+ SecondArgIsLastNonVariadicArgument = PV == LastParam;
Type = PV->getType();
ParamLoc = PV->getLocation();
@@ -4891,7 +4891,7 @@ bool Sema::BuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall) {
}
}
- if (!SecondArgIsLastNamedArgument)
+ if (!SecondArgIsLastNonVariadicArgument)
Diag(TheCall->getArg(1)->getBeginLoc(),
diag::warn_second_arg_of_va_start_not_last_non_variadic_param);
else if (IsCRegister || Type->isReferenceType() ||
More information about the cfe-commits
mailing list