[PATCH] MC: handle '//' correctly in AsmLexer::isAtStartOfComment()

Janne Grunau j at jannau.net
Sat Jul 19 15:19:50 PDT 2014


================
Comment at: lib/MC/MCParser/AsmLexer.cpp:466
@@ -464,1 +465,3 @@
+    return Char == CommentString[0] && *CurPtr == CommentString[1];
+  return Char == *CommentString;
 }
----------------
Saleem Abdulrasool wrote:
> Im not sure I like this approach.  Having the special comment string being taken care of by looking at both the user supplied input and the internal pointer makes me uneasy.  If we want to use the internal cursor to check the current position, then drop the argument and make check purely internal.
yes, I missed that it's a public function. It shouldn't use internal state.

Changing it to or adding a

bool AsmLexer::isAtStartOfComment(const char *Ptr)

seems the best option although we still have to handle the X86MCAsmInfo.cpp special case.

http://reviews.llvm.org/D4597






More information about the llvm-commits mailing list