aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/BugReporterVisitors.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-08-18 01:05:30 +0000
committerTed Kremenek <kremenek@apple.com>2009-08-18 01:05:30 +0000
commit592362b46ad69db0db0988e7f9d8cbe647510bdd (patch)
tree1fbb430abdc2851351450fffa683ff986e371f81 /lib/Analysis/BugReporterVisitors.cpp
parent88232aadbe3e9b6dde2a9b0d7c91e677305de06a (diff)
Enhance static analyzer diagnostics by introducing a new 'EnhancedBugReporter'
which allows custom checks to register callback creator functions for creating BugReporterVisitor objects. This allows various checks to include diagnostics such as 'assuming value is null' with little extra work. Eventually this API should be refactored to be cleaner and more simple. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79302 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BugReporterVisitors.cpp')
-rw-r--r--lib/Analysis/BugReporterVisitors.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Analysis/BugReporterVisitors.cpp b/lib/Analysis/BugReporterVisitors.cpp
index 77501bbba2..604542b2c1 100644
--- a/lib/Analysis/BugReporterVisitors.cpp
+++ b/lib/Analysis/BugReporterVisitors.cpp
@@ -189,6 +189,10 @@ public:
else if (V.isUndef()) {
os << "Uninitialized value stored to ";
}
+ else if (isa<nonloc::ConcreteInt>(V)) {
+ os << "The value " << cast<nonloc::ConcreteInt>(V).getValue()
+ << " is assigned to ";
+ }
else
return NULL;
@@ -296,9 +300,11 @@ static void registerTrackConstraint(BugReporterContext& BRC, SVal Constraint,
}
void clang::bugreporter::registerTrackNullOrUndefValue(BugReporterContext& BRC,
- const Stmt *S,
+ const void *data,
const ExplodedNode* N) {
+ const Stmt *S = static_cast<const Stmt*>(data);
+
if (!S)
return;