aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker/AnalysisConsumer.cpp
diff options
context:
space:
mode:
authorTom Care <tcare@apple.com>2010-07-06 21:43:29 +0000
committerTom Care <tcare@apple.com>2010-07-06 21:43:29 +0000
commitdb2fa8a7eb67b1e8f32a590b8e000e1259cff91a (patch)
tree8800214bfcdc2f28ca4c21fb12680a2ce97ebb62 /lib/Checker/AnalysisConsumer.cpp
parent03d98c5d592d74ae97aa3f93f80441b64960e4b6 (diff)
Added a path-sensitive idempotent operation checker (-analyzer-idempotent-operation). Finds idempotent and/or tautological operations in a path sensitive context, flagging operations that have no effect or a predictable effect.
Example: { int a = 1; int b = 5; int c = b / a; // a is 1 on all paths } - New IdempotentOperationChecker class - Moved recursive Stmt functions in r107675 to IdempotentOperationChecker - Minor refactoring of SVal to allow checking for any integer - Added command line option for check - Added basic test cases git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107706 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/AnalysisConsumer.cpp')
-rw-r--r--lib/Checker/AnalysisConsumer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Checker/AnalysisConsumer.cpp b/lib/Checker/AnalysisConsumer.cpp
index 7c5f8ca56e..35f5eecb38 100644
--- a/lib/Checker/AnalysisConsumer.cpp
+++ b/lib/Checker/AnalysisConsumer.cpp
@@ -28,6 +28,7 @@
#include "clang/Checker/PathSensitive/GRExprEngine.h"
#include "clang/Checker/PathSensitive/GRTransferFuncs.h"
#include "clang/Checker/PathDiagnosticClients.h"
+#include "GRExprEngineExperimentalChecks.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Frontend/AnalyzerOptions.h"
@@ -340,6 +341,9 @@ static void ActionGRExprEngine(AnalysisConsumer &C, AnalysisManager& mgr,
if (C.Opts.EnableExperimentalChecks)
RegisterExperimentalChecks(Eng);
+ if (C.Opts.EnableIdempotentOperationChecker)
+ RegisterIdempotentOperationChecker(Eng);
+
// Set the graph auditor.
llvm::OwningPtr<ExplodedNode::Auditor> Auditor;
if (mgr.shouldVisualizeUbigraph()) {