llvm.org GIT mirror llvm / 6c702a8
[LLVM-C] Fix broken build bots Summary: Fix broken bots caused by the merge of D51522. Reviewers: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D52657 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343334 91177308-0d34-0410-b5e6-96231b3b80d8 Robert Widmann 1 year, 1 month ago
1 changed file(s) with 25 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
869869 MDNode *N = Val ? extractMDNode(unwrap(Val)) : nullptr;
870870
871871 unwrap(Inst)->setMetadata(KindID, N);
872 }
873
874 struct LLVMOpaqueValueMetadataEntry {
875 unsigned Kind;
876 LLVMMetadataRef Metadata;
877 };
878
879 using MetadataEntries = SmallVectorImpl>;
880 static LLVMValueMetadataEntry *
881 llvm_getMetadata(size_t *NumEntries,
882 llvm::function_ref AccessMD) {
883 SmallVector, 8> MVEs;
884 AccessMD(MVEs);
885
886 LLVMOpaqueValueMetadataEntry *Result =
887 static_cast(
888 safe_malloc(MVEs.size() * sizeof(LLVMOpaqueValueMetadataEntry)));
889 for (unsigned i = 0; i < MVEs.size(); ++i) {
890 const auto &ModuleFlag = MVEs[i];
891 Result[i].Kind = ModuleFlag.first;
892 Result[i].Metadata = wrap(ModuleFlag.second);
893 }
894 *NumEntries = MVEs.size();
895 return Result;
872896 }
873897
874898 LLVMValueMetadataEntry *
18831907 "only GlobalValue, AllocaInst, LoadInst and StoreInst have alignment");
18841908 }
18851909
1886 struct LLVMOpaqueValueMetadataEntry {
1887 unsigned Kind;
1888 LLVMMetadataRef Metadata;
1889 };
1890
1891 using MetadataEntries = SmallVectorImpl>;
1892 static LLVMValueMetadataEntry *
1893 llvm_getMetadata(size_t *NumEntries,
1894 llvm::function_ref AccessMD) {
1895 SmallVector, 8> MVEs;
1896 AccessMD(MVEs);
1897
1898 LLVMOpaqueValueMetadataEntry *Result =
1899 static_cast(
1900 safe_malloc(MVEs.size() * sizeof(LLVMOpaqueValueMetadataEntry)));
1901 for (unsigned i = 0; i < MVEs.size(); ++i) {
1902 const auto &ModuleFlag = MVEs[i];
1903 Result[i].Kind = ModuleFlag.first;
1904 Result[i].Metadata = wrap(ModuleFlag.second);
1905 }
1906 *NumEntries = MVEs.size();
1907 return Result;
1908 }
1909
19101910 LLVMValueMetadataEntry *LLVMGlobalCopyAllMetadata(LLVMValueRef Value,
19111911 size_t *NumEntries) {
19121912 return llvm_getMetadata(NumEntries, [&Value](MetadataEntries &Entries) {
19391939
19401940 void LLVMGlobalSetMetadata(LLVMValueRef Global, unsigned Kind,
19411941 LLVMMetadataRef MD) {
1942 unwrap(Global)->setMetadata(Kind, unwrapDI(MD));
1942 unwrap(Global)->setMetadata(Kind, unwrap(MD));
19431943 }
19441944
19451945 void LLVMGlobalEraseMetadata(LLVMValueRef Global, unsigned Kind) {