[PATCH] D29884: [analyzer] Proper caching in CallDescription objects.
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 15 07:47:35 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL295186: [analyzer] Proper caching in CallDescription objects. (authored by xazax).
Changed prior to commit:
https://reviews.llvm.org/D29884?vs=88166&id=88537#toc
Repository:
rL LLVM
https://reviews.llvm.org/D29884
Files:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
Index: cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -212,9 +212,12 @@
bool CallEvent::isCalled(const CallDescription &CD) const {
assert(getKind() != CE_ObjCMessage && "Obj-C methods are not supported");
- if (!CD.II)
+ if (!CD.IsLookupDone) {
+ CD.IsLookupDone = true;
CD.II = &getState()->getStateManager().getContext().Idents.get(CD.FuncName);
- if (getCalleeIdentifier() != CD.II)
+ }
+ const IdentifierInfo *II = getCalleeIdentifier();
+ if (!II || II != CD.II)
return false;
return (CD.RequiredArgs == CallDescription::NoArgRequirement ||
CD.RequiredArgs == getNumArgs());
Index: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
===================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
@@ -55,6 +55,7 @@
class CallDescription {
friend CallEvent;
mutable IdentifierInfo *II;
+ mutable bool IsLookupDone;
StringRef FuncName;
unsigned RequiredArgs;
@@ -68,7 +69,8 @@
/// call. Omit this parameter to match every occurance of call with a given
/// name regardless the number of arguments.
CallDescription(StringRef FuncName, unsigned RequiredArgs = NoArgRequirement)
- : II(nullptr), FuncName(FuncName), RequiredArgs(RequiredArgs) {}
+ : II(nullptr), IsLookupDone(false), FuncName(FuncName),
+ RequiredArgs(RequiredArgs) {}
/// \brief Get the name of the function that this object matches.
StringRef getFunctionName() const { return FuncName; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29884.88537.patch
Type: text/x-patch
Size: 1794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170215/d00d9e35/attachment.bin>
More information about the cfe-commits
mailing list