[PATCH] D41552: [MC] - Teach llvm-mc to handle comdats whose names are numbers.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 24 00:22:33 PST 2017


>LGTM
>
>A nice followup would be to make sure we produce an error if we can't
>parse to the end of the line.
>
>Cheers,
>Rafael

MC actually has code that checks for reaching of EOL:
https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCParser/ELFAsmParser.cpp#L575

Issue is that for minor group of function calls (including parseGroup() call, lines 561-571),
parser returns true. What means error condition. It does not return TokError,
and that looks fine because intention is to propogate the existent error
from the deep I think.

That does not always work good though, for example parseIdentifier() may return true (so error),
and do not set error condition. Because there is code that want to continue parsing
after that, for example:
https://github.com/llvm-mirror/llvm/blob/master/lib/MC/MCParser/AsmParser.cpp#L1066
And looks  'parseIdentifier()' calls never set error conditions by themselves.

What I think we can do is to ensure that we either return true when have error condition,
or return TokError from these functions to set it. (or false when there is no errors).

I prepared patch for parseGroup(): https://reviews.llvm.org/D41559

George.


More information about the llvm-commits mailing list