mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
IR: Drop scope from MDTemplateParameter
Follow-up to r229740, which removed `DITemplate*::getContext()` after my upgrade script revealed that scopes are always `nullptr` for template parameters. This is the other shoe: drop `scope:` from `MDTemplateParameter` and its two subclasses. (Note: a bitcode upgrade would be pointless, since the hierarchy hasn't been moved into place.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229791 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a3fa104c8c
commit
eac950e408
@ -1156,11 +1156,6 @@ public:
|
||||
};
|
||||
|
||||
/// \brief Base class for template parameters.
|
||||
///
|
||||
/// TODO: Remove the scope. It's always the compile unit, and never
|
||||
/// referenced.
|
||||
/// TODO: Remove File, Line and Column. They're always 0 and never
|
||||
/// referenced.
|
||||
class MDTemplateParameter : public DebugNode {
|
||||
protected:
|
||||
MDTemplateParameter(LLVMContext &Context, unsigned ID, StorageType Storage,
|
||||
@ -1169,11 +1164,10 @@ protected:
|
||||
~MDTemplateParameter() {}
|
||||
|
||||
public:
|
||||
Metadata *getScope() const { return getOperand(0); }
|
||||
StringRef getName() const { return getStringOperand(1); }
|
||||
Metadata *getType() const { return getOperand(2); }
|
||||
StringRef getName() const { return getStringOperand(0); }
|
||||
Metadata *getType() const { return getOperand(1); }
|
||||
|
||||
MDString *getRawName() const { return getOperandAs<MDString>(1); }
|
||||
MDString *getRawName() const { return getOperandAs<MDString>(0); }
|
||||
|
||||
static bool classof(const Metadata *MD) {
|
||||
return MD->getMetadataID() == MDTemplateTypeParameterKind ||
|
||||
@ -1191,29 +1185,25 @@ class MDTemplateTypeParameter : public MDTemplateParameter {
|
||||
dwarf::DW_TAG_template_type_parameter, Ops) {}
|
||||
~MDTemplateTypeParameter() {}
|
||||
|
||||
static MDTemplateTypeParameter *getImpl(LLVMContext &Context, Metadata *Scope,
|
||||
StringRef Name, Metadata *Type,
|
||||
StorageType Storage,
|
||||
static MDTemplateTypeParameter *getImpl(LLVMContext &Context, StringRef Name,
|
||||
Metadata *Type, StorageType Storage,
|
||||
bool ShouldCreate = true) {
|
||||
return getImpl(Context, Scope, getCanonicalMDString(Context, Name), Type,
|
||||
Storage, ShouldCreate);
|
||||
return getImpl(Context, getCanonicalMDString(Context, Name), Type, Storage,
|
||||
ShouldCreate);
|
||||
}
|
||||
static MDTemplateTypeParameter *getImpl(LLVMContext &Context, Metadata *Scope,
|
||||
MDString *Name, Metadata *Type,
|
||||
StorageType Storage,
|
||||
static MDTemplateTypeParameter *getImpl(LLVMContext &Context, MDString *Name,
|
||||
Metadata *Type, StorageType Storage,
|
||||
bool ShouldCreate = true);
|
||||
|
||||
TempMDTemplateTypeParameter cloneImpl() const {
|
||||
return getTemporary(getContext(), getScope(), getName(), getType());
|
||||
return getTemporary(getContext(), getName(), getType());
|
||||
}
|
||||
|
||||
public:
|
||||
DEFINE_MDNODE_GET(MDTemplateTypeParameter,
|
||||
(Metadata * Scope, StringRef Name, Metadata *Type),
|
||||
(Scope, Name, Type))
|
||||
DEFINE_MDNODE_GET(MDTemplateTypeParameter,
|
||||
(Metadata * Scope, MDString *Name, Metadata *Type),
|
||||
(Scope, Name, Type))
|
||||
DEFINE_MDNODE_GET(MDTemplateTypeParameter, (StringRef Name, Metadata *Type),
|
||||
(Name, Type))
|
||||
DEFINE_MDNODE_GET(MDTemplateTypeParameter, (MDString * Name, Metadata *Type),
|
||||
(Name, Type))
|
||||
|
||||
TempMDTemplateTypeParameter clone() const { return cloneImpl(); }
|
||||
|
||||
@ -1233,37 +1223,33 @@ class MDTemplateValueParameter : public MDTemplateParameter {
|
||||
~MDTemplateValueParameter() {}
|
||||
|
||||
static MDTemplateValueParameter *getImpl(LLVMContext &Context, unsigned Tag,
|
||||
Metadata *Scope, StringRef Name,
|
||||
Metadata *Type, Metadata *Value,
|
||||
StorageType Storage,
|
||||
StringRef Name, Metadata *Type,
|
||||
Metadata *Value, StorageType Storage,
|
||||
bool ShouldCreate = true) {
|
||||
return getImpl(Context, Tag, Scope, getCanonicalMDString(Context, Name),
|
||||
Type, Value, Storage, ShouldCreate);
|
||||
return getImpl(Context, Tag, getCanonicalMDString(Context, Name), Type,
|
||||
Value, Storage, ShouldCreate);
|
||||
}
|
||||
static MDTemplateValueParameter *getImpl(LLVMContext &Context, unsigned Tag,
|
||||
Metadata *Scope, MDString *Name,
|
||||
Metadata *Type, Metadata *Value,
|
||||
StorageType Storage,
|
||||
MDString *Name, Metadata *Type,
|
||||
Metadata *Value, StorageType Storage,
|
||||
bool ShouldCreate = true);
|
||||
|
||||
TempMDTemplateValueParameter cloneImpl() const {
|
||||
return getTemporary(getContext(), getTag(), getScope(), getName(),
|
||||
getType(), getValue());
|
||||
return getTemporary(getContext(), getTag(), getName(), getType(),
|
||||
getValue());
|
||||
}
|
||||
|
||||
public:
|
||||
DEFINE_MDNODE_GET(MDTemplateValueParameter,
|
||||
(unsigned Tag, Metadata *Scope, StringRef Name,
|
||||
Metadata *Type, Metadata *Value),
|
||||
(Tag, Scope, Name, Type, Value))
|
||||
DEFINE_MDNODE_GET(MDTemplateValueParameter,
|
||||
(unsigned Tag, Metadata *Scope, MDString *Name,
|
||||
Metadata *Type, Metadata *Value),
|
||||
(Tag, Scope, Name, Type, Value))
|
||||
DEFINE_MDNODE_GET(MDTemplateValueParameter, (unsigned Tag, StringRef Name,
|
||||
Metadata *Type, Metadata *Value),
|
||||
(Tag, Name, Type, Value))
|
||||
DEFINE_MDNODE_GET(MDTemplateValueParameter, (unsigned Tag, MDString *Name,
|
||||
Metadata *Type, Metadata *Value),
|
||||
(Tag, Name, Type, Value))
|
||||
|
||||
TempMDTemplateValueParameter clone() const { return cloneImpl(); }
|
||||
|
||||
Metadata *getValue() const { return getOperand(3); }
|
||||
Metadata *getValue() const { return getOperand(2); }
|
||||
|
||||
static bool classof(const Metadata *MD) {
|
||||
return MD->getMetadataID() == MDTemplateValueParameterKind;
|
||||
|
@ -3515,37 +3515,33 @@ bool LLParser::ParseMDNamespace(MDNode *&Result, bool IsDistinct) {
|
||||
}
|
||||
|
||||
/// ParseMDTemplateTypeParameter:
|
||||
/// ::= !MDTemplateTypeParameter(scope: !0, name: "Ty", type: !1)
|
||||
/// ::= !MDTemplateTypeParameter(name: "Ty", type: !1)
|
||||
bool LLParser::ParseMDTemplateTypeParameter(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(scope, MDField, ); \
|
||||
OPTIONAL(name, MDStringField, ); \
|
||||
REQUIRED(type, MDField, );
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(MDTemplateTypeParameter,
|
||||
(Context, scope.Val, name.Val, type.Val));
|
||||
Result =
|
||||
GET_OR_DISTINCT(MDTemplateTypeParameter, (Context, name.Val, type.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseMDTemplateValueParameter:
|
||||
/// ::= !MDTemplateValueParameter(tag: DW_TAG_template_value_parameter,
|
||||
/// scope: !0, name: "V", type: !1,
|
||||
/// value: i32 7)
|
||||
/// name: "V", type: !1, value: i32 7)
|
||||
bool LLParser::ParseMDTemplateValueParameter(MDNode *&Result, bool IsDistinct) {
|
||||
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
|
||||
REQUIRED(tag, DwarfTagField, ); \
|
||||
REQUIRED(scope, MDField, ); \
|
||||
OPTIONAL(name, MDStringField, ); \
|
||||
REQUIRED(type, MDField, ); \
|
||||
REQUIRED(value, MDField, );
|
||||
PARSE_MD_FIELDS();
|
||||
#undef VISIT_MD_FIELDS
|
||||
|
||||
Result = GET_OR_DISTINCT(
|
||||
MDTemplateValueParameter,
|
||||
(Context, tag.Val, scope.Val, name.Val, type.Val, value.Val));
|
||||
Result = GET_OR_DISTINCT(MDTemplateValueParameter,
|
||||
(Context, tag.Val, name.Val, type.Val, value.Val));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1515,25 +1515,24 @@ std::error_code BitcodeReader::ParseMetadata() {
|
||||
break;
|
||||
}
|
||||
case bitc::METADATA_TEMPLATE_TYPE: {
|
||||
if (Record.size() != 4)
|
||||
if (Record.size() != 3)
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDTemplateTypeParameter, Record[0],
|
||||
(Context, getMDOrNull(Record[1]),
|
||||
getMDString(Record[2]), getMDOrNull(Record[3]))),
|
||||
NextMDValueNo++);
|
||||
MDValueList.AssignValue(GET_OR_DISTINCT(MDTemplateTypeParameter,
|
||||
Record[0],
|
||||
(Context, getMDString(Record[1]),
|
||||
getMDOrNull(Record[2]))),
|
||||
NextMDValueNo++);
|
||||
break;
|
||||
}
|
||||
case bitc::METADATA_TEMPLATE_VALUE: {
|
||||
if (Record.size() != 6)
|
||||
if (Record.size() != 5)
|
||||
return Error("Invalid record");
|
||||
|
||||
MDValueList.AssignValue(
|
||||
GET_OR_DISTINCT(MDTemplateValueParameter, Record[0],
|
||||
(Context, Record[1], getMDOrNull(Record[2]),
|
||||
getMDString(Record[3]), getMDOrNull(Record[4]),
|
||||
getMDOrNull(Record[5]))),
|
||||
(Context, Record[1], getMDString(Record[2]),
|
||||
getMDOrNull(Record[3]), getMDOrNull(Record[4]))),
|
||||
NextMDValueNo++);
|
||||
break;
|
||||
}
|
||||
|
@ -1027,7 +1027,6 @@ static void WriteMDTemplateTypeParameter(const MDTemplateTypeParameter *N,
|
||||
SmallVectorImpl<uint64_t> &Record,
|
||||
unsigned Abbrev) {
|
||||
Record.push_back(N->isDistinct());
|
||||
Record.push_back(VE.getMetadataOrNullID(N->getScope()));
|
||||
Record.push_back(VE.getMetadataOrNullID(N->getRawName()));
|
||||
Record.push_back(VE.getMetadataOrNullID(N->getType()));
|
||||
|
||||
@ -1042,7 +1041,6 @@ static void WriteMDTemplateValueParameter(const MDTemplateValueParameter *N,
|
||||
unsigned Abbrev) {
|
||||
Record.push_back(N->isDistinct());
|
||||
Record.push_back(N->getTag());
|
||||
Record.push_back(VE.getMetadataOrNullID(N->getScope()));
|
||||
Record.push_back(VE.getMetadataOrNullID(N->getRawName()));
|
||||
Record.push_back(VE.getMetadataOrNullID(N->getType()));
|
||||
Record.push_back(VE.getMetadataOrNullID(N->getValue()));
|
||||
|
@ -1685,8 +1685,6 @@ static void writeMDTemplateTypeParameter(raw_ostream &Out,
|
||||
const Module *Context) {
|
||||
Out << "!MDTemplateTypeParameter(";
|
||||
FieldSeparator FS;
|
||||
Out << FS << "scope: ";
|
||||
writeMetadataAsOperand(Out, N->getScope(), TypePrinter, Machine, Context);
|
||||
Out << FS << "name: \"" << N->getName() << "\"";
|
||||
Out << FS << "type: ";
|
||||
writeMetadataAsOperand(Out, N->getType(), TypePrinter, Machine, Context);
|
||||
@ -1701,8 +1699,6 @@ static void writeMDTemplateValueParameter(raw_ostream &Out,
|
||||
Out << "!MDTemplateValueParameter(";
|
||||
FieldSeparator FS;
|
||||
writeTag(Out, FS, N);
|
||||
Out << FS << "scope: ";
|
||||
writeMetadataAsOperand(Out, N->getScope(), TypePrinter, Machine, Context);
|
||||
Out << FS << "name: \"" << N->getName() << "\"";
|
||||
Out << FS << "type: ";
|
||||
writeMetadataAsOperand(Out, N->getType(), TypePrinter, Machine, Context);
|
||||
|
@ -298,24 +298,24 @@ MDNamespace *MDNamespace::getImpl(LLVMContext &Context, Metadata *Scope,
|
||||
DEFINE_GETIMPL_STORE(MDNamespace, (Line), Ops);
|
||||
}
|
||||
|
||||
MDTemplateTypeParameter *
|
||||
MDTemplateTypeParameter::getImpl(LLVMContext &Context, Metadata *Scope,
|
||||
MDString *Name, Metadata *Type,
|
||||
StorageType Storage, bool ShouldCreate) {
|
||||
MDTemplateTypeParameter *MDTemplateTypeParameter::getImpl(LLVMContext &Context,
|
||||
MDString *Name,
|
||||
Metadata *Type,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDTemplateTypeParameter,
|
||||
(Scope, getString(Name), Type));
|
||||
Metadata *Ops[] = {Scope, Name, Type};
|
||||
DEFINE_GETIMPL_LOOKUP(MDTemplateTypeParameter, (getString(Name), Type));
|
||||
Metadata *Ops[] = {Name, Type};
|
||||
DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(MDTemplateTypeParameter, Ops);
|
||||
}
|
||||
|
||||
MDTemplateValueParameter *MDTemplateValueParameter::getImpl(
|
||||
LLVMContext &Context, unsigned Tag, Metadata *Scope, MDString *Name,
|
||||
Metadata *Type, Metadata *Value, StorageType Storage, bool ShouldCreate) {
|
||||
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type,
|
||||
Metadata *Value, StorageType Storage, bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(MDTemplateValueParameter,
|
||||
(Tag, Scope, getString(Name), Type, Value));
|
||||
Metadata *Ops[] = {Scope, Name, Type, Value};
|
||||
(Tag, getString(Name), Type, Value));
|
||||
Metadata *Ops[] = {Name, Type, Value};
|
||||
DEFINE_GETIMPL_STORE(MDTemplateValueParameter, (Tag), Ops);
|
||||
}
|
||||
|
||||
|
@ -646,44 +646,36 @@ template <> struct MDNodeKeyImpl<MDNamespace> {
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDTemplateTypeParameter> {
|
||||
Metadata *Scope;
|
||||
StringRef Name;
|
||||
Metadata *Type;
|
||||
|
||||
MDNodeKeyImpl(Metadata *Scope, StringRef Name, Metadata *Type)
|
||||
: Scope(Scope), Name(Name), Type(Type) {}
|
||||
MDNodeKeyImpl(StringRef Name, Metadata *Type) : Name(Name), Type(Type) {}
|
||||
MDNodeKeyImpl(const MDTemplateTypeParameter *N)
|
||||
: Scope(N->getScope()), Name(N->getName()), Type(N->getType()) {}
|
||||
: Name(N->getName()), Type(N->getType()) {}
|
||||
|
||||
bool isKeyOf(const MDTemplateTypeParameter *RHS) const {
|
||||
return Scope == RHS->getScope() && Name == RHS->getName() &&
|
||||
Type == RHS->getType();
|
||||
return Name == RHS->getName() && Type == RHS->getType();
|
||||
}
|
||||
unsigned getHashValue() const { return hash_combine(Scope, Name, Type); }
|
||||
unsigned getHashValue() const { return hash_combine(Name, Type); }
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDTemplateValueParameter> {
|
||||
unsigned Tag;
|
||||
Metadata *Scope;
|
||||
StringRef Name;
|
||||
Metadata *Type;
|
||||
Metadata *Value;
|
||||
|
||||
MDNodeKeyImpl(unsigned Tag, Metadata *Scope, StringRef Name, Metadata *Type,
|
||||
Metadata *Value)
|
||||
: Tag(Tag), Scope(Scope), Name(Name), Type(Type), Value(Value) {}
|
||||
MDNodeKeyImpl(unsigned Tag, StringRef Name, Metadata *Type, Metadata *Value)
|
||||
: Tag(Tag), Name(Name), Type(Type), Value(Value) {}
|
||||
MDNodeKeyImpl(const MDTemplateValueParameter *N)
|
||||
: Tag(N->getTag()), Scope(N->getScope()), Name(N->getName()),
|
||||
Type(N->getType()), Value(N->getValue()) {}
|
||||
: Tag(N->getTag()), Name(N->getName()), Type(N->getType()),
|
||||
Value(N->getValue()) {}
|
||||
|
||||
bool isKeyOf(const MDTemplateValueParameter *RHS) const {
|
||||
return Tag == RHS->getTag() && Scope == RHS->getScope() &&
|
||||
Name == RHS->getName() && Type == RHS->getType() &&
|
||||
Value == RHS->getValue();
|
||||
}
|
||||
unsigned getHashValue() const {
|
||||
return hash_combine(Tag, Scope, Name, Type, Value);
|
||||
return Tag == RHS->getTag() && Name == RHS->getName() &&
|
||||
Type == RHS->getType() && Value == RHS->getValue();
|
||||
}
|
||||
unsigned getHashValue() const { return hash_combine(Tag, Name, Type, Value); }
|
||||
};
|
||||
|
||||
template <> struct MDNodeKeyImpl<MDGlobalVariable> {
|
||||
|
@ -1,4 +0,0 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+1]]:40: error: missing required field 'scope'
|
||||
!0 = !MDTemplateTypeParameter(type: !{})
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+1]]:41: error: missing required field 'type'
|
||||
!0 = !MDTemplateTypeParameter(scope: !{})
|
||||
; CHECK: [[@LINE+1]]:44: error: missing required field 'type'
|
||||
!0 = !MDTemplateTypeParameter(name: "param")
|
||||
|
@ -1,5 +0,0 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+2]]:44: error: missing required field 'scope'
|
||||
!0 = !MDTemplateValueParameter(tag: DW_TAG_template_value_parameter, type: !{},
|
||||
value: i32 7)
|
@ -1,4 +1,4 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+1]]:67: error: missing required field 'tag'
|
||||
!0 = !MDTemplateValueParameter(scope: !{}, type: !{}, value: i32 7)
|
||||
; CHECK: [[@LINE+1]]:55: error: missing required field 'tag'
|
||||
!0 = !MDTemplateValueParameter(type: !{}, value: i32 7)
|
||||
|
@ -1,5 +1,5 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+2]]:56: error: missing required field 'type'
|
||||
; CHECK: [[@LINE+2]]:44: error: missing required field 'type'
|
||||
!0 = !MDTemplateValueParameter(tag: DW_TAG_template_value_parameter,
|
||||
scope: !{}, value: i32 7)
|
||||
value: i32 7)
|
||||
|
@ -1,5 +1,5 @@
|
||||
; RUN: not llvm-as < %s -disable-output 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: [[@LINE+2]]:53: error: missing required field 'value'
|
||||
; CHECK: [[@LINE+2]]:41: error: missing required field 'value'
|
||||
!0 = !MDTemplateValueParameter(tag: DW_TAG_template_value_parameter,
|
||||
scope: !{}, type: !{})
|
||||
type: !{})
|
||||
|
@ -8,17 +8,17 @@
|
||||
!1 = distinct !{}
|
||||
; CHECK: !1 = distinct !{}
|
||||
|
||||
; CHECK-NEXT: !2 = !MDTemplateTypeParameter(scope: !0, name: "Ty", type: !1)
|
||||
; CHECK-NEXT: !3 = !MDTemplateTypeParameter(scope: !0, name: "", type: !1)
|
||||
!2 = !MDTemplateTypeParameter(scope: !0, name: "Ty", type: !1)
|
||||
!3 = !MDTemplateTypeParameter(scope: !0, type: !1)
|
||||
!4 = !MDTemplateTypeParameter(scope: !0, name: "", type: !1)
|
||||
; CHECK-NEXT: !2 = !MDTemplateTypeParameter(name: "Ty", type: !1)
|
||||
; CHECK-NEXT: !3 = !MDTemplateTypeParameter(name: "", type: !1)
|
||||
!2 = !MDTemplateTypeParameter(name: "Ty", type: !1)
|
||||
!3 = !MDTemplateTypeParameter(type: !1)
|
||||
!4 = !MDTemplateTypeParameter(name: "", type: !1)
|
||||
|
||||
; CHECK-NEXT: !4 = !MDTemplateValueParameter(tag: DW_TAG_template_value_parameter, scope: !0, name: "V", type: !1, value: i32 7)
|
||||
; CHECK-NEXT: !5 = !MDTemplateValueParameter(tag: DW_TAG_template_value_parameter, scope: !0, name: "", type: !1, value: i32 7)
|
||||
; CHECK-NEXT: !4 = !MDTemplateValueParameter(tag: DW_TAG_template_value_parameter, name: "V", type: !1, value: i32 7)
|
||||
; CHECK-NEXT: !5 = !MDTemplateValueParameter(tag: DW_TAG_template_value_parameter, name: "", type: !1, value: i32 7)
|
||||
!5 = !MDTemplateValueParameter(tag: DW_TAG_template_value_parameter,
|
||||
scope: !0, name: "V", type: !1, value: i32 7)
|
||||
name: "V", type: !1, value: i32 7)
|
||||
!6 = !MDTemplateValueParameter(tag: DW_TAG_template_value_parameter,
|
||||
scope: !0, type: !1, value: i32 7)
|
||||
type: !1, value: i32 7)
|
||||
!7 = !MDTemplateValueParameter(tag: DW_TAG_template_value_parameter,
|
||||
scope: !0, name: "", type: !1, value: i32 7)
|
||||
name: "", type: !1, value: i32 7)
|
||||
|
@ -1386,21 +1386,19 @@ TEST_F(MDNamespaceTest, get) {
|
||||
typedef MetadataTest MDTemplateTypeParameterTest;
|
||||
|
||||
TEST_F(MDTemplateTypeParameterTest, get) {
|
||||
Metadata *Scope = MDTuple::getDistinct(Context, None);
|
||||
StringRef Name = "template";
|
||||
Metadata *Type = MDTuple::getDistinct(Context, None);
|
||||
Metadata *Other = MDTuple::getDistinct(Context, None);
|
||||
|
||||
auto *N = MDTemplateTypeParameter::get(Context, Scope, Name, Type);
|
||||
auto *N = MDTemplateTypeParameter::get(Context, Name, Type);
|
||||
|
||||
EXPECT_EQ(dwarf::DW_TAG_template_type_parameter, N->getTag());
|
||||
EXPECT_EQ(Scope, N->getScope());
|
||||
EXPECT_EQ(Name, N->getName());
|
||||
EXPECT_EQ(Type, N->getType());
|
||||
EXPECT_EQ(N, MDTemplateTypeParameter::get(Context, Scope, Name, Type));
|
||||
EXPECT_EQ(N, MDTemplateTypeParameter::get(Context, Name, Type));
|
||||
|
||||
EXPECT_NE(N, MDTemplateTypeParameter::get(Context, Type, Name, Type));
|
||||
EXPECT_NE(N, MDTemplateTypeParameter::get(Context, Scope, "other", Type));
|
||||
EXPECT_NE(N, MDTemplateTypeParameter::get(Context, Scope, Name, Scope));
|
||||
EXPECT_NE(N, MDTemplateTypeParameter::get(Context, "other", Type));
|
||||
EXPECT_NE(N, MDTemplateTypeParameter::get(Context, Name, Other));
|
||||
|
||||
TempMDTemplateTypeParameter Temp = N->clone();
|
||||
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||
@ -1410,32 +1408,26 @@ typedef MetadataTest MDTemplateValueParameterTest;
|
||||
|
||||
TEST_F(MDTemplateValueParameterTest, get) {
|
||||
unsigned Tag = dwarf::DW_TAG_template_value_parameter;
|
||||
Metadata *Scope = MDTuple::getDistinct(Context, None);
|
||||
StringRef Name = "template";
|
||||
Metadata *Type = MDTuple::getDistinct(Context, None);
|
||||
Metadata *Value = MDTuple::getDistinct(Context, None);
|
||||
Metadata *Other = MDTuple::getDistinct(Context, None);
|
||||
|
||||
auto *N =
|
||||
MDTemplateValueParameter::get(Context, Tag, Scope, Name, Type, Value);
|
||||
auto *N = MDTemplateValueParameter::get(Context, Tag, Name, Type, Value);
|
||||
EXPECT_EQ(Tag, N->getTag());
|
||||
EXPECT_EQ(Scope, N->getScope());
|
||||
EXPECT_EQ(Name, N->getName());
|
||||
EXPECT_EQ(Type, N->getType());
|
||||
EXPECT_EQ(Value, N->getValue());
|
||||
EXPECT_EQ(
|
||||
N, MDTemplateValueParameter::get(Context, Tag, Scope, Name, Type, Value));
|
||||
EXPECT_EQ(N, MDTemplateValueParameter::get(Context, Tag, Name, Type, Value));
|
||||
|
||||
EXPECT_NE(N, MDTemplateValueParameter::get(
|
||||
Context, dwarf::DW_TAG_GNU_template_template_param, Scope,
|
||||
Name, Type, Value));
|
||||
EXPECT_NE(
|
||||
N, MDTemplateValueParameter::get(Context, Tag, Type, Name, Type, Value));
|
||||
EXPECT_NE(N, MDTemplateValueParameter::get(Context, Tag, Scope, "other", Type,
|
||||
Context, dwarf::DW_TAG_GNU_template_template_param, Name,
|
||||
Type, Value));
|
||||
EXPECT_NE(N, MDTemplateValueParameter::get(Context, Tag, "other", Type,
|
||||
Value));
|
||||
EXPECT_NE(N, MDTemplateValueParameter::get(Context, Tag, Scope, Name, Scope,
|
||||
EXPECT_NE(N, MDTemplateValueParameter::get(Context, Tag, Name, Other,
|
||||
Value));
|
||||
EXPECT_NE(
|
||||
N, MDTemplateValueParameter::get(Context, Tag, Scope, Name, Type, Scope));
|
||||
EXPECT_NE(N, MDTemplateValueParameter::get(Context, Tag, Name, Type, Other));
|
||||
|
||||
TempMDTemplateValueParameter Temp = N->clone();
|
||||
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||
|
Loading…
Reference in New Issue
Block a user