[pkg-d-commits] [ldc] 71/95: Fix LLVM 5.0 build. (#2050)
Matthias Klumpp
mak at moszumanska.debian.org
Thu Jul 13 20:54:02 UTC 2017
This is an automated email from the git hooks/post-receive script.
mak pushed a commit to annotated tag v1.3.0-beta1
in repository ldc.
commit 9e394e4f9954874c86e262a19c30e90e92d0c9d4
Author: Johan Engelen <jbc.engelen at gmail.com>
Date: Wed Mar 29 22:26:17 2017 +0200
Fix LLVM 5.0 build. (#2050)
llvm::AttributeSet was renamed to llvm::AttributeList
---
gen/attributes.cpp | 12 +++++-------
gen/attributes.h | 13 +++++++++----
gen/inlineir.cpp | 2 +-
gen/pgo.cpp | 4 ++++
gen/runtime.cpp | 13 ++++++-------
gen/tocall.cpp | 4 ++--
gen/uda.cpp | 8 ++++----
ir/irfunction.cpp | 4 ++--
8 files changed, 33 insertions(+), 27 deletions(-)
diff --git a/gen/attributes.cpp b/gen/attributes.cpp
index ef2688c..1525d6e 100644
--- a/gen/attributes.cpp
+++ b/gen/attributes.cpp
@@ -66,19 +66,17 @@ AttrSet::AttrSet(const AttrSet &base, unsigned index, LLAttribute attribute)
AttrSet
AttrSet::extractFunctionAndReturnAttributes(const llvm::Function *function) {
- AttrSet r;
-
- llvm::AttributeSet old = function->getAttributes();
- llvm::AttributeSet existingAttrs[] = {old.getFnAttributes(),
- old.getRetAttributes()};
- r.set = llvm::AttributeSet::get(gIR->context(), existingAttrs);
+ auto old = function->getAttributes();
+ LLAttributeSet existingAttrs[] = {old.getFnAttributes(),
+ old.getRetAttributes()};
+ AttrSet r(LLAttributeSet::get(gIR->context(), existingAttrs));
return r;
}
AttrSet &AttrSet::add(unsigned index, const AttrBuilder &builder) {
if (builder.hasAttributes()) {
- auto as = llvm::AttributeSet::get(gIR->context(), index, builder);
+ auto as = LLAttributeSet::get(gIR->context(), index, builder);
set = set.addAttributes(gIR->context(), index, as);
}
return *this;
diff --git a/gen/attributes.h b/gen/attributes.h
index 8c6164d..ca75936 100644
--- a/gen/attributes.h
+++ b/gen/attributes.h
@@ -13,6 +13,11 @@
#include "gen/llvm.h"
using LLAttribute = llvm::Attribute::AttrKind;
+#if LDC_LLVM_VER >= 500
+ using LLAttributeSet = llvm::AttributeList;
+#else
+ using LLAttributeSet = llvm::AttributeSet;
+#endif
class AttrBuilder {
llvm::AttrBuilder builder;
@@ -37,11 +42,11 @@ public:
};
class AttrSet {
- llvm::AttributeSet set;
+ LLAttributeSet set;
public:
AttrSet() = default;
- AttrSet(const llvm::AttributeSet &nativeSet) : set(nativeSet) {}
+ AttrSet(const LLAttributeSet &nativeSet) : set(nativeSet) {}
AttrSet(const AttrSet &base, unsigned index, LLAttribute attribute);
static AttrSet
@@ -50,8 +55,8 @@ public:
AttrSet &add(unsigned index, const AttrBuilder &builder);
AttrSet &merge(const AttrSet &other);
- operator llvm::AttributeSet &() { return set; }
- operator const llvm::AttributeSet &() const { return set; }
+ operator LLAttributeSet &() { return set; }
+ operator const LLAttributeSet &() const { return set; }
};
#endif
diff --git a/gen/inlineir.cpp b/gen/inlineir.cpp
index f6f2e41..66fac9a 100644
--- a/gen/inlineir.cpp
+++ b/gen/inlineir.cpp
@@ -38,7 +38,7 @@ struct TempDisableDiscardValueNames {
void copyFnAttributes(llvm::Function *wannabe, llvm::Function *idol) {
auto attrSet = idol->getAttributes();
auto fnAttrSet = attrSet.getFnAttributes();
- wannabe->addAttributes(llvm::AttributeSet::FunctionIndex, fnAttrSet);
+ wannabe->addAttributes(LLAttributeSet::FunctionIndex, fnAttrSet);
}
} // anonymous namespace
diff --git a/gen/pgo.cpp b/gen/pgo.cpp
index 35b9505..74d3822 100644
--- a/gen/pgo.cpp
+++ b/gen/pgo.cpp
@@ -143,8 +143,12 @@ public:
// Finalize the MD5 and return the hash.
llvm::MD5::MD5Result Result;
MD5.final(Result);
+#if LDC_LLVM_VER >= 500
+ return Result.low();
+#else
using namespace llvm::support;
return endian::read<uint64_t, little, unaligned>(Result);
+#endif
}
};
diff --git a/gen/runtime.cpp b/gen/runtime.cpp
index 726eea3..9f75b00 100644
--- a/gen/runtime.cpp
+++ b/gen/runtime.cpp
@@ -306,17 +306,16 @@ static void buildRuntimeModule() {
//////////////////////////////////////////////////////////////////////////////
// Construct some attribute lists used below (possibly multiple times)
- AttrSet NoAttrs, Attr_NoAlias(NoAttrs, llvm::AttributeSet::ReturnIndex,
+ AttrSet NoAttrs, Attr_NoAlias(NoAttrs, LLAttributeSet::ReturnIndex,
llvm::Attribute::NoAlias),
- Attr_NoUnwind(NoAttrs, llvm::AttributeSet::FunctionIndex,
+ Attr_NoUnwind(NoAttrs, LLAttributeSet::FunctionIndex,
llvm::Attribute::NoUnwind),
- Attr_ReadOnly(NoAttrs, llvm::AttributeSet::FunctionIndex,
+ Attr_ReadOnly(NoAttrs, LLAttributeSet::FunctionIndex,
llvm::Attribute::ReadOnly),
- Attr_Cold(NoAttrs, llvm::AttributeSet::FunctionIndex,
- llvm::Attribute::Cold),
- Attr_Cold_NoReturn(Attr_Cold, llvm::AttributeSet::FunctionIndex,
+ Attr_Cold(NoAttrs, LLAttributeSet::FunctionIndex, llvm::Attribute::Cold),
+ Attr_Cold_NoReturn(Attr_Cold, LLAttributeSet::FunctionIndex,
llvm::Attribute::NoReturn),
- Attr_ReadOnly_NoUnwind(Attr_ReadOnly, llvm::AttributeSet::FunctionIndex,
+ Attr_ReadOnly_NoUnwind(Attr_ReadOnly, LLAttributeSet::FunctionIndex,
llvm::Attribute::NoUnwind),
Attr_ReadOnly_1_NoCapture(Attr_ReadOnly, 1, llvm::Attribute::NoCapture),
Attr_ReadOnly_1_3_NoCapture(Attr_ReadOnly_1_NoCapture, 3,
diff --git a/gen/tocall.cpp b/gen/tocall.cpp
index 1c8a821..c76eac0 100644
--- a/gen/tocall.cpp
+++ b/gen/tocall.cpp
@@ -979,7 +979,7 @@ DValue *DtoCallFunctionImpl(Loc &loc, Type *resulttype, DValue *fnval,
}
// set calling convention and parameter attributes
- llvm::AttributeSet &attrlist = attrs;
+ LLAttributeSet &attrlist = attrs;
if (dfnval && dfnval->func) {
LLFunction *llfunc = llvm::dyn_cast<LLFunction>(DtoRVal(dfnval));
if (llfunc && llfunc->isIntrinsic()) // override intrinsic attrs
@@ -995,7 +995,7 @@ DValue *DtoCallFunctionImpl(Loc &loc, Type *resulttype, DValue *fnval,
}
// merge in function attributes set in callOrInvoke
attrlist = attrlist.addAttributes(
- gIR->context(), llvm::AttributeSet::FunctionIndex, call.getAttributes());
+ gIR->context(), LLAttributeSet::FunctionIndex, call.getAttributes());
call.setAttributes(attrlist);
diff --git a/gen/uda.cpp b/gen/uda.cpp
index ed6277e..69e7595 100644
--- a/gen/uda.cpp
+++ b/gen/uda.cpp
@@ -186,10 +186,10 @@ void applyAttrAllocSize(StructLiteralExp *sle, IrFunction *irFunc) {
} else {
builder.addAllocSizeAttr(llvmSizeIdx, llvm::Optional<unsigned>());
}
- func->addAttributes(llvm::AttributeSet::FunctionIndex,
- llvm::AttributeSet::get(func->getContext(),
- llvm::AttributeSet::FunctionIndex,
- builder));
+ func->addAttributes(LLAttributeSet::FunctionIndex,
+ LLAttributeSet::get(func->getContext(),
+ LLAttributeSet::FunctionIndex,
+ builder));
#endif
}
diff --git a/ir/irfunction.cpp b/ir/irfunction.cpp
index 096997c..22e7464 100644
--- a/ir/irfunction.cpp
+++ b/ir/irfunction.cpp
@@ -25,14 +25,14 @@ IrFunction::IrFunction(FuncDeclaration *fd) : FMF(opts::defaultFMF) {
}
void IrFunction::setNeverInline() {
- assert(!func->getAttributes().hasAttribute(llvm::AttributeSet::FunctionIndex,
+ assert(!func->getAttributes().hasAttribute(LLAttributeSet::FunctionIndex,
llvm::Attribute::AlwaysInline) &&
"function can't be never- and always-inline at the same time");
func->addFnAttr(llvm::Attribute::NoInline);
}
void IrFunction::setAlwaysInline() {
- assert(!func->getAttributes().hasAttribute(llvm::AttributeSet::FunctionIndex,
+ assert(!func->getAttributes().hasAttribute(LLAttributeSet::FunctionIndex,
llvm::Attribute::NoInline) &&
"function can't be never- and always-inline at the same time");
func->addFnAttr(llvm::Attribute::AlwaysInline);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git
More information about the pkg-d-commits
mailing list