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 | cad151491e7df26b57eb6dc5daef19dfa8320fae (patch) | |
tree | 2d2d02551d90c94a97ea91936084f10c2b8504b7 /clang/lib/Analysis/CloneDetection.cpp | |
parent | 12e03aa5fe7e8e0eaf48214da270807b94c04a16 (diff) | |
download | bcm5719-llvm-cad151491e7df26b57eb6dc5daef19dfa8320fae.tar.gz bcm5719-llvm-cad151491e7df26b57eb6dc5daef19dfa8320fae.zip |
[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
llvm-svn: 278238
Diffstat (limited to 'clang/lib/Analysis/CloneDetection.cpp')
-rw-r--r-- | clang/lib/Analysis/CloneDetection.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Analysis/CloneDetection.cpp b/clang/lib/Analysis/CloneDetection.cpp index 038f9eb87cd..27815f30aea 100644 --- a/clang/lib/Analysis/CloneDetection.cpp +++ b/clang/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()); }) |