diff options
| author | Alexander Kornienko <alexfh@google.com> | 2013-09-27 16:40:11 +0000 |
|---|---|---|
| committer | Alexander Kornienko <alexfh@google.com> | 2013-09-27 16:40:11 +0000 |
| commit | 45dc1b2fd3432610668025c59441f59460349144 (patch) | |
| tree | 9877f8964f94f6d3ad5c57060cf4f1b87efe4dd4 /clang | |
| parent | 8ba68f6802de2f83e2f68e3ab884376986b521aa (diff) | |
| download | bcm5719-llvm-45dc1b2fd3432610668025c59441f59460349144.tar.gz bcm5719-llvm-45dc1b2fd3432610668025c59441f59460349144.zip | |
Added a comment and another test for the UT_ForIndentation option
llvm-svn: 191530
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Format/WhitespaceManager.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp index 802145e72d8..16d80ea429a 100644 --- a/clang/lib/Format/WhitespaceManager.cpp +++ b/clang/lib/Format/WhitespaceManager.cpp @@ -290,6 +290,8 @@ void WhitespaceManager::appendIndentText(std::string &Text, case FormatStyle::UT_ForIndentation: if (WhitespaceStartColumn == 0) { unsigned Indentation = IndentLevel * Style.IndentWidth; + // This happens, e.g. when a line in a block comment is indented less than + // the first one. if (Indentation > Spaces) Indentation = Spaces; unsigned Tabs = Indentation / Style.TabWidth; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 4c7399113d4..08b5643ac08 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -5932,7 +5932,19 @@ TEST_F(FormatTest, ConfigurableUseOfTab) { "\t/*\n" "\n" "\t*/\n" - "}", Tab)); + "}", + Tab)); + EXPECT_EQ("{\n" + "\t/*\n" + " asdf\n" + "\t*/\n" + "}", + format("{\n" + "\t/*\n" + " asdf\n" + "\t*/\n" + "}", + Tab)); Tab.UseTab = FormatStyle::UT_Never; EXPECT_EQ("/*\n" |

