RFC: Editor Placeholder Support


I would like to add support for editor placeholder to Clang’s lexer. The placeholder tokens will function similarly to the placeholders in the Swift compiler:

  • An editor placeholder token starts with ‘<#’ and ends with ‘#>’.
  • When lexing the source that contains placeholders:
  • Clang will report an error when it finds the placeholder token.
  • Then the lexer will treat the placeholders as if they were expanded, e.g. given:

void Class::method(<#int x#>)

The parser will see the tokens that correspond to the following source:

void Class::method(int x)

Do you have any feedback/requests? Should placeholders be recognized at all times or just when Clang is used by the editor?