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: unassignedclangb...@nondot.org
          Reporter: m_en...@cs.uni-kl.de
                CC: kli...@google.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

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
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to