If you have a method name that should have something like “new” or “copy” in it, and you know that the warning is not valid, you can exclude this warning by including in the LLVM a hint that the class is really in order ,
In your header file, first add this (usually near the top, but it could be anywhere):
#ifndef __has_feature // Optional. #define __has_feature(x) 0 // Compatibility with non-clang compilers. #endif #ifndef NS_RETURNS_NOT_RETAINED #if __has_feature(attribute_ns_returns_not_retained) #define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained)) #else #define NS_RETURNS_NOT_RETAINED #endif #endif
Then at the end of your method declaration add this:
+ (id) newWithNode: (CXMLNode*) node NS_RETURNS_NOT_RETAINED;
You can find a list of other tips (really attributes) that you can pass to LLVM here:
http://clang-analyzer.llvm.org/annotations.html
Kendall helmstetter gelner
source share