summaryrefslogtreecommitdiff
path: root/lib/Analysis/CloneDetection.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2016-08-10 16:25:16 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2016-08-10 16:25:16 +0000
commita7e2299971866bedeaa99cc989b04134c2bde18a (patch)
treeef86c2ea9baa198c5e3e16aed2b8d72e980fcbd5 /lib/Analysis/CloneDetection.cpp
parent8896df9583fcf0b8b1986c6fab14a7b907651838 (diff)
downloadclang-a7e2299971866bedeaa99cc989b04134c2bde18a.tar.gz
[analyzer] Fix a crash in CloneDetector when calling functions by pointers.
CallExpr may have a null direct callee when the callee function is not known in compile-time. Do not try to take callee name in this case. Patch by Raphael Isemann! Differential Revision: https://reviews.llvm.org/D23320 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278238 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CloneDetection.cpp')
-rw-r--r--lib/Analysis/CloneDetection.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Analysis/CloneDetection.cpp b/lib/Analysis/CloneDetection.cpp
index 038f9eb87c..27815f30ae 100644
--- a/lib/Analysis/CloneDetection.cpp
+++ b/lib/Analysis/CloneDetection.cpp
@@ -249,8 +249,11 @@ public:
})
//--- Calls --------------------------------------------------------------//
- DEF_ADD_DATA(CallExpr,
- { addData(S->getDirectCallee()->getQualifiedNameAsString()); })
+ DEF_ADD_DATA(CallExpr, {
+ // Function pointers don't have a callee and we just skip hashing it.
+ if (S->getDirectCallee())
+ addData(S->getDirectCallee()->getQualifiedNameAsString());
+ })
//--- Exceptions ---------------------------------------------------------//
DEF_ADD_DATA(CXXCatchStmt, { addData(S->getCaughtType()); })