diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2016-08-10 16:25:16 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2016-08-10 16:25:16 +0000 |
commit | a7e2299971866bedeaa99cc989b04134c2bde18a (patch) | |
tree | ef86c2ea9baa198c5e3e16aed2b8d72e980fcbd5 /lib/Analysis/CloneDetection.cpp | |
parent | 8896df9583fcf0b8b1986c6fab14a7b907651838 (diff) | |
download | clang-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.cpp | 7 |
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()); }) |