aboutsummaryrefslogtreecommitdiff
path: root/Driver/AnalysisConsumer.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-07-11 22:40:47 +0000
committerTed Kremenek <kremenek@apple.com>2008-07-11 22:40:47 +0000
commit0d8019e55c0f465bafc11b04aed691de95b9131d (patch)
tree67854def92c93e2096a354c201a6de323e349ee8 /Driver/AnalysisConsumer.cpp
parent75a4881047deeb3a300ff9293dc6ba8570048bb5 (diff)
Add new check: -check-objc-methodsigs. This check scans methods in
ObjCImplementationDecls and sees if a ancestor class defines a method with the same selector but with a different type signature. Right now it just compares return types, and mainly looks at differences in primitive values. The checking will be expanded in the future. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53482 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/AnalysisConsumer.cpp')
-rw-r--r--Driver/AnalysisConsumer.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/Driver/AnalysisConsumer.cpp b/Driver/AnalysisConsumer.cpp
index 44d96a0050..28ebe1d11b 100644
--- a/Driver/AnalysisConsumer.cpp
+++ b/Driver/AnalysisConsumer.cpp
@@ -390,6 +390,13 @@ static void ActionCheckObjCDealloc(AnalysisManager& mgr) {
mgr.getLangOptions(), BR);
}
+static void ActionCheckObjCInstMethSignature(AnalysisManager& mgr) {
+ BugReporter BR(mgr);
+
+ CheckObjCInstMethSignature(cast<ObjCImplementationDecl>(mgr.getCodeDecl()),
+ BR);
+}
+
//===----------------------------------------------------------------------===//
// AnalysisConsumer creation.
//===----------------------------------------------------------------------===//
@@ -416,6 +423,10 @@ ASTConsumer* clang::CreateAnalysisConsumer(Analyses* Beg, Analyses* End,
case WarnUninitVals:
C->addCodeAction(&ActionUninitVals);
break;
+
+ case CheckObjCMethSigs:
+ C->addObjCImplementationAction(&ActionCheckObjCInstMethSignature);
+ break;
case DisplayLiveVariables:
C->addCodeAction(&ActionLiveness);
@@ -442,8 +453,8 @@ ASTConsumer* clang::CreateAnalysisConsumer(Analyses* Beg, Analyses* End,
// Checks we always perform:
if (lopts.getGCMode() != LangOptions::GCOnly)
- C->addObjCImplementationAction(&ActionCheckObjCDealloc);
-
+ C->addObjCImplementationAction(&ActionCheckObjCDealloc);
+
return C.take();
}