aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-07-15 00:46:02 +0000
committerTed Kremenek <kremenek@apple.com>2008-07-15 00:46:02 +0000
commitf7f3c20a5d4c5bd1857a6cea1f001bb775401e96 (patch)
tree0856afe94e1988239ddfa91b8067661b97a5535e
parent57bb37fcf53aa28ef77271a9f9563fa155d87f11 (diff)
Provide an "Analysis Scope" for Analyses so checks can either be run on code declarations (bodies) or Objective-C @implementation blocks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53584 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Driver/Analyses.def20
-rw-r--r--Driver/AnalysisConsumer.cpp4
-rw-r--r--Driver/AnalysisConsumer.h2
-rw-r--r--Driver/clang.cpp2
-rw-r--r--test/Analysis/ObjCRetSigs.m2
5 files changed, 16 insertions, 14 deletions
diff --git a/Driver/Analyses.def b/Driver/Analyses.def
index 1e04c9a841..623a2475d6 100644
--- a/Driver/Analyses.def
+++ b/Driver/Analyses.def
@@ -12,30 +12,32 @@
//===----------------------------------------------------------------------===//
ANALYSIS(CFGDump, "cfg-dump",
- "Display Control-Flow Graphs")
+ "Display Control-Flow Graphs", Code)
ANALYSIS(CFGView, "cfg-view",
- "View Control-Flow Graphs using GraphViz")
+ "View Control-Flow Graphs using GraphViz", Code)
ANALYSIS(DisplayLiveVariables, "dump-live-variables",
- "Print results of live variable analysis")
+ "Print results of live variable analysis", Code)
ANALYSIS(WarnDeadStores, "warn-dead-stores",
- "Warn about stores to dead variables")
+ "Warn about stores to dead variables", Code)
ANALYSIS(WarnUninitVals, "warn-uninit-values",
- "Warn about uses of uninitialized variables")
+ "Warn about uses of uninitialized variables", Code)
ANALYSIS(WarnObjCMethSigs, "warn-objc-methodsigs",
-"Warn about Objective-C method signatures with type incompatibilities")
+ "Warn about Objective-C method signatures with type incompatibilities",
+ ObjCImplementation)
ANALYSIS(WarnObjCDealloc, "warn-objc-missing-dealloc",
-"Warn about Objective-C classes that lack a correct implementation of -dealloc")
+ "Warn about Objective-C classes that lack a correct implementation of -dealloc",
+ ObjCImplementation)
ANALYSIS(CheckerSimple, "checker-simple",
- "Perform simple path-sensitive checks.")
+ "Perform simple path-sensitive checks.", Code)
ANALYSIS(CheckerCFRef, "checker-cfref",
- "Run the [Core] Foundation reference count checker")
+ "Run the [Core] Foundation reference count checker", Code)
#undef ANALYSIS
diff --git a/Driver/AnalysisConsumer.cpp b/Driver/AnalysisConsumer.cpp
index cd24e2efea..45e0918ce0 100644
--- a/Driver/AnalysisConsumer.cpp
+++ b/Driver/AnalysisConsumer.cpp
@@ -414,9 +414,9 @@ ASTConsumer* clang::CreateAnalysisConsumer(Analyses* Beg, Analyses* End,
for ( ; Beg != End ; ++Beg)
switch (*Beg) {
-#define ANALYSIS(NAME, CMD, DESC)\
+#define ANALYSIS(NAME, CMD, DESC, SCOPE)\
case NAME:\
- C->addCodeAction(&Action ## NAME);\
+ C->add ## SCOPE ## Action(&Action ## NAME);\
break;
#include "Analyses.def"
default: break;
diff --git a/Driver/AnalysisConsumer.h b/Driver/AnalysisConsumer.h
index dfabe79e56..5a2550da43 100644
--- a/Driver/AnalysisConsumer.h
+++ b/Driver/AnalysisConsumer.h
@@ -17,7 +17,7 @@
namespace clang {
enum Analyses {
-#define ANALYSIS(NAME, CMDFLAG, DESC) NAME,
+#define ANALYSIS(NAME, CMDFLAG, DESC, SCOPE) NAME,
#include "Analyses.def"
NumAnalyses
};
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 7ce730150e..5e8f51cbc9 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -162,7 +162,7 @@ AnalyzeAll("checker-opt-analyze-headers",
static llvm::cl::list<Analyses>
AnalysisList(llvm::cl::desc("Available Source Code Analyses:"),
llvm::cl::values(
-#define ANALYSIS(NAME, CMDFLAG, DESC)\
+#define ANALYSIS(NAME, CMDFLAG, DESC, SCOPE)\
clEnumValN(NAME, CMDFLAG, DESC),
#include "Analyses.def"
clEnumValEnd));
diff --git a/test/Analysis/ObjCRetSigs.m b/test/Analysis/ObjCRetSigs.m
index 24b0f3aee5..009f6c3808 100644
--- a/test/Analysis/ObjCRetSigs.m
+++ b/test/Analysis/ObjCRetSigs.m
@@ -1,4 +1,4 @@
-// RUN: clang -check-objc-methodsigs -verify %s
+// RUN: clang -warn-objc-methodsigs -verify %s
#include <stdio.h>