[cfe-dev] clang-format prevent formatting of macro arguments

Stefan Glaser via cfe-dev cfe-dev at lists.llvm.org
Wed May 8 13:41:10 PDT 2019


Hi,

I'm working on a project in which we use paths separated by / (forward
slash) as arguments to marco functions in C++. For instance:

DEFINE_BASECLASS(some/path/to/class);

If I run it through clang-format (7.0.0), I get the following output:

DEFINE_BASECLASS(some / path / to / class);

which then breaks the functionality of our application. I expect
clang-format interprets the forward slash character in this case as
division operator and thus adds spaces around it. Is there an option to
prevent the above formatting while still adding spaces around operators?

Thanks,
Stefan




More information about the cfe-dev mailing list