[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
diff --git a/clang/test/Analysis/copypaste/call.cpp b/clang/test/Analysis/copypaste/call.cpp
index 06aa633..0c10262 100644
--- a/clang/test/Analysis/copypaste/call.cpp
+++ b/clang/test/Analysis/copypaste/call.cpp
@@ -22,3 +22,15 @@
return b();
return true;
}
+
+// Test that we don't crash on function pointer calls
+
+bool (*funcPtr)(int);
+
+bool fooPtr1(int x) {
+ if (x > 0)
+ return false;
+ else if (x < 0)
+ return funcPtr(1);
+ return true;
+}