llvm.org GIT mirror llvm / cd12c6c
Make sure functions are generated even there is no global in the C API echo test git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261169 91177308-0d34-0410-b5e6-96231b3b80d8 Amaury Sechet 4 years ago
1 changed file(s) with 14 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
624624 static void declare_symbols(LLVMModuleRef Src, LLVMModuleRef M) {
625625 LLVMValueRef Begin = LLVMGetFirstGlobal(Src);
626626 LLVMValueRef End = LLVMGetLastGlobal(Src);
627
628 LLVMValueRef Cur = Begin;
629 LLVMValueRef Next = nullptr;
627630 if (!Begin) {
628631 if (End != nullptr)
629632 report_fatal_error("Range has an end but no begining");
630 return;
631 }
632
633 LLVMValueRef Cur = Begin;
634 LLVMValueRef Next = nullptr;
633 goto FunDecl;
634 }
635
635636 while (true) {
636637 const char *Name = LLVMGetValueName(Cur);
637638 if (LLVMGetNamedGlobal(M, Name))
652653 Cur = Next;
653654 }
654655
656 FunDecl:
655657 Begin = LLVMGetFirstFunction(Src);
656658 End = LLVMGetLastFunction(Src);
657659 if (!Begin) {
686688 static void clone_symbols(LLVMModuleRef Src, LLVMModuleRef M) {
687689 LLVMValueRef Begin = LLVMGetFirstGlobal(Src);
688690 LLVMValueRef End = LLVMGetLastGlobal(Src);
691
692 LLVMValueRef Cur = Begin;
693 LLVMValueRef Next = nullptr;
689694 if (!Begin) {
690695 if (End != nullptr)
691696 report_fatal_error("Range has an end but no begining");
692 return;
693 }
694
695 LLVMValueRef Cur = Begin;
696 LLVMValueRef Next = nullptr;
697 goto FunClone;
698 }
699
697700 while (true) {
698701 const char *Name = LLVMGetValueName(Cur);
699702 LLVMValueRef G = LLVMGetNamedGlobal(M, Name);
726729 Cur = Next;
727730 }
728731
732 FunClone:
729733 Begin = LLVMGetFirstFunction(Src);
730734 End = LLVMGetLastFunction(Src);
731735 if (!Begin) {