forked from OSchip/llvm-project
[Objective-C]. Modern property getters have side-effects.
So, place warning about property getter should not be used for side-effect under its own group so warning can be turned off. rdar://19137815 llvm-svn: 224479
This commit is contained in:
parent
2b8ff7e461
commit
323ddf97ba
|
@ -413,6 +413,7 @@ def UnusedVariable : DiagGroup<"unused-variable",
|
|||
[UnusedConstVariable]>;
|
||||
def UnusedLocalTypedef : DiagGroup<"unused-local-typedef">;
|
||||
def UnusedPropertyIvar : DiagGroup<"unused-property-ivar">;
|
||||
def UnusedGetterReturnValue : DiagGroup<"unused-getter-return-value">;
|
||||
def UsedButMarkedUnused : DiagGroup<"used-but-marked-unused">;
|
||||
def UserDefinedLiterals : DiagGroup<"user-defined-literals">;
|
||||
def Reorder : DiagGroup<"reorder">;
|
||||
|
|
|
@ -6100,7 +6100,7 @@ def warn_unused_voidptr : Warning<
|
|||
InGroup<UnusedValue>;
|
||||
def warn_unused_property_expr : Warning<
|
||||
"property access result unused - getters should not be used for side effects">,
|
||||
InGroup<UnusedValue>;
|
||||
InGroup<UnusedGetterReturnValue>;
|
||||
def warn_unused_container_subscript_expr : Warning<
|
||||
"container access result unused - container access should not be used for side effects">,
|
||||
InGroup<UnusedValue>;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 %s -triple i386-mingw32 -std=c++11 -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions -fms-compatibility -fdelayed-template-parsing
|
||||
// RUN: %clang_cc1 %s -triple i386-mingw32 -std=c++11 -fsyntax-only -Wno-unused-getter-return-value -Wno-unused-value -Wmicrosoft -verify -fms-extensions -fms-compatibility -fdelayed-template-parsing
|
||||
|
||||
/* Microsoft attribute tests */
|
||||
[repeatable][source_annotation_attribute( Parameter|ReturnValue )]
|
||||
|
|
|
@ -34,3 +34,20 @@
|
|||
return 0;
|
||||
}
|
||||
@end
|
||||
|
||||
// rdar://19137815
|
||||
#pragma clang diagnostic ignored "-Wunused-getter-return-value"
|
||||
|
||||
@interface NSObject @end
|
||||
|
||||
@interface I : NSObject
|
||||
@property (copy) id window;
|
||||
@end
|
||||
|
||||
@implementation I
|
||||
- (void) Meth {
|
||||
[self window];
|
||||
self.window;
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in New Issue