22 using namespace clang;
26 class ObjCPropertyChecker
27 :
public Checker<check::ASTDecl<ObjCPropertyDecl>> {
39 checkCopyMutable(D, BR);
54 if (!StringRef(PropTypeName).startswith(
"NSMutable"))
60 ImplD = IntD->getImplementation();
61 }
else if (
auto *CatD = dyn_cast<ObjCCategoryDecl>(D->
getDeclContext())) {
69 llvm::raw_svector_ostream OS(Str);
70 OS <<
"Property of mutable type '" << PropTypeName
71 <<
"' has 'copy' attribute; an immutable object will be stored instead";
74 D,
this,
"Objective-C property misuse",
"Logic error", OS.str(),
A (possibly-)qualified type.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
SetterKind getSetterKind() const
getSetterKind - Return the method used for doing assignment in the property setter.
bool isReadOnly() const
isReadOnly - Return true iff the property has a setter.
Represents an ObjC class declaration.
bool HasUserDeclaredSetterMethod(const ObjCPropertyDecl *P) const
This routine returns 'true' if a user declared setter method was found in the class, its protocols, its super classes or categories.
const FunctionProtoType * T
DeclContext * getDeclContext()
BugReporter is a utility class for generating PathDiagnostics for analysis.
static PathDiagnosticLocation createBegin(const Decl *D, const SourceManager &SM)
Create a location for the beginning of the declaration.
QualType getCanonicalType() const
CHECKER * registerChecker()
Used to register checkers.
void EmitBasicReport(const Decl *DeclWithIssue, const CheckerBase *Checker, StringRef BugName, StringRef BugCategory, StringRef BugStr, PathDiagnosticLocation Loc, ArrayRef< SourceRange > Ranges=None)
bool isObjCObjectPointerType() const
Represents one property declaration in an Objective-C interface.
ObjCImplementationDecl * getImplementation() const
const ObjCInterfaceDecl * getClassInterface() const
Dataflow Directional Tag Classes.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
SourceManager & getSourceManager()
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.