Skip to content

Fixes for clang-format - #53

Open
aleclearmind wants to merge 1 commit into
revng:developfrom
aleclearmind:feature/clang-format
Open

Fixes for clang-format#53
aleclearmind wants to merge 1 commit into
revng:developfrom
aleclearmind:feature/clang-format

Conversation

@aleclearmind

Copy link
Copy Markdown
Contributor

No description provided.

parseEnum() only handled a single function-like macro immediately after
'enum' (via the existing parseParens call in the name-scanning loop). A
macro preceding another macro, e.g.

    enum _PACKED _ENUM_UNDERLYING(int64_t) name { ... };

made the parser bail at the '(' of the second macro (or hit the "two
identifiers in a row" elaborated-return-type heuristic), so the enum was
not recognized: the space before '{' was dropped and the body collapsed.

    enum _PACKED _ENUM_UNDERLYING(int64_t) name{ ... };

This commit skips any run of attribute or typename macros (as configured
via `AttributeMacros`/`TypenameMacros`, including function-like ones)
between `enum` and the enum name before scanning for the name. Using the
configured macro token types avoids misclassifying an elaborate return
type (`enum Color foo() {`) or an enum-typed variable (`enum Color c
{0}`) as an enum definition.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants