summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-19 00:37:21 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-19 00:37:21 +0000
commit3d62bbacb1aa918944f0cc966381f44e13582b4a (patch)
tree11ef811398091ec13469ff532758c8d0ba7d2008 /llvm/lib
parentca929f24699a05cf22d4337278e5fea962799632 (diff)
downloadbcm5719-llvm-3d62bbacb1aa918944f0cc966381f44e13582b4a.tar.gz
bcm5719-llvm-3d62bbacb1aa918944f0cc966381f44e13582b4a.zip
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.) llvm-svn: 229791
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp16
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp19
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp2
-rw-r--r--llvm/lib/IR/AsmWriter.cpp4
-rw-r--r--llvm/lib/IR/DebugInfoMetadata.cpp22
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h30
6 files changed, 37 insertions, 56 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 0d748610742..1ea06163c9e 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -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;
}
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index ca4d66a540b..649057dddf0 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -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;
}
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index c3b0dc858a4..932381926c7 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -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()));
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 662771b3278..ac86acd1741 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -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);
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index f6dfbf6cfa5..ab79a713357 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -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);
}
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 824c4322351..3c61c06b81a 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -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> {
OpenPOWER on IntegriCloud