================
@@ -17132,6 +17132,9 @@ static bool ConvertAPValueToString(const APValue &V, 
QualType T,
         case BuiltinType::WChar_U: {
           unsigned TyWidth = Context.getIntWidth(T);
           assert(8 <= TyWidth && TyWidth <= 32 && "Unexpected integer width");
+          if (V.getInt() >= (1 << 64)) {
----------------
ShamrockLee wrote:

`V.getInt()` could also be negative. Sorry for my imprecise  comment in 
https://github.com/llvm/llvm-project/issues/71675#issuecomment-1862186784

Combining the above review suggestions, the following should do the trick:

```suggestion
          if (V.getInt() > std::numeric_limits<uint64_t>::max() || V.getInt() < 
std::numeric_limits<int64_t>::min()) {
```

In addition, this changes doesn't seem to consider the situation where the 
value type is not char-like, and these char-like types wouldn't have such wide 
value. Maybe we should move this condition down right before the line

```c++
      V.getInt().toString(Str);
```

https://github.com/llvm/llvm-project/pull/75902
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to