diff options
author | Daniel Jasper <djasper@google.com> | 2015-02-08 09:34:49 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-02-08 09:34:49 +0000 |
commit | 29d39d54e7398610126f15f1f3fb97f9575a80f9 (patch) | |
tree | 0e510d14fb29848b45841ebb110d2cd2e7838f93 /clang/lib/Format | |
parent | 23a485a4ed803e4870e4b85546ae678acfdbd682 (diff) | |
download | bcm5719-llvm-29d39d54e7398610126f15f1f3fb97f9575a80f9.tar.gz bcm5719-llvm-29d39d54e7398610126f15f1f3fb97f9575a80f9.zip |
clang-format: Correctly mark preprocessor lines in child blocks.
This prevents contracting:
auto lambda = []() {
int a = 2
#if A
+ 2
#endif
;
};
into:
auto lambda = []() { int a = 2
#if A + 2
#endif ; };
Which is obviously BAD.
This fixes llvm.org/PR22496.
llvm-svn: 228522
Diffstat (limited to 'clang/lib/Format')
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 4bfdaaf8c3a..19e591b7031 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1677,8 +1677,7 @@ void UnwrappedLineParser::readToken() { (FormatTok->HasUnescapedNewline || FormatTok->IsFirst)) { // If there is an unfinished unwrapped line, we flush the preprocessor // directives only after that unwrapped line was finished later. - bool SwitchToPreprocessorLines = - !Line->Tokens.empty() && CurrentLines == &Lines; + bool SwitchToPreprocessorLines = !Line->Tokens.empty(); ScopedLineState BlockState(*this, SwitchToPreprocessorLines); // Comments stored before the preprocessor directive need to be output // before the preprocessor directive, at the same level as the |