[PATCH] D100959: [AsmParser][SystemZ][z/OS] Use updated framework in AsmLexer to accept special tokens as Identifiers

Anirudh Prasad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 08:04:33 PDT 2021


anirudhp added inline comments.


================
Comment at: llvm/include/llvm/MC/MCAsmInfo.h:207-208
+  /// a string to be lexed as an AsmToken::Identifier.
+  /// If the CommentString is also set to "#", setting this option will have
+  /// no effect, and the string will be lexed as a comment.
+  /// Defaults to false.
----------------
anirudhp wrote:
> epastor wrote:
> > Is there a place where we could add a test for this behavior, if it's how we want this to behave? Is there some natural environment/configuration where we expect the CommentString to be set to "#" while AllowHashAtStartOfIdentifier is also true?
> Sure, I'll update the unit test to test the interaction between the permutations of the two attributes. 
> 
> By default, CommentString is set to `#`. But there's another point here. Whenever a comment string starts with `#` it will be attempted to be lexed as a comment irrespective of what `CommentString` is set to because the Lexer currently lexes strings that start with `#` as a possible comment. This is now guarded by the `AllowAdditionalComments` attribute in MCAsmInfo.h.
> 
> So, if `AllowHashAtStartOfIdentifier` is set to true, then it will be only lexed as an Identifier, if it is not already lexed as a possible comment. If, under the current Lexer's rules, it is possible to be lexed as a comment, it will be done so (and not as an Identifier)
I have added a few more tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100959/new/

https://reviews.llvm.org/D100959



More information about the llvm-commits mailing list