summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
diff options
context:
space:
mode:
authorGabor Horvath <xazax.hun@gmail.com>2016-01-22 22:32:46 +0000
committerGabor Horvath <xazax.hun@gmail.com>2016-01-22 22:32:46 +0000
commit343730c58fc6021fdde96e4a4bcd107de17e5cdd (patch)
treecb5d979ad0e04c0599adde7b24ce8a5ad595a867 /clang/lib/StaticAnalyzer/Core/CallEvent.cpp
parentdf91910bd4d4afa8339ba27cd7f354760171bb5a (diff)
downloadbcm5719-llvm-343730c58fc6021fdde96e4a4bcd107de17e5cdd.tar.gz
bcm5719-llvm-343730c58fc6021fdde96e4a4bcd107de17e5cdd.zip
[analyzer] Utility to match function calls.
This patch adds a small utility to match function calls. This utility abstracts away the mutable keywords and the lazy initialization and caching logic of identifiers from the checkers. The SimpleStreamChecker is ported over this utility within this patch to show the reduction of code and to test this change. Differential Revision: http://reviews.llvm.org/D15921 llvm-svn: 258572
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/CallEvent.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/CallEvent.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
index 69af09b25b6..59b90b5ce98 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -210,6 +210,16 @@ ProgramPoint CallEvent::getProgramPoint(bool IsPreVisit,
return PostImplicitCall(D, Loc, getLocationContext(), Tag);
}
+bool CallEvent::isCalled(const CallDescription &CD) const {
+ assert(getKind() != CE_ObjCMessage && "Obj-C methods are not supported");
+ if (!CD.II)
+ CD.II = &getState()->getStateManager().getContext().Idents.get(CD.FuncName);
+ if (getCalleeIdentifier() != CD.II)
+ return false;
+ return (CD.RequiredArgs == CallDescription::NoArgRequirement ||
+ CD.RequiredArgs == getNumArgs());
+}
+
SVal CallEvent::getArgSVal(unsigned Index) const {
const Expr *ArgE = getArgExpr(Index);
if (!ArgE)
OpenPOWER on IntegriCloud