[PATCH] D60308: Leave alone the semicolon after the MacroBlockBegin name
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 5 04:16:52 PDT 2019
sammccall added a comment.
The documentation examples of MacroBlockBegin are:
/// A regular expression matching macros that start a block.
/// \code
/// # With:
/// MacroBlockBegin: "^NS_MAP_BEGIN|\
/// NS_TABLE_HEAD$"
/// MacroBlockEnd: "^\
/// NS_MAP_END|\
/// NS_TABLE_.*_END$"
///
/// NS_MAP_BEGIN
/// foo();
/// NS_MAP_END
///
/// NS_TABLE_HEAD
/// bar();
/// NS_TABLE_FOO_END
///
/// # Without:
/// NS_MAP_BEGIN
/// foo();
/// NS_MAP_END
///
/// NS_TABLE_HEAD
/// bar();
/// NS_TABLE_FOO_END
/// \endcode
It doesn't appear that a semicolon after the macro is expected, so the semicolon is treated as an empty statement inside the block.
There are some reasonable arguments for this. semicolons go after statement-like things, block introducers are not statement-like in general. Even if the particular implementation requires a semicolon (e.g. `glBegin()`), it breaks abstraction to make the user type it, it should be part of the macro instead.
If this doesn't work for your codebase, can you share some details about the macro (what it's for and what it expands to) that motivates this change?
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60308/new/
https://reviews.llvm.org/D60308
More information about the cfe-commits
mailing list