Skip to content

Conversation

@anforowicz
Copy link
Contributor

PTAL?

This came up in https://crrev.com/c/7253816/comment/3f283bcf_9ab0850a/
and in #109 (comment)

Some additional notes:

  • I renamed check_reserved_name to check_type_name in the 1st commit, because 1) it is called only for type names, and 2) in the 1st commit I also introduce check_name and in the 2nd commit check_fn_name
  • In report_error in the new fn check_name I kind of lie when calling tokens.set_span (the span of #[cxx_name...]'s arg is not the same as the span of the ident). But it seems to work ok for error reporting, so hopefully this is fine.

Before this commit, `cxx` wouldn't detect the problem, and later the C++
compilation would fail.  After this commit, the error is detected early.

This commit seems desirable on its own, but it also helps to build
scaffolding for enabling additional checks in follow-up commits (e.g.
allowing `operator==` for function names, but not for other
`[cxx::bridge]` API names).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant