================
@@ -12141,8 +12141,15 @@ static std::optional<IntRange> 
TryGetExprRange(ASTContext &C, const Expr *E,
 
   // Try a full evaluation first.
   Expr::EvalResult result;
-  if (E->EvaluateAsRValue(result, C, InConstantContext))
+  if (E->EvaluateAsRValue(result, C, InConstantContext)) {
+    // GetValueRange only handles integer-like values.
+    // Return nullopt for unsupported types.
+    if (!result.Val.isInt() && !result.Val.isVector() &&
----------------
AaronBallman wrote:

This predicate is going to be very hard to maintain as `APValue` changes over 
time. I think it'd be better to change `GetValueRange` to return an 
`optional<IntRange>` 

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

Reply via email to