Skip to content
Commit 985a72b6 authored by Takuya Shimizu's avatar Takuya Shimizu
Browse files

[clang][Diagnostics] Provide source range to integer-overflow warnings

BEFORE:

```
overflow.cpp:1:21: warning: overflow in expression; result is -2147483648 with type 'int' [-Winteger-overflow]
    1 | int x = __INT_MAX__ + 1 + 3;
      |                     ^
overflow.cpp:2:9: warning: overflow in expression; result is -2147483648 with type 'int' [-Winteger-overflow]
    2 | int a = -(1 << 31) + 1;
      |         ^
```
AFTER:

```
overflow.cpp:1:21: warning: overflow in expression; result is -2147483648 with type 'int' [-Winteger-overflow]
    1 | int x = __INT_MAX__ + 1 + 3;
      |         ~~~~~~~~~~~~^~~
overflow.cpp:2:9: warning: overflow in expression; result is -2147483648 with type 'int' [-Winteger-overflow]
    2 | int a = -(1 << 31) + 1;
      |         ^~~~~~~~~~
```

Reviewed By: tbaeder
Differential Revision: https://reviews.llvm.org/D157383
parent f471b497
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment