From d076dcd54f21c5bb93562e9fc8516c0668b72842 Mon Sep 17 00:00:00 2001 From: Manuel Klimek Date: Fri, 8 Feb 2013 19:53:32 +0000 Subject: 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 --- clang/lib/Format/Format.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/lib/Format') 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 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; } -- cgit v1.2.3