instead it crashes on them. We might extend this attribute to work on methods, but for
now fix the crasher. Addresses <rdar://problem/
7670939>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96723
91177308-0d34-0410-b5e6-
96231b3b80d8
return;
}
- if (!isFunctionOrMethod(D)) {
+ if (!isFunction(D)) {
S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
<< Attr.getName() << 0 /*function*/;
return;
--- /dev/null
+// RUN: %clang_cc1 -fsyntax-only -Wunused-value -verify %s
+
+@interface INTF
+// Currently this is rejected by both GCC and Clang (and Clang was crashing on it).
+- (id) foo __attribute__((warn_unused_result)); // expected-warning{{warning: 'warn_unused_result' attribute only applies to function types}}
+@end
+
+