Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
Qt Creator 4.9.0-beta1
-
None
-
Kubuntu 18.10 x86_64
Description
We have a custom logging library in our project. Emitting a log record involves two macros, defined similar to the following:
#define LOG(lg, lvl) \ do\ {\ logging::logger& __lg = (lg);\ if (logging::message __message = __lg.check_filters(logging::level::lvl))\ {\ logging::formatting_stream __strm = logging::get_formatting_stream();\ __strm.stream #define LOG_END \ ;\ __strm.stream.flush();\ __lg.send_message(__message, __strm.result.c_str(), __strm.result.size());\ }\ }\ while (false)
In the code one uses these macros like this:
LOG(lg, info) << "Hello" LOG_END;
The problem is that with ClangFormat plugin enabled, whenever I type the opening brace after `LOG` or semicolon after `LOG_END` QtCreator removes any empty lines before this logging code.
This also happens when I type `if`, `while` or `switch` statements and an opening brace - QtCreator removes empty lines before the line I'm typing. Interestingly, the macros above are defined in terms of `do`/`while`, which, when typed manually, does not exhibit this behavior. Instead, it shows a different bug: the `while` line gets indented one level deeper as you type the parenthesis, and then indented back as you type the semicolon. To reproduce, try typing this and watch the indentation of the last line as you type it:
do { } while ();
This is reproducible with QtCreator 4.9.0 beta2.
Attachments
Issue Links
- duplicates
-
QTCREATORBUG-22043 clang format(?) removes empty lines above lines with angle brackets
-
- Closed
-