Fix the warning that is emitted when an ownership attribute is applied incorrectly.
llvm-svn: 134278
This commit is contained in:
parent
9ab661b163
commit
451ccc0892
|
|
@ -1243,6 +1243,8 @@ def warn_function_attribute_wrong_type : Warning<
|
||||||
"'%0' only applies to function types; type here is %1">;
|
"'%0' only applies to function types; type here is %1">;
|
||||||
def warn_pointer_attribute_wrong_type : Warning<
|
def warn_pointer_attribute_wrong_type : Warning<
|
||||||
"'%0' only applies to pointer types; type here is %1">;
|
"'%0' only applies to pointer types; type here is %1">;
|
||||||
|
def warn_objc_object_attribute_wrong_type : Warning<
|
||||||
|
"'%0' only applies to objective-c object or block pointer types; type here is %1">;
|
||||||
def warn_gnu_inline_attribute_requires_inline : Warning<
|
def warn_gnu_inline_attribute_requires_inline : Warning<
|
||||||
"'gnu_inline' attribute requires function to be marked 'inline',"
|
"'gnu_inline' attribute requires function to be marked 'inline',"
|
||||||
" attribute ignored">;
|
" attribute ignored">;
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,11 @@ static void diagnoseBadTypeAttribute(Sema &S, const AttributeList &attr,
|
||||||
useInstantiationLoc = true;
|
useInstantiationLoc = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AttributeList::AT_objc_ownership:
|
||||||
|
diagID = diag::warn_objc_object_attribute_wrong_type;
|
||||||
|
useInstantiationLoc = true;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Assume everything else was a function attribute.
|
// Assume everything else was a function attribute.
|
||||||
diagID = diag::warn_function_attribute_wrong_type;
|
diagID = diag::warn_function_attribute_wrong_type;
|
||||||
|
|
|
||||||
|
|
@ -604,4 +604,6 @@ void test35(void) {
|
||||||
__block id y;
|
__block id y;
|
||||||
test36_helper(&y);
|
test36_helper(&y);
|
||||||
^{ test36_helper(&y); }();
|
^{ test36_helper(&y); }();
|
||||||
|
|
||||||
|
__strong int non_objc_type; // expected-warning {{'__strong' only applies to objective-c object or block pointer types}}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue