================ @@ -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))) { ---------------- Fznamznon wrote:
This is so unusual, I wonder if we can just ```suggestion std::optional<llvm::APSInt> R = Arg->getIntegerConstantExpr(Context); if (!R) { // or has_value ... } ``` https://github.com/llvm/llvm-project/pull/158615 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits