summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/WhitespaceManager.h
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2017-08-25 19:14:53 +0000
committerDaniel Jasper <djasper@google.com>2017-08-25 19:14:53 +0000
commit4917af67b6a51b5df2f97e1c6e7ce3ee4899c4c8 (patch)
tree4eed8d73c9d6a8cdbaa73f2ecdae2094e53bb1f0 /clang/lib/Format/WhitespaceManager.h
parent61995364defde42d8dc472373d51f82c8bed90b7 (diff)
downloadbcm5719-llvm-4917af67b6a51b5df2f97e1c6e7ce3ee4899c4c8.tar.gz
bcm5719-llvm-4917af67b6a51b5df2f97e1c6e7ce3ee4899c4c8.zip
[Format] Invert nestingAndIndentLevel pair in WhitespaceManager used for
alignments Indent should be compared before nesting level to determine if a token is on the same scope as the one we align with. Because it was inverted, clang-format sometimes tried to align tokens with tokens from outer scopes, causing the assert(Shift >= 0) to fire. This fixes bug #33507. Patch by Beren Minor, thank you! llvm-svn: 311792
Diffstat (limited to 'clang/lib/Format/WhitespaceManager.h')
-rw-r--r--clang/lib/Format/WhitespaceManager.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Format/WhitespaceManager.h b/clang/lib/Format/WhitespaceManager.h
index 548bb18c588..98a2071cf4f 100644
--- a/clang/lib/Format/WhitespaceManager.h
+++ b/clang/lib/Format/WhitespaceManager.h
@@ -154,12 +154,11 @@ public:
const Change *StartOfBlockComment;
int IndentationOffset;
- // A combination of nesting level and indent level, which are used in
+ // A combination of indent level and nesting level, which are used in
// tandem to compute lexical scope, for the purposes of deciding
// when to stop consecutive alignment runs.
- std::pair<unsigned, unsigned>
- nestingAndIndentLevel() const {
- return std::make_pair(Tok->NestingLevel, Tok->IndentLevel);
+ std::pair<unsigned, unsigned> indentAndNestingLevel() const {
+ return std::make_pair(Tok->IndentLevel, Tok->NestingLevel);
}
};
OpenPOWER on IntegriCloud