================
@@ -1156,6 +1156,26 @@ bool SemaARM::CheckARMBuiltinExclusiveCall(const 
TargetInfo &TI,
   return false;
 }
 
+static bool checkFPMScaleIfConstant(Sema &S, CallExpr *Call, unsigned ArgNum,
+                                    int64_t Low, int64_t High) {
+  Expr *Arg = Call->getArg(ArgNum);
+
+  if (Arg->isTypeDependent() || Arg->isValueDependent())
+    return false;
+
+  std::optional<llvm::APSInt> Value = Arg->getIntegerConstantExpr(S.Context);
+
+  // Runtime value: accept it.
+  if (!Value)
+    return false;
+
+  if (*Value < Low || *Value > High)
+    return S.Diag(Call->getBeginLoc(), diag::err_argument_invalid_range)
----------------
CarolineConcatto wrote:

Just in case :
Is warn_argument_invalid_range is marked DefaultError? So it already behaves as 
an error by default, the user could downgrade it to just warning thought.


https://github.com/llvm/llvm-project/pull/227722
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to