Commit 8dfd12f
committed
CxxPreprocessor: unitilize com.sonar.sslr.api.Preprocessor::init()
* the check, if CxxPreprocessor was about to start preprocessing
a new file was previously done in CxxPreprocessor::process()
* Preprocessor::process() is called multiple time per file
* in the words case it's called for each Token
* there is a special initialization method Preprocessor:init(),
which is called once per file.
See com.sonar.sslr.impl.Lexer::lex(Reader reader)
* override this method and put the is-new-file logic to
CxxPreprocessor::init()
* we don't break any logic
we still rely on the current context file, which is set in the
proper order
1. org.sonar.squidbridge.AstScanner::scanFiles() set the current
context file
2. parser.parse(file) -> lexer.lex(file) -> ... lex(reader)
3. preprocessor.init();1 parent 2ff6f41 commit 8dfd12f
File tree
1 file changed
+14
-11
lines changed- cxx-squid/src/main/java/org/sonar/cxx/preprocessor
1 file changed
+14
-11
lines changedLines changed: 14 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
456 | 452 | | |
457 | 453 | | |
458 | 454 | | |
| |||
465 | 461 | | |
466 | 462 | | |
467 | 463 | | |
468 | | - | |
| 464 | + | |
469 | 465 | | |
470 | 466 | | |
471 | 467 | | |
472 | 468 | | |
473 | | - | |
| 469 | + | |
474 | 470 | | |
475 | 471 | | |
476 | 472 | | |
| |||
526 | 522 | | |
527 | 523 | | |
528 | 524 | | |
529 | | - | |
| 525 | + | |
530 | 526 | | |
531 | 527 | | |
532 | 528 | | |
| |||
536 | 532 | | |
537 | 533 | | |
538 | 534 | | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
539 | 542 | | |
540 | 543 | | |
541 | 544 | | |
| |||
0 commit comments