Commit 161d7b6
committed
[clang-scan-deps] Fix "unterminated conditional directive" bug
`clang-scan-deps` threw "unterminated conditional directive" error
falsely on the following example:
```
#if defined(__TEST_DUMMY2)
#pragma GCC warning \
"Hello!"
#else
#pragma GCC error \
"World!"
#endif // defined(__TEST_DUMMY2)
```
The issue comes from PR llvm#143950, where the flag `LastNonWhitespace`
does not correctly represent the state in the example above. The PR
aimed to support that a line-continuation can be followed by
whitespaces. This fix uses a more straightforward but less efficient
way to do the same thing---it looks back for a line-continuation and
skips any number of whitespaces before that.
rdar://1537421861 parent 0bfa0bc commit 161d7b6
File tree
2 files changed
+52
-8
lines changed- clang
- lib/Lex
- unittests/Lex
2 files changed
+52
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
422 | | - | |
| 422 | + | |
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
456 | | - | |
457 | | - | |
458 | 456 | | |
459 | 457 | | |
460 | 458 | | |
| |||
467 | 465 | | |
468 | 466 | | |
469 | 467 | | |
470 | | - | |
471 | | - | |
472 | 468 | | |
473 | 469 | | |
474 | 470 | | |
| |||
480 | 476 | | |
481 | 477 | | |
482 | 478 | | |
483 | | - | |
484 | | - | |
485 | | - | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
486 | 499 | | |
487 | 500 | | |
488 | 501 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
880 | 880 | | |
881 | 881 | | |
882 | 882 | | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
883 | 914 | | |
884 | 915 | | |
885 | 916 | | |
| |||
0 commit comments