[PATCH] D53840: Preprocessing support in tablegen

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 5 02:58:04 PST 2018


nhaehnle added a comment.

In https://reviews.llvm.org/D53840#1282880, @vzakhari wrote:

> In https://reviews.llvm.org/D53840#1282024, @nhaehnle wrote:
>
> > I have to say I'm feeling a bit ambivalent about this. I'd say it would be nicer to have a mechanism that integrates with the rest of the TableGen language, but that's admittedly non-trivial. So I guess this approach is okay.
>
>
> Thank you for the prompt reply, Nikolai!  Yes, I decided to keep the preprocessing aside to minimize changes in the actual lexing.
>
> > The handling of end-of-files is a bit wonky. Have you considered just returning EOF from getNextChar at end of file, even if there's a parent file, and changing the EOF case in LexToken to just loop (or tail-recurse, I suppose) if it was the EOF of an included file?
>
> This is possible, though, EOF handling will be required in SkipCComment() and LexBracket().  If you agree with me changing these routines, I can do this.  Returning EOF from getNextChar() allows handling cross-file C-style comments and bracket contructs - I can disallow these use-cases or keep supporting them.  What do you think I should do?


I think adding EOF handling there is fine. C-style comments across files should be forbidden IMO. Same for LexBracket, I think; that code is for `[[ code blocks ]]`, and allowing those across files seems very odd indeed. If there's genuinely a use case for it, it's always easier to allow it later than going in the reserve direction.


Repository:
  rL LLVM

https://reviews.llvm.org/D53840





More information about the llvm-commits mailing list