forked from OSchip/llvm-project
Added a comment and another test for the UT_ForIndentation option
llvm-svn: 191530
This commit is contained in:
parent
8ba68f6802
commit
45dc1b2fd3
|
@ -290,6 +290,8 @@ void WhitespaceManager::appendIndentText(std::string &Text,
|
||||||
case FormatStyle::UT_ForIndentation:
|
case FormatStyle::UT_ForIndentation:
|
||||||
if (WhitespaceStartColumn == 0) {
|
if (WhitespaceStartColumn == 0) {
|
||||||
unsigned Indentation = IndentLevel * Style.IndentWidth;
|
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)
|
if (Indentation > Spaces)
|
||||||
Indentation = Spaces;
|
Indentation = Spaces;
|
||||||
unsigned Tabs = Indentation / Style.TabWidth;
|
unsigned Tabs = Indentation / Style.TabWidth;
|
||||||
|
|
|
@ -5932,7 +5932,19 @@ TEST_F(FormatTest, ConfigurableUseOfTab) {
|
||||||
"\t/*\n"
|
"\t/*\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\t*/\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;
|
Tab.UseTab = FormatStyle::UT_Never;
|
||||||
EXPECT_EQ("/*\n"
|
EXPECT_EQ("/*\n"
|
||||||
|
|
Loading…
Reference in New Issue