Commit 985a72b
committed
[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/D1573831 parent f471b49 commit 985a72b
File tree
3 files changed
+15
-5
lines changed- clang
- lib/AST
- Interp
- test/Misc
3 files changed
+15
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2798 | 2798 | | |
2799 | 2799 | | |
2800 | 2800 | | |
2801 | | - | |
| 2801 | + | |
2802 | 2802 | | |
2803 | 2803 | | |
2804 | 2804 | | |
| |||
13643 | 13643 | | |
13644 | 13644 | | |
13645 | 13645 | | |
13646 | | - | |
| 13646 | + | |
13647 | 13647 | | |
13648 | 13648 | | |
13649 | 13649 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
| 274 | + | |
| 275 | + | |
275 | 276 | | |
276 | 277 | | |
277 | 278 | | |
| |||
478 | 479 | | |
479 | 480 | | |
480 | 481 | | |
481 | | - | |
| 482 | + | |
| 483 | + | |
482 | 484 | | |
483 | 485 | | |
484 | 486 | | |
| |||
531 | 533 | | |
532 | 534 | | |
533 | 535 | | |
534 | | - | |
| 536 | + | |
| 537 | + | |
535 | 538 | | |
536 | 539 | | |
537 | 540 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
0 commit comments