;
51classDirectIvarAssignment :
52 public Checker<check::ASTDecl<ObjCImplementationDecl> > {
60 constIvarToPropertyMapTy &IvarToPropMap;
68MethodCrawler(
constIvarToPropertyMapTy &InMap,
const ObjCMethodDecl*InMD,
71: IvarToPropMap(InMap), MD(InMD), InterfD(InID), BR(InBR),
74 voidVisitStmt(
const Stmt*S) { VisitChildren(S); }
78 voidVisitChildren(
const Stmt*S) {
79 for(
const Stmt*Child : S->children())
88DirectIvarAssignment() : ShouldSkipMethod(&DefaultMethodFilter) {}
122IvarToPropertyMapTy IvarToPropMap;
134IvarToPropMap[
ID] = PD;
137 if(IvarToPropMap.empty())
140 for(
const auto*M :
D->instance_methods()) {
143 if((*ShouldSkipMethod)(M))
157static boolisAnnotatedToAllowDirectAssignment(
const Decl*
D) {
159 if(Ann->getAnnotation() ==
160 "objc_allow_direct_instance_variable_assignment")
165voidDirectIvarAssignment::MethodCrawler::VisitBinaryOperator(
177IvarToPropertyMapTy::const_iterator I = IvarToPropMap.find(
D);
179 if(I != IvarToPropMap.end()) {
185 if(isAnnotatedToAllowDirectAssignment(PD) ||
186isAnnotatedToAllowDirectAssignment(
D))
202 "Direct assignment to an instance variable backing a property; " 203 "use the setter instead",
214 if(Ann->getAnnotation() ==
"objc_no_direct_instance_variable_assignment")
224 "AnnotatedFunctions"))
228boolento::shouldRegisterDirectIvarAssignment(
const CheckerManager&mgr) {
static bool AttrFilter(const ObjCMethodDecl *M)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
AnalysisDeclContext contains the context data for the function, method or block under analysis.
bool getCheckerBooleanOption(StringRef CheckerName, StringRef OptionName, bool SearchInParents=false) const
Interprets an option's string value as a boolean.
A builtin binary operation expression such as "x + y" or "x <= y".
static bool isAssignmentOp(Opcode Opc)
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
Decl - This represents one declaration (or definition), e.g.
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
One of these records is kept for each identifier that is lexed.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
instprop_range instance_properties() const
ObjCMethodDecl * getInstanceMethod(Selector Sel, bool AllowHidden=false) const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents an ObjC class declaration.
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName, ObjCInterfaceDecl *&ClassDeclared)
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
ObjCMethodDecl - Represents an instance or class method declaration.
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
ObjCMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isSynthesizedAccessorStub() const
Selector getSelector() const
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
Represents one property declaration in an Objective-C interface.
ObjCIvarDecl * getPropertyIvarDecl() const
Selector getSetterName() const
Selector getGetterName() const
IdentifierInfo * getDefaultSynthIvarName(ASTContext &Ctx) const
Get the default name of the synthesized ivar.
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
Stmt - This represents one statement.
ASTContext & getASTContext() override
AnalysisDeclContext * getAnalysisDeclContext(const Decl *D)
BugReporter is a utility class for generating PathDiagnostics for analysis.
const SourceManager & getSourceManager()
void EmitBasicReport(const Decl *DeclWithIssue, const CheckerBase *Checker, StringRef BugName, StringRef BugCategory, StringRef BugStr, PathDiagnosticLocation Loc, ArrayRef< SourceRange > Ranges={}, ArrayRef< FixItHint > Fixits={})
const AnalyzerOptions & getAnalyzerOptions() const
CHECKER * registerChecker(AT &&... Args)
Used to register checkers.
const char *const CoreFoundationObjectiveC
llvm::PointerUnion< const LocationContext *, AnalysisDeclContext * > LocationOrAnalysisDeclContext
The JSON file list parser is used to communicate input to InstallAPI.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4