@@ -174,8 +174,9 @@ static ValueMap clone_params(LLVMValueRef Src, LLVMValueRef Dst) {
174
174
LLVMValueRef SrcNext = nullptr ;
175
175
LLVMValueRef DstNext = nullptr ;
176
176
while (true ) {
177
- const char *Name = LLVMGetValueName (SrcCur);
178
- LLVMSetValueName (DstCur, Name);
177
+ size_t NameLen;
178
+ const char *Name = LLVMGetValueName2 (SrcCur, &NameLen);
179
+ LLVMSetValueName2 (DstCur, Name, NameLen);
179
180
180
181
VMap[SrcCur] = DstCur;
181
182
@@ -232,7 +233,8 @@ static LLVMValueRef clone_constant_impl(LLVMValueRef Cst, LLVMModuleRef M) {
232
233
233
234
// Maybe it is a symbol
234
235
if (LLVMIsAGlobalValue (Cst)) {
235
- const char *Name = LLVMGetValueName (Cst);
236
+ size_t NameLen;
237
+ const char *Name = LLVMGetValueName2 (Cst, &NameLen);
236
238
237
239
// Try function
238
240
if (LLVMIsAFunction (Cst)) {
@@ -402,7 +404,8 @@ struct FunCloner {
402
404
if (!LLVMIsAInstruction (Src))
403
405
report_fatal_error (" Expected an instruction" );
404
406
405
- const char *Name = LLVMGetValueName (Src);
407
+ size_t NameLen;
408
+ const char *Name = LLVMGetValueName2 (Src, &NameLen);
406
409
407
410
// Check if this is something we already computed.
408
411
{
@@ -734,7 +737,8 @@ struct FunCloner {
734
737
report_fatal_error (" Basic block is not a basic block" );
735
738
736
739
const char *Name = LLVMGetBasicBlockName (Src);
737
- const char *VName = LLVMGetValueName (V);
740
+ size_t NameLen;
741
+ const char *VName = LLVMGetValueName2 (V, &NameLen);
738
742
if (Name != VName)
739
743
report_fatal_error (" Basic block name mismatch" );
740
744
@@ -830,7 +834,8 @@ static void declare_symbols(LLVMModuleRef Src, LLVMModuleRef M) {
830
834
}
831
835
832
836
while (true ) {
833
- const char *Name = LLVMGetValueName (Cur);
837
+ size_t NameLen;
838
+ const char *Name = LLVMGetValueName2 (Cur, &NameLen);
834
839
if (LLVMGetNamedGlobal (M, Name))
835
840
report_fatal_error (" GlobalVariable already cloned" );
836
841
LLVMAddGlobal (M, LLVMGetElementType (TypeCloner (M).Clone (Cur)), Name);
@@ -863,7 +868,8 @@ static void declare_symbols(LLVMModuleRef Src, LLVMModuleRef M) {
863
868
Cur = Begin;
864
869
Next = nullptr ;
865
870
while (true ) {
866
- const char *Name = LLVMGetValueName (Cur);
871
+ size_t NameLen;
872
+ const char *Name = LLVMGetValueName2 (Cur, &NameLen);
867
873
if (LLVMGetNamedFunction (M, Name))
868
874
report_fatal_error (" Function already cloned" );
869
875
auto Ty = LLVMGetElementType (TypeCloner (M).Clone (Cur));
@@ -909,7 +915,8 @@ static void clone_symbols(LLVMModuleRef Src, LLVMModuleRef M) {
909
915
}
910
916
911
917
while (true ) {
912
- const char *Name = LLVMGetValueName (Cur);
918
+ size_t NameLen;
919
+ const char *Name = LLVMGetValueName2 (Cur, &NameLen);
913
920
LLVMValueRef G = LLVMGetNamedGlobal (M, Name);
914
921
if (!G)
915
922
report_fatal_error (" GlobalVariable must have been declared already" );
@@ -952,13 +959,16 @@ static void clone_symbols(LLVMModuleRef Src, LLVMModuleRef M) {
952
959
Cur = Begin;
953
960
Next = nullptr ;
954
961
while (true ) {
955
- const char *Name = LLVMGetValueName (Cur);
962
+ size_t NameLen;
963
+ const char *Name = LLVMGetValueName2 (Cur, &NameLen);
956
964
LLVMValueRef Fun = LLVMGetNamedFunction (M, Name);
957
965
if (!Fun)
958
966
report_fatal_error (" Function must have been declared already" );
959
967
960
968
if (LLVMHasPersonalityFn (Cur)) {
961
- const char *FName = LLVMGetValueName (LLVMGetPersonalityFn (Cur));
969
+ size_t FNameLen;
970
+ const char *FName = LLVMGetValueName2 (LLVMGetPersonalityFn (Cur),
971
+ &FNameLen);
962
972
LLVMValueRef P = LLVMGetNamedFunction (M, FName);
963
973
if (!P)
964
974
report_fatal_error (" Could not find personality function" );
0 commit comments