[llvm] r261169 - Make sure functions are generated even there is no global in the C API echo test

Amaury Sechet via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 14:30:05 PST 2016


Author: deadalnix
Date: Wed Feb 17 16:30:05 2016
New Revision: 261169

URL: http://llvm.org/viewvc/llvm-project?rev=261169&view=rev
Log:
Make sure functions are generated even there is no global in the C API echo test

Modified:
    llvm/trunk/tools/llvm-c-test/echo.cpp

Modified: llvm/trunk/tools/llvm-c-test/echo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-c-test/echo.cpp?rev=261169&r1=261168&r2=261169&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-c-test/echo.cpp (original)
+++ llvm/trunk/tools/llvm-c-test/echo.cpp Wed Feb 17 16:30:05 2016
@@ -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(LLVMModuleRe
     Cur = Next;
   }
 
+FunDecl:
   Begin = LLVMGetFirstFunction(Src);
   End = LLVMGetLastFunction(Src);
   if (!Begin) {
@@ -687,14 +689,15 @@ static void declare_symbols(LLVMModuleRe
 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
     Cur = Next;
   }
 
+FunClone:
   Begin = LLVMGetFirstFunction(Src);
   End = LLVMGetLastFunction(Src);
   if (!Begin) {




More information about the llvm-commits mailing list