As X86MCAsmInfoDarwin uses '##' as CommentString although a single '#' starts a comment a workaround for this special case is added.
Fixes divisions in constant expressions for the AArch64 assembler and other targets which use '//' as CommentString.
Differential D4597
MC: AsmLexer: handle multi-character CommentStrings correctly Authored by jannau on Jul 19 2014, 2:19 PM.
Details
Diff Detail Event Timeline
Comment Actions adds isAtStartOfComment(const char *Ptr) and uses it to handle multi-character CommentStrings. Comment Actions The tests feel a bit insufficient for such a change. You have a special case for Darwin yet no test for it? Is there a set of existing test cases that cover the various other cases of string comment indicators?
Comment Actions I've removed the old isAtStartOfComment(const char) and optimized the replacement for the single char comment string case. The workaround for "##" in X86MCAsmInfoDarwin is still there since I'm unsure how I should solve that properly. The least bad solution I found is using different CommentStrings for output and parsing. I don't feel comfortable enough to decide how to solve this. Comment Actions The MCParser portion of the change looks much better now. I am still a bit concerned about the testing. Can you at least add a test case for the special case of Darwin?
Comment Actions added explicit tests with single '#' comments for x86 darwin. A couple of existing tests will catch incorrect parsing of single '#' comments too though.
| |||||||||||||||||||||||||||||||||||||||
Isn't this not entirely true? If you have '//' as a comment character, and you are at '/', its unclear if this is a comment starter or not. I think that we should just drop this interface and take a const char * instead.