<html>
    <head>
      <base href="http://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 --- - [objc] clang should recover better from missing method bodies"
   href="http://llvm.org/bugs/show_bug.cgi?id=16631">16631</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[objc] clang should recover better from missing method bodies
          </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>All
          </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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I copied an "@implementation" section from a .h file and deleted all the method
bodies. I accidentally forgot to change "@implementation" to "@interface". This
confuses clang a lot:

Nicos-MacBook-Pro:src thakis$ cat test.mm
#import <Cocoa/Cocoa.h>

@interface A
@end

@implementation A (Foo)
- (void)doFoo:(NSString*)s;
@end

void f(A* a) {
  [a doFoo:@"asdf"];
}
Nicos-MacBook-Pro:src thakis$ third_party/llvm-build/Release+Asserts/bin/clang
-c test.mm -Wextra
test.mm:7:27: warning: semicolon before method body is ignored
[-Wsemicolon-before-method-body]
- (void)doFoo:(NSString*)s;
                          ^
test.mm:8:1: error: expected method body
@end
^
test.mm:11:4: error: use of undeclared identifier 'a'
  [a doFoo:@"asdf"];
   ^
test.mm:7:26: warning: unused parameter 's' [-Wunused-parameter]
- (void)doFoo:(NSString*)s;
                         ^
test.mm:12:2: error: missing '@end'
}
 ^
test.mm:6:1: note: implementation started here
@implementation A (Foo)
^
2 warnings and 3 errors generated.




If a method ends with a ';' and then isn't followed by '{', clang should diag
"expected body" and then continue parsing on the next line. Then this would
show only a single diag instead of more or less 1 for every source line after
the error.</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>