[PATCH] D32701: [LLVM][inline-asm][Altmacor] Altmacro string delimiter '<..>'
Renato Golin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 3 04:07:22 PDT 2017
rengolin added inline comments.
================
Comment at: lib/MC/MCParser/AsmParser.cpp:1201
+/// character.
+bool AsmParser::isAltmacroString(SMLoc &StrLoc, SMLoc &EndLoc) {
+ assert((StrLoc.getPointer() != NULL) &&
----------------
rengolin wrote:
> I'd add single quotes at the same time.
>
> This seems like a simple addition, as you can pass the expected "ending char" as an argument, in addition to `\r\n\0`.
The problem here, IIUC, is that you could start with '<' and end with single-quote (or vice-versa) and this code would accept. Also, if you start with '<', single-quote isn't actually a terminator.
To make sure this works, you have to test four overall patterns:
- <foo,bar>
- <foo'bar>
- 'foo,bar'
- 'foo>bar'
They all have to produce a single string "foo?bar".
What I meant was something like:
bool AsmParser::isAltmacroString(SMLoc &StrLoc, SMLoc &EndLoc, const char Term) {
...
while ((*CharPtr != Term) && (*CharPtr != '\n') && (*CharPtr != '\r') && (*CharPtr != '\0')) {
CharPtr++;
}
And then down there, something like:
} else if (Lexer.IsaAltMacroMode() && Lexer.is(AsmToken::Less) && Lexer.is(AsmToken::SingleQuote) &&
isAltmacroString(StrLoc, EndLoc, Lex()) {
or something.
https://reviews.llvm.org/D32701
More information about the llvm-commits
mailing list