summaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-06-06 13:49:04 +0000
committerDaniel Jasper <djasper@google.com>2014-06-06 13:49:04 +0000
commitb3482791029bb619a7d561d3caa239aa47b60b5f (patch)
tree6de24bfbee91e6d8b66f4fcada04a3c5bf7ad901 /lib/Format/Format.cpp
parent71f6fb1fd83ae924abf9b090a039df97a0ba6da6 (diff)
downloadclang-b3482791029bb619a7d561d3caa239aa47b60b5f.tar.gz
clang-b3482791029bb619a7d561d3caa239aa47b60b5f.tar.bz2
clang-b3482791029bb619a7d561d3caa239aa47b60b5f.tar.xz
clang-format: Fix incorrect indentation.
Before (JavaScript example, but can extend to other languages): return { a: 'E', b: function() { return function() { f(); // This is wrong. }; } }; After: return { a: 'E', b: function() { return function() { f(); // This is better. }; } }; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210334 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index ba87b87dd0..f497126950 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1164,7 +1164,8 @@ private:
return true;
if (NewLine) {
- int AdditionalIndent = 0;
+ int AdditionalIndent =
+ State.FirstIndent - State.Line->Level * Style.IndentWidth;
if (State.Stack.size() < 2 ||
!State.Stack[State.Stack.size() - 2].JSFunctionInlined) {
AdditionalIndent = State.Stack.back().Indent -