diff options
author | Tom Care <tcare@apple.com> | 2010-07-06 21:43:29 +0000 |
---|---|---|
committer | Tom Care <tcare@apple.com> | 2010-07-06 21:43:29 +0000 |
commit | 3ff08a8e76eeb25ceeed2c7461eccd388f996985 (patch) | |
tree | a9ee816fe14fa19a856f4a5c1debb30d5a6dcdcc /clang/lib/Checker/AnalysisConsumer.cpp | |
parent | 4c1ca2903984f760a2f3de2d51c8c9ba3e669d54 (diff) | |
download | bcm5719-llvm-3ff08a8e76eeb25ceeed2c7461eccd388f996985.tar.gz bcm5719-llvm-3ff08a8e76eeb25ceeed2c7461eccd388f996985.zip |
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
llvm-svn: 107706
Diffstat (limited to 'clang/lib/Checker/AnalysisConsumer.cpp')
-rw-r--r-- | clang/lib/Checker/AnalysisConsumer.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Checker/AnalysisConsumer.cpp b/clang/lib/Checker/AnalysisConsumer.cpp index 7c5f8ca56e1..35f5eecb38c 100644 --- a/clang/lib/Checker/AnalysisConsumer.cpp +++ b/clang/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()) { |