mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-22 07:43:18 +01:00
Work around an LLVM bug by not referring to globals from metadata. This was
only used for consistency checking anyway. For the LLVM bug, see http://llvm.org/PR4180 / http://llvm.org/PR4046
This commit is contained in:
@@ -15,7 +15,10 @@
|
||||
/// The fields in the metadata node for a TypeInfo instance.
|
||||
/// (Its name will be TD_PREFIX ~ <Name of TypeInfo global>)
|
||||
enum TypeDataFields {
|
||||
TD_Confirm, /// The TypeInfo this node is for
|
||||
// TD_Confirm is disabled for now due to an LLVM bug when MDNodes contain
|
||||
// globals (see http://llvm.org/PR4180 / http://llvm.org/PR4046 )
|
||||
TD_Confirm = -1,/// The TypeInfo this node is for.
|
||||
|
||||
TD_Type, /// A value of the LLVM type corresponding to this D type
|
||||
|
||||
// Must be kept last:
|
||||
|
||||
@@ -347,7 +347,7 @@ const Type* Analysis::getTypeFor(Value* typeinfo) const {
|
||||
return NULL;
|
||||
|
||||
if (node->getNumOperands() != TD_NumFields ||
|
||||
node->getOperand(TD_Confirm)->stripPointerCasts() != ti_global)
|
||||
(TD_Confirm >= 0 && node->getOperand(TD_Confirm)->stripPointerCasts() != ti_global))
|
||||
return NULL;
|
||||
|
||||
return node->getOperand(TD_Type)->getType();
|
||||
|
||||
@@ -295,7 +295,8 @@ void DtoResolveTypeInfo(TypeInfoDeclaration* tid)
|
||||
if (!meta && tid->tinfo->toBasetype()->ty < Terror) {
|
||||
// Construct the fields
|
||||
LLConstant* mdVals[TD_NumFields];
|
||||
mdVals[TD_Confirm] = llvm::cast<LLConstant>(irg->value);
|
||||
if (TD_Confirm >= 0)
|
||||
mdVals[TD_Confirm] = llvm::cast<LLConstant>(irg->value);
|
||||
mdVals[TD_Type] = llvm::UndefValue::get(DtoType(tid->tinfo));
|
||||
// Construct the metadata
|
||||
llvm::MDNode* metadata = llvm::MDNode::get(mdVals, TD_NumFields);
|
||||
|
||||
Reference in New Issue
Block a user