<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - BraceWrapping: AfterFunction flag interferes with formatting of empty class body"
   href="https://llvm.org/bugs/show_bug.cgi?id=25132">25132</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>BraceWrapping: AfterFunction flag interferes with formatting of empty class body
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Formatter
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mattipee@yahoo.co.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ clang-format -version
clang-format version 3.8.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
47928a9602f4bc13c065bad2f7f940bee2711e63) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
0425965d3ddad80c886b6795361c1902f7e1dd78)

$ cat asdf.h 
class A {};

$ cat .clang-format 
---
BraceWrapping:   
  AfterClass:      true
  #AfterFunction:   true
BreakBeforeBraces: Custom
...

$ clang-format --style=file asdf.h 
class A
{};


Enable AfterFunction
====================

$ cat .clang-format 
---
BraceWrapping:   
  AfterClass:      true
  AfterFunction:   true
BreakBeforeBraces: Custom
...

$ clang-format --style=file asdf.h 
class A
{
};



After recompilation (see below)
===================

$ clang-format --style=file asdf.h 
class A
{};



I suspect the following change may be incorrect for reasons I am unable to
test...




diff --git a/lib/Format/UnwrappedLineFormatter.cpp
b/lib/Format/UnwrappedLineFormatter.cpp
index 6d9b1da..67567be 100644
--- a/lib/Format/UnwrappedLineFormatter.cpp
+++ b/lib/Format/UnwrappedLineFormatter.cpp
@@ -199,7 +199,8 @@ private:
       return MergeShortFunctions ? tryMergeSimpleBlock(I, E, Limit) : 0;
     }
     if (TheLine->Last->is(tok::l_brace)) {
-      return !Style.BraceWrapping.AfterFunction
+      return !(TheLine->Last->is(TT_FunctionLBrace) &&
+               Style.BraceWrapping.AfterFunction)
                  ? tryMergeSimpleBlock(I, E, Limit)
                  : 0;
     }</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>