Closed llvmbot closed 5 years ago
Source file is:
% cat $FILE
Parse and save the tokens/skipping ranges:
% ./c-index-test -test-annotate-tokens=$FILE:1:1:4:1 $FILE > /tmp/1
Reparse and do the same:
% CINDEXTEST_EDITING=1 ./c-index-test -test-annotate-tokens=$FILE:1:1:4:1 $FILE > /tmp/2
Compare:
% diff -u /tmp/{1,2} --- /tmp/1 2017-10-17 08:31:36.391408230 +0200 +++ /tmp/2 2017-10-17 08:32:01.215708503 +0200 @@ -1,4 +1,3 @@ -Skipping: [1:1 - 3:7] Punctuation: "#" [1:1 - 1:2] preprocessing directive= Identifier: "ifdef" [1:2 - 1:7] preprocessing directive= Identifier: "SOMETHING" [1:8 - 1:17] preprocessing directive= zsh: exit 1 colordiff -u /tmp/{1,2} %
==> Ops, skipped ranges are removed after reparse.
Looks like this is fixed in clang-8.
Perhaps my patch at https://reviews.llvm.org/D20124 is of interest.
Extended Description
Source file is:
% cat $FILE
ifdef SOMETHING
include
endif
Parse and save the tokens/skipping ranges:
Reparse and do the same:
Compare:
==> Ops, skipped ranges are removed after reparse.