[clang] [clang][sema][NFC] Clean up builtin arg checking functions (PR #158615)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 15 05:40:07 PDT 2025
================
@@ -5886,23 +5886,27 @@ bool Sema::BuiltinOSLogFormat(CallExpr *TheCall) {
return false;
}
-bool Sema::BuiltinConstantArg(CallExpr *TheCall, int ArgNum,
+bool Sema::BuiltinConstantArg(CallExpr *TheCall, unsigned ArgNum,
llvm::APSInt &Result) {
Expr *Arg = TheCall->getArg(ArgNum);
- DeclRefExpr *DRE =cast<DeclRefExpr>(TheCall->getCallee()->IgnoreParenCasts());
- FunctionDecl *FDecl = cast<FunctionDecl>(DRE->getDecl());
- if (Arg->isTypeDependent() || Arg->isValueDependent()) return false;
+ if (Arg->isTypeDependent() || Arg->isValueDependent())
+ return false;
std::optional<llvm::APSInt> R;
- if (!(R = Arg->getIntegerConstantExpr(Context)))
+ if (!(R = Arg->getIntegerConstantExpr(Context))) {
----------------
tbaederr wrote:
I definitely prefer this version but the previous one is used a few times in `SemaChecking.cpp`, probably copied around.
https://github.com/llvm/llvm-project/pull/158615
More information about the cfe-commits
mailing list