Fix LLVM trunk compatibility.

main
theraven 15 years ago
parent 34f7baf8d7
commit 81131acfbc

@ -27,3 +27,19 @@ MDNode* CreateMDNode(LLVMContext &C,
return MDNode::get(C, val);
#endif
}
#if LLVM_MAJOR < 3
#define GetStructType(context, ...) StructType::get(context, __VA_ARGS__)
#else
#define GetStructType(context, ...) StructType::get(__VA_ARGS__)
#endif
__attribute((unused)) static inline
Constant* GetConstantStruct(LLVMContext &C, const std::vector<Constant*>
&V, bool Packed) {
#if LLVM_MAJOR < 3
return ConstantStruct::get(C, V, Packed);
#else
return ConstantStruct::getAnon(C, V, Packed);
#endif
}

@ -3,6 +3,6 @@ LIBRARYNAME = libGNUObjCRuntime
LOADABLE_MODULE = 1
USEDLIBS =
CPPFLAGS += `llvm-config --version | sed 's/\([0-9]*\).\([0-9]*\).*/-DLLVM_MAJOR=\1 -DLLVM_MINOR=\2/'`
CPPFLAGS += -Wno-variadic-macros
include $(LEVEL)/Makefile.common

@ -9,6 +9,7 @@
#include <vector>
using namespace llvm;
#include "LLVMCompat.h"
namespace {
struct GNUObjCTypeFeedback : public ModulePass {
@ -113,7 +114,7 @@ namespace {
std::vector<Constant*> CSVals;
CSVals.push_back(ConstantInt::get(Type::getInt32Ty(VMContext),65535));
CSVals.push_back(init);
ctors.push_back(ConstantStruct::get(GCL->getContext(), CSVals, false));
ctors.push_back(GetConstantStruct(GCL->getContext(), CSVals, false));
// Create the array initializer.
CA = cast<ConstantArray>(ConstantArray::get(ArrayType::get(ctorTy,
ctors.size()), ctors));

Loading…
Cancel
Save