r178779 - Fix bug discovered with address sanitizer.

Daniel Jasper djasper at google.com
Thu Apr 4 12:31:01 PDT 2013


Author: djasper
Date: Thu Apr  4 14:31:00 2013
New Revision: 178779

URL: http://llvm.org/viewvc/llvm-project?rev=178779&view=rev
Log:
Fix bug discovered with address sanitizer.

Now, this works again with an empty stack.

Modified:
    cfe/trunk/lib/Format/Format.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=178779&r1=178778&r2=178779&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Thu Apr  4 14:31:00 2013
@@ -927,11 +927,11 @@ private:
     }
 
     // Remove scopes created by fake parenthesis.
-    unsigned VariablePos = State.Stack.back().VariablePos;
     for (unsigned i = 0, e = Current.FakeRParens; i != e; ++i) {
+      unsigned VariablePos = State.Stack.back().VariablePos;
       State.Stack.pop_back();
+      State.Stack.back().VariablePos = VariablePos;
     }
-    State.Stack.back().VariablePos = VariablePos;
 
     if (Current.is(tok::string_literal)) {
       State.StartOfStringLiteral = State.Column;





More information about the cfe-commits mailing list