summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-c-test
diff options
context:
space:
mode:
authorAmaury Sechet <deadalnix@gmail.com>2016-02-16 08:37:01 +0000
committerAmaury Sechet <deadalnix@gmail.com>2016-02-16 08:37:01 +0000
commitf447a6b5f4cb8a2da217d88b0dff5e95caa8a134 (patch)
tree1f0bb02dcd149d654ce199f6f4314d3ceedb0a1e /llvm/tools/llvm-c-test
parent6987e59cd1774a360965142d8ba66b6a3f4c83d0 (diff)
downloadbcm5719-llvm-f447a6b5f4cb8a2da217d88b0dff5e95caa8a134.tar.gz
bcm5719-llvm-f447a6b5f4cb8a2da217d88b0dff5e95caa8a134.zip
Make sure the functions' range is empty before going through it in the LLVM C API test
llvm-svn: 260947
Diffstat (limited to 'llvm/tools/llvm-c-test')
-rw-r--r--llvm/tools/llvm-c-test/echo.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/tools/llvm-c-test/echo.cpp b/llvm/tools/llvm-c-test/echo.cpp
index d13a51416f7..8ff75fb6de5 100644
--- a/llvm/tools/llvm-c-test/echo.cpp
+++ b/llvm/tools/llvm-c-test/echo.cpp
@@ -610,6 +610,11 @@ static void declare_function(LLVMValueRef Src, LLVMModuleRef M) {
static void clone_functions(LLVMModuleRef Src, LLVMModuleRef Dst) {
LLVMValueRef Begin = LLVMGetFirstFunction(Src);
LLVMValueRef End = LLVMGetLastFunction(Src);
+ if (!Begin) {
+ if (End != nullptr)
+ report_fatal_error("Range has an end but no start");
+ return;
+ }
// First pass, we declare all function
LLVMValueRef Cur = Begin;
OpenPOWER on IntegriCloud