urnathan added a comment.

I can;t really tell what you're doing.  C++20 lexes import (&module) 
declarations as preprocessor directives.  the parser must also recognize only 
such declarations that came through from lexing such directives.  It is 
unrelated to #import.  GCC's implementation drops the preprocessor into 
directive mode if it sees 'module' or 'import' (optionally preceeded by 
'export') at the start of a line[1].  Those keywords are converted to 
unspellable internal tokens that the parser recognizes to parse module and 
import declarations.  An end-of-pragma token is injected at the end-of-line, 
and again the parser expects that after the terminating ';'. (it's leveraging 
the pragma machinery)

[1] it also peeks the next non-white-space token for '<', '", or 
<begin-identifier-char>, as specified in the std.

occurrences of 'module' and 'import' that are not lexed that way go through as 
regular identifier tokens, not keywords.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122885

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to