diff options
author | Manuel Klimek <klimek@google.com> | 2013-02-08 19:53:32 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2013-02-08 19:53:32 +0000 |
commit | d076dcd54f21c5bb93562e9fc8516c0668b72842 (patch) | |
tree | 5e0abaaa178d27ac2ac43f8358be4d7eaad638a7 /clang/lib/Format/Format.cpp | |
parent | ca3ed7230de97dc0b54dc6f7b576dc1d6bf097d0 (diff) | |
download | bcm5719-llvm-d076dcd54f21c5bb93562e9fc8516c0668b72842.tar.gz bcm5719-llvm-d076dcd54f21c5bb93562e9fc8516c0668b72842.zip |
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;'.
llvm-svn: 174737
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 0797fb8da4a..299a8558b97 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/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; } |