[llvm-bugs] [Bug 25796] New: wrong brace handling

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 10 01:50:57 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25796

            Bug ID: 25796
           Summary: wrong brace handling
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gonzalobg88 at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

Given:

template<typename T, int N>
struct vector { 
  vector(std::initializer_list<int>) {}
};


The following:

int main() {
  {
    {
       vector<int, 3> a = {1, 2, 3};
       vector<int, 3> b = {1, 2, 3};
    }
  }
  return 0;
}

Is wrongly indented to: 

int main() {
  {{vector<int, 3> a = {1, 2, 3};
  vector<int, 3> b   = {1, 2, 3};
}
}
  return 0;
}

Using the configuration file (below).


It should probably be something like:

int main() {
  {
    {
      vector<int, 3> a = {1, 2, 3};
      vector<int, 3> b = {1, 2, 3};
    }
  }
  return 0;
}

Configuration file:

BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: true
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 1
ContinuationIndentWidth: 1
Cpp11BracedListStyle: true
DerivePointerBinding: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: ['RANGES_FOR', 'BOOST_FOREACH']
IndentCaseLabels: true
IndentFunctionDeclarationAfterType: true
IndentWidth: 2
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: false
Language: Cpp
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 10
PointerAlignment: Left
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInAngles:  false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 2
UseTab: Never

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151210/fbae29b6/attachment.html>


More information about the llvm-bugs mailing list