;
36 return C.typesAreCompatible(Derived, Ancestor);
50llvm::raw_string_ostream os(sbuf);
52os <<
"The Objective-C class '" 54<<
"', which is derived from class '" 56<<
"', defines the instance method '";
58os <<
"' whose return type is '"<< ResDerived
59<<
"'. A method with the same name (same selector) is also defined in " 63<<
"'. These two types are incompatible, and may result in undefined " 64 "behavior for clients of these classes.";
71MethDerived,
Checker,
"Incompatible instance method return type",
89 typedefllvm::DenseMap<Selector,ObjCMethodDecl*>
MapTy;
91 unsignedNumMethods = 0;
93 for(
auto*M : ID->instance_methods()) {
94IMeths[M->getSelector()] = M;
100 while(
C&& NumMethods) {
101 for(
const auto*M :
C->instance_methods()) {
104MapTy::iterator MI = IMeths.find(S);
106 if(MI == IMeths.end() || MI->second ==
nullptr)
111MI->second =
nullptr;
116 C=
C->getSuperClass();
125classObjCMethSigsChecker :
public Checker<
126check::ASTDecl<ObjCImplementationDecl> > {
139boolento::shouldRegisterObjCMethSigsChecker(
const CheckerManager&mgr) {
Defines the clang::ASTContext interface.
static bool AreTypesCompatible(QualType Derived, QualType Ancestor, ASTContext &C)
static void CheckObjCInstMethSignature(const ObjCImplementationDecl *ID, BugReporter &BR, const CheckerBase *Checker)
static void CompareReturnTypes(const ObjCMethodDecl *MethDerived, const ObjCMethodDecl *MethAncestor, BugReporter &BR, ASTContext &Ctx, const ObjCImplementationDecl *ID, const CheckerBase *Checker)
llvm::DenseMap< Stmt *, Stmt * > MapTy
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents an ObjC class declaration.
ObjCMethodDecl - Represents an instance or class method declaration.
Selector getSelector() const
QualType getReturnType() const
ObjCInterfaceDecl * getClassInterface()
A (possibly-)qualified type.
Smart pointer class that efficiently represents Objective-C method names.
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
bool isAnyPointerType() const
BugReporter is a utility class for generating PathDiagnostics for analysis.
const SourceManager & getSourceManager()
ASTContext & getContext()
void EmitBasicReport(const Decl *DeclWithIssue, const CheckerBase *Checker, StringRef BugName, StringRef BugCategory, StringRef BugStr, PathDiagnosticLocation Loc, ArrayRef< SourceRange > Ranges={}, ArrayRef< FixItHint > Fixits={})
CHECKER * registerChecker(AT &&... Args)
Used to register checkers.
static PathDiagnosticLocation createBegin(const Decl *D, const SourceManager &SM)
Create a location for the beginning of the declaration.
const char *const CoreFoundationObjectiveC
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