summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-c-test/echo.cpp
diff options
context:
space:
mode:
authorAmaury Sechet <deadalnix@gmail.com>2016-02-17 22:30:05 +0000
committerAmaury Sechet <deadalnix@gmail.com>2016-02-17 22:30:05 +0000
commit58946a9a05b46dcdfea50da7f50aef2ebd95d38e (patch)
treed7ac3b0e3fbcc31785e305883ecaa837a15a42c5 /llvm/tools/llvm-c-test/echo.cpp
parent3b89e6634c33188e5635416d181d9ca33fcbcc65 (diff)
downloadbcm5719-llvm-58946a9a05b46dcdfea50da7f50aef2ebd95d38e.tar.gz
bcm5719-llvm-58946a9a05b46dcdfea50da7f50aef2ebd95d38e.zip
Make sure functions are generated even there is no global in the C API echo test
llvm-svn: 261169
Diffstat (limited to 'llvm/tools/llvm-c-test/echo.cpp')
-rw-r--r--llvm/tools/llvm-c-test/echo.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/tools/llvm-c-test/echo.cpp b/llvm/tools/llvm-c-test/echo.cpp
index b926c8124f0..1aa6a762dc4 100644
--- a/llvm/tools/llvm-c-test/echo.cpp
+++ b/llvm/tools/llvm-c-test/echo.cpp
@@ -625,14 +625,15 @@ struct FunCloner {
static void declare_symbols(LLVMModuleRef Src, LLVMModuleRef M) {
LLVMValueRef Begin = LLVMGetFirstGlobal(Src);
LLVMValueRef End = LLVMGetLastGlobal(Src);
+
+ LLVMValueRef Cur = Begin;
+ LLVMValueRef Next = nullptr;
if (!Begin) {
if (End != nullptr)
report_fatal_error("Range has an end but no begining");
- return;
+ goto FunDecl;
}
- LLVMValueRef Cur = Begin;
- LLVMValueRef Next = nullptr;
while (true) {
const char *Name = LLVMGetValueName(Cur);
if (LLVMGetNamedGlobal(M, Name))
@@ -653,6 +654,7 @@ static void declare_symbols(LLVMModuleRef Src, LLVMModuleRef M) {
Cur = Next;
}
+FunDecl:
Begin = LLVMGetFirstFunction(Src);
End = LLVMGetLastFunction(Src);
if (!Begin) {
@@ -687,14 +689,15 @@ static void declare_symbols(LLVMModuleRef Src, LLVMModuleRef M) {
static void clone_symbols(LLVMModuleRef Src, LLVMModuleRef M) {
LLVMValueRef Begin = LLVMGetFirstGlobal(Src);
LLVMValueRef End = LLVMGetLastGlobal(Src);
+
+ LLVMValueRef Cur = Begin;
+ LLVMValueRef Next = nullptr;
if (!Begin) {
if (End != nullptr)
report_fatal_error("Range has an end but no begining");
- return;
+ goto FunClone;
}
- LLVMValueRef Cur = Begin;
- LLVMValueRef Next = nullptr;
while (true) {
const char *Name = LLVMGetValueName(Cur);
LLVMValueRef G = LLVMGetNamedGlobal(M, Name);
@@ -727,6 +730,7 @@ static void clone_symbols(LLVMModuleRef Src, LLVMModuleRef M) {
Cur = Next;
}
+FunClone:
Begin = LLVMGetFirstFunction(Src);
End = LLVMGetLastFunction(Src);
if (!Begin) {
OpenPOWER on IntegriCloud