]> granicus.if.org Git - clang/commit
Fix crasher bug.
authorManuel Klimek <klimek@google.com>
Tue, 18 Mar 2014 11:22:45 +0000 (11:22 +0000)
committerManuel Klimek <klimek@google.com>
Tue, 18 Mar 2014 11:22:45 +0000 (11:22 +0000)
commitc99e001486959e6b7e3a49475bd64348504e0384
tree445ec50ff667e3742a22efee8eb173f79bd1394d
parente26232b0a40e4a3ae5ed331cc862faf3a50b17d3
Fix crasher bug.

Due to not resetting the fake rparen data on the token when iterating
over annotated lines, we would pop the last element of the paren stack.

This patch fixes the underlying root cause, and makes the code more
robust against similar problems in the future:
- reset the first token when iterating on the same annotated lines due
  to preprocessor branches
- never pop the last element from the paren stack, so we do not crash,
  but rather incorrectly format
- add assert()s so we can figure out if our assumptions are violated

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204140 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/ContinuationIndenter.cpp
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTest.cpp