[llvm] r229791 - IR: Drop scope from MDTemplateParameter
Duncan P. N. Exon Smith
dexonsmith at apple.com
Wed Feb 18 16:37:22 PST 2015
Author: dexonsmith
Date: Wed Feb 18 18:37:21 2015
New Revision: 229791
URL: http://llvm.org/viewvc/llvm-project?rev=229791&view=rev
Log:
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.)
Removed:
llvm/trunk/test/Assembler/invalid-mdtemplatetypeparameter-missing-parent.ll
llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-parent.ll
Modified:
llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/trunk/lib/IR/AsmWriter.cpp
llvm/trunk/lib/IR/DebugInfoMetadata.cpp
llvm/trunk/lib/IR/LLVMContextImpl.h
llvm/trunk/test/Assembler/invalid-mdtemplatetypeparameter-missing-type.ll
llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-tag.ll
llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-type.ll
llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-value.ll
llvm/trunk/test/Assembler/mdtemplateparameter.ll
llvm/trunk/unittests/IR/MetadataTest.cpp
Modified: llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfoMetadata.h?rev=229791&r1=229790&r2=229791&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfoMetadata.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfoMetadata.h Wed Feb 18 18:37:21 2015
@@ -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 M
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
~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;
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=229791&r1=229790&r2=229791&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Wed Feb 18 18:37:21 2015
@@ -3515,37 +3515,33 @@ bool LLParser::ParseMDNamespace(MDNode *
}
/// 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;
}
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=229791&r1=229790&r2=229791&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Feb 18 18:37:21 2015
@@ -1515,25 +1515,24 @@ std::error_code BitcodeReader::ParseMeta
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;
}
Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=229791&r1=229790&r2=229791&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Wed Feb 18 18:37:21 2015
@@ -1027,7 +1027,6 @@ static void WriteMDTemplateTypeParameter
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 WriteMDTemplateValueParamete
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()));
Modified: llvm/trunk/lib/IR/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=229791&r1=229790&r2=229791&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AsmWriter.cpp (original)
+++ llvm/trunk/lib/IR/AsmWriter.cpp Wed Feb 18 18:37:21 2015
@@ -1685,8 +1685,6 @@ static void writeMDTemplateTypeParameter
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 writeMDTemplateValueParamete
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);
Modified: llvm/trunk/lib/IR/DebugInfoMetadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfoMetadata.cpp?rev=229791&r1=229790&r2=229791&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfoMetadata.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfoMetadata.cpp Wed Feb 18 18:37:21 2015
@@ -298,24 +298,24 @@ MDNamespace *MDNamespace::getImpl(LLVMCo
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);
}
Modified: llvm/trunk/lib/IR/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.h?rev=229791&r1=229790&r2=229791&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/IR/LLVMContextImpl.h Wed Feb 18 18:37:21 2015
@@ -646,44 +646,36 @@ template <> struct MDNodeKeyImpl<MDNames
};
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> {
Removed: llvm/trunk/test/Assembler/invalid-mdtemplatetypeparameter-missing-parent.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/invalid-mdtemplatetypeparameter-missing-parent.ll?rev=229790&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/invalid-mdtemplatetypeparameter-missing-parent.ll (original)
+++ llvm/trunk/test/Assembler/invalid-mdtemplatetypeparameter-missing-parent.ll (removed)
@@ -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: !{})
Modified: llvm/trunk/test/Assembler/invalid-mdtemplatetypeparameter-missing-type.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/invalid-mdtemplatetypeparameter-missing-type.ll?rev=229791&r1=229790&r2=229791&view=diff
==============================================================================
--- llvm/trunk/test/Assembler/invalid-mdtemplatetypeparameter-missing-type.ll (original)
+++ llvm/trunk/test/Assembler/invalid-mdtemplatetypeparameter-missing-type.ll Wed Feb 18 18:37:21 2015
@@ -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")
Removed: llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-parent.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-parent.ll?rev=229790&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-parent.ll (original)
+++ llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-parent.ll (removed)
@@ -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)
Modified: llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-tag.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-tag.ll?rev=229791&r1=229790&r2=229791&view=diff
==============================================================================
--- llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-tag.ll (original)
+++ llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-tag.ll Wed Feb 18 18:37:21 2015
@@ -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)
Modified: llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-type.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-type.ll?rev=229791&r1=229790&r2=229791&view=diff
==============================================================================
--- llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-type.ll (original)
+++ llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-type.ll Wed Feb 18 18:37:21 2015
@@ -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)
Modified: llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-value.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-value.ll?rev=229791&r1=229790&r2=229791&view=diff
==============================================================================
--- llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-value.ll (original)
+++ llvm/trunk/test/Assembler/invalid-mdtemplatevalueparameter-missing-value.ll Wed Feb 18 18:37:21 2015
@@ -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: !{})
Modified: llvm/trunk/test/Assembler/mdtemplateparameter.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/mdtemplateparameter.ll?rev=229791&r1=229790&r2=229791&view=diff
==============================================================================
--- llvm/trunk/test/Assembler/mdtemplateparameter.ll (original)
+++ llvm/trunk/test/Assembler/mdtemplateparameter.ll Wed Feb 18 18:37:21 2015
@@ -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)
Modified: llvm/trunk/unittests/IR/MetadataTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/MetadataTest.cpp?rev=229791&r1=229790&r2=229791&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/MetadataTest.cpp (original)
+++ llvm/trunk/unittests/IR/MetadataTest.cpp Wed Feb 18 18:37:21 2015
@@ -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 MDTemplateValuePara
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)));
More information about the llvm-commits
mailing list