https://bugs.llvm.org/show_bug.cgi?id=41944

            Bug ID: 41944
           Summary: Rewriter::getRangeSize wrong on Comments
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: libclang
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

I registered a CommentHandler::HandleComment(Preprocessor & PP, SourceRange
Comment) to the preprocessor.

When it is called and I ask Rewriter::getRangeSize(Comment, /* any options */)
about the size, it is wrong if the comment is followed by another token
immediately.

Case 1: int x = 5 /* test */ ;
Case 2: int y = 5 /* test */;

In case 1, everything works fine.
In case 2, however, the semicolon is reported within the size, which is caused
by the Lexer::MeasureTokenLength call in getRangeSize.

So either Rewriter::getRangeSize or Lexer::MeasureTokenLength is messing things
up here. Unfortunately I'm not deep enough in the code to narrow it down any
further.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to