[clang] [analyzer] Fix crashes on unusual macros in tryExpandAsInteger (PR #248108)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 2 08:57:18 PST 2026


================
@@ -69,8 +69,9 @@ Nullability getNullabilityAnnotation(QualType Type);
 
 /// Try to parse the value of a defined preprocessor macro. We can only parse
 /// simple expressions that consist of an optional minus sign token and then a
-/// token for an integer. If we cannot parse the value then std::nullopt is
-/// returned.
+/// token for an integer. If we cannot parse the value, or it is outside the
+/// target's [INT_MIN, UINT_MAX], then std::nullopt is returned. A value above
+/// INT_MAX is converted to int, so 0xFFFFFFFF yields -1.
----------------
steakhal wrote:

If it wouldn't change the overall number of lines, let's start the new sentences on new lines.
```suggestion
/// target's [INT_MIN, UINT_MAX], then std::nullopt is returned.
/// A value above INT_MAX is converted to int, so 0xFFFFFFFF yields -1.
```

https://github.com/llvm/llvm-project/pull/248108


More information about the cfe-commits mailing list