<div dir="ltr">Thanks.. I also think we should simply use in-class initializers here instead of the constructor initializers where we constantly have to fix the order.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 12, 2015 at 3:07 PM, Benjamin Kramer <span dir="ltr"><<a href="mailto:benny.kra@googlemail.com" target="_blank">benny.kra@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: d0k<br>
Date: Fri Jun 12 08:07:03 2015<br>
New Revision: 239605<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D239605-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=OrZFkXZzqx5yCdtywigPV6zmxA1jd5FJENKmRwsyJgk&s=HSTFPPIZ6nZcJc6X9el5HQa_Tr-TS_9vTB6vDQAZry4&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=239605&view=rev</a><br>
Log:<br>
[clang-format] Reorder and pack ParenState members to minimize padding<br>
<br>
sizeof(ParenState) goes from 64 bytes to 52 bytes. NFC.<br>
<br>
Modified:<br>
    cfe/trunk/lib/Format/ContinuationIndenter.h<br>
<br>
Modified: cfe/trunk/lib/Format/ContinuationIndenter.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_Format_ContinuationIndenter.h-3Frev-3D239605-26r1-3D239604-26r2-3D239605-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=OrZFkXZzqx5yCdtywigPV6zmxA1jd5FJENKmRwsyJgk&s=7qHpzP_Sc7RTc0pxVVetFaSQ1Vrk4v148OSERRxGakA&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.h?rev=239605&r1=239604&r2=239605&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Format/ContinuationIndenter.h (original)<br>
+++ cfe/trunk/lib/Format/ContinuationIndenter.h Fri Jun 12 08:07:03 2015<br>
@@ -148,15 +148,15 @@ struct ParenState {<br>
   ParenState(unsigned Indent, unsigned IndentLevel, unsigned LastSpace,<br>
              bool AvoidBinPacking, bool NoLineBreak)<br>
       : Indent(Indent), IndentLevel(IndentLevel), LastSpace(LastSpace),<br>
-        NestedBlockIndent(Indent), FirstLessLess(0),<br>
-        BreakBeforeClosingBrace(false), QuestionColumn(0),<br>
-        AvoidBinPacking(AvoidBinPacking), BreakBeforeParameter(false),<br>
-        NoLineBreak(NoLineBreak), LastOperatorWrapped(true), ColonPos(0),<br>
-        StartOfFunctionCall(0), StartOfArraySubscripts(0),<br>
+        NestedBlockIndent(Indent), FirstLessLess(0), QuestionColumn(0),<br>
+        ColonPos(0), StartOfFunctionCall(0), StartOfArraySubscripts(0),<br>
         NestedNameSpecifierContinuation(0), CallContinuation(0), VariablePos(0),<br>
-        ContainsLineBreak(false), ContainsUnwrappedBuilder(0),<br>
-        AlignColons(true), ObjCSelectorNameFound(false),<br>
-        HasMultipleNestedBlocks(false), NestedBlockInlined(false) {}<br>
+        BreakBeforeClosingBrace(false), AvoidBinPacking(AvoidBinPacking),<br>
+        BreakBeforeParameter(false), NoLineBreak(NoLineBreak),<br>
+        LastOperatorWrapped(true), ContainsLineBreak(false),<br>
+        ContainsUnwrappedBuilder(false), AlignColons(true),<br>
+        ObjCSelectorNameFound(false), HasMultipleNestedBlocks(false),<br>
+        NestedBlockInlined(false) {}<br>
<br>
   /// \brief The position to which a specific parenthesis level needs to be<br>
   /// indented.<br>
@@ -182,31 +182,9 @@ struct ParenState {<br>
   /// on a level.<br>
   unsigned FirstLessLess;<br>
<br>
-  /// \brief Whether a newline needs to be inserted before the block's closing<br>
-  /// brace.<br>
-  ///<br>
-  /// We only want to insert a newline before the closing brace if there also<br>
-  /// was a newline after the beginning left brace.<br>
-  bool BreakBeforeClosingBrace;<br>
-<br>
   /// \brief The column of a \c ? in a conditional expression;<br>
   unsigned QuestionColumn;<br>
<br>
-  /// \brief Avoid bin packing, i.e. multiple parameters/elements on multiple<br>
-  /// lines, in this context.<br>
-  bool AvoidBinPacking;<br>
-<br>
-  /// \brief Break after the next comma (or all the commas in this context if<br>
-  /// \c AvoidBinPacking is \c true).<br>
-  bool BreakBeforeParameter;<br>
-<br>
-  /// \brief Line breaking in this context would break a formatting rule.<br>
-  bool NoLineBreak;<br>
-<br>
-  /// \brief True if the last binary operator on this level was wrapped to the<br>
-  /// next line.<br>
-  bool LastOperatorWrapped;<br>
-<br>
   /// \brief The position of the colon in an ObjC method declaration/call.<br>
   unsigned ColonPos;<br>
<br>
@@ -230,40 +208,62 @@ struct ParenState {<br>
   /// Used to align further variables if necessary.<br>
   unsigned VariablePos;<br>
<br>
+  /// \brief Whether a newline needs to be inserted before the block's closing<br>
+  /// brace.<br>
+  ///<br>
+  /// We only want to insert a newline before the closing brace if there also<br>
+  /// was a newline after the beginning left brace.<br>
+  bool BreakBeforeClosingBrace : 1;<br>
+<br>
+  /// \brief Avoid bin packing, i.e. multiple parameters/elements on multiple<br>
+  /// lines, in this context.<br>
+  bool AvoidBinPacking : 1;<br>
+<br>
+  /// \brief Break after the next comma (or all the commas in this context if<br>
+  /// \c AvoidBinPacking is \c true).<br>
+  bool BreakBeforeParameter : 1;<br>
+<br>
+  /// \brief Line breaking in this context would break a formatting rule.<br>
+  bool NoLineBreak : 1;<br>
+<br>
+  /// \brief True if the last binary operator on this level was wrapped to the<br>
+  /// next line.<br>
+  bool LastOperatorWrapped : 1;<br>
+<br>
   /// \brief \c true if this \c ParenState already contains a line-break.<br>
   ///<br>
   /// The first line break in a certain \c ParenState causes extra penalty so<br>
   /// that clang-format prefers similar breaks, i.e. breaks in the same<br>
   /// parenthesis.<br>
-  bool ContainsLineBreak;<br>
+  bool ContainsLineBreak : 1;<br>
<br>
   /// \brief \c true if this \c ParenState contains multiple segments of a<br>
   /// builder-type call on one line.<br>
-  bool ContainsUnwrappedBuilder;<br>
+  bool ContainsUnwrappedBuilder : 1;<br>
<br>
   /// \brief \c true if the colons of the curren ObjC method expression should<br>
   /// be aligned.<br>
   ///<br>
   /// Not considered for memoization as it will always have the same value at<br>
   /// the same token.<br>
-  bool AlignColons;<br>
+  bool AlignColons : 1;<br>
<br>
   /// \brief \c true if at least one selector name was found in the current<br>
   /// ObjC method expression.<br>
   ///<br>
   /// Not considered for memoization as it will always have the same value at<br>
   /// the same token.<br>
-  bool ObjCSelectorNameFound;<br>
+  bool ObjCSelectorNameFound : 1;<br>
<br>
   /// \brief \c true if there are multiple nested blocks inside these parens.<br>
   ///<br>
   /// Not considered for memoization as it will always have the same value at<br>
   /// the same token.<br>
-  bool HasMultipleNestedBlocks;<br>
+  bool HasMultipleNestedBlocks : 1;<br>
<br>
   // \brief The start of a nested block (e.g. lambda introducer in C++ or<br>
   // "function" in JavaScript) is not wrapped to a new line.<br>
-  bool NestedBlockInlined;<br>
+  bool NestedBlockInlined : 1;<br>
<br>
   bool operator<(const ParenState &Other) const {<br>
     if (Indent != Other.Indent)<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>