[cfe-dev] Clang Format: Add option to align types?

Marcus Johnson via cfe-dev cfe-dev at lists.llvm.org
Wed Oct 10 08:03:40 PDT 2018


Another issue that we should handle, tho tangential is that preprocessor blocks aren't formatted properly at all.

Example:

#if (defined(__UNIX__))
#define _FILE_OFFSET_BITS 64
#elif (defined _WIN32)
#define _UNICODE
#endif

and let's say we're compiling on a UNIX platform, so the first branch of the preprocessor directive is enabled, but not the second.

Only the enabled block would actually be formatted, the disabled block is completely ignored.

I'm not sure if this is just because the formatter is running after the preprocessor, or if it's a lot deeper than that, and Clang is removing the unavailable preprocessor tokens before anyone else has access to it?

if it's the latter, it could require a LOT of work to make it right...


More information about the cfe-dev mailing list