Skip to content

Commit a78c0f1

Browse files
committed
rustllvm: Stub out some functions for llvm < 3.5
1 parent e10d674 commit a78c0f1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/rustllvm/RustWrapper.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ extern "C" void LLVMAddCallSiteAttribute(LLVMValueRef Instr, unsigned index, uin
113113
index, B)));
114114
}
115115

116+
117+
#if LLVM_VERSION_MINOR >= 5
116118
extern "C" void LLVMAddDereferenceableCallSiteAttr(LLVMValueRef Instr, unsigned idx, uint64_t b) {
117119
CallSite Call = CallSite(unwrap<Instruction>(Instr));
118120
AttrBuilder B;
@@ -122,6 +124,9 @@ extern "C" void LLVMAddDereferenceableCallSiteAttr(LLVMValueRef Instr, unsigned
122124
AttributeSet::get(Call->getContext(),
123125
idx, B)));
124126
}
127+
#else
128+
extern "C" void LLVMAddDereferenceableCallSiteAttr(LLVMValueRef, unsigned, uint64_t) {}
129+
#endif
125130

126131
extern "C" void LLVMAddFunctionAttribute(LLVMValueRef Fn, unsigned index, uint64_t Val) {
127132
Function *A = unwrap<Function>(Fn);
@@ -130,12 +135,16 @@ extern "C" void LLVMAddFunctionAttribute(LLVMValueRef Fn, unsigned index, uint64
130135
A->addAttributes(index, AttributeSet::get(A->getContext(), index, B));
131136
}
132137

138+
#if LLVM_VERSION_MINOR >= 5
133139
extern "C" void LLVMAddDereferenceableAttr(LLVMValueRef Fn, unsigned index, uint64_t bytes) {
134140
Function *A = unwrap<Function>(Fn);
135141
AttrBuilder B;
136142
B.addDereferenceableAttr(bytes);
137143
A->addAttributes(index, AttributeSet::get(A->getContext(), index, B));
138144
}
145+
#else
146+
extern "C" void LLVMAddDereferenceableAttr(LLVMValueRef, unsigned, uint64_t) {}
147+
#endif
139148

140149
extern "C" void LLVMAddFunctionAttrString(LLVMValueRef Fn, unsigned index, const char *Name) {
141150
Function *F = unwrap<Function>(Fn);

0 commit comments

Comments
 (0)