aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-02-08 19:53:32 +0000
committerManuel Klimek <klimek@google.com>2013-02-08 19:53:32 +0000
commit52635ff9fb530dfdfc6a94e52a2270bf1bb8346b (patch)
treec09d57e13169f24069b205c57a512a40336c2a46 /lib/Format/Format.cpp
parent8185674528423e2504a1fae35c28c24104846510 (diff)
Fix indentation-detection at indent level 0.
This correctly formats: { a; } where { is incorrectly indented by 2, but is at level 0, when reformatting only 'a;'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 0797fb8da4..299a8558b9 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -977,10 +977,10 @@ private:
/// that level is unknown.
unsigned GetIndent(const std::vector<int> IndentForLevel,
unsigned Level) {
- if (Level == 0)
- return 0;
if (IndentForLevel[Level] != -1)
return IndentForLevel[Level];
+ if (Level == 0)
+ return 0;
return GetIndent(IndentForLevel, Level - 1) + 2;
}