diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/DebugInfoMetadata.cpp | 25 | ||||
-rw-r--r-- | llvm/lib/IR/LLVMContextImpl.h | 35 |
2 files changed, 23 insertions, 37 deletions
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index 68f6bf843d8..aaf1bc6e1ab 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -126,6 +126,10 @@ void GenericDebugNode::recalculateHash() { #define DEFINE_GETIMPL_STORE_NO_OPS(CLASS, ARGS) \ return storeImpl(new (0u) CLASS(Context, Storage, UNWRAP_ARGS(ARGS)), \ Storage, Context.pImpl->CLASS##s) +#define DEFINE_GETIMPL_STORE_NO_CONSTRUCTOR_ARGS(CLASS, OPS) \ + return storeImpl(new (ArrayRef<Metadata *>(OPS).size()) \ + CLASS(Context, Storage, OPS), \ + Storage, Context.pImpl->CLASS##s) MDSubrange *MDSubrange::getImpl(LLVMContext &Context, int64_t Count, int64_t Lo, StorageType Storage, bool ShouldCreate) { @@ -290,26 +294,23 @@ MDNamespace *MDNamespace::getImpl(LLVMContext &Context, Metadata *Scope, MDTemplateTypeParameter * MDTemplateTypeParameter::getImpl(LLVMContext &Context, Metadata *Scope, - MDString *Name, Metadata *Type, Metadata *File, - unsigned Line, unsigned Column, + MDString *Name, Metadata *Type, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); DEFINE_GETIMPL_LOOKUP(MDTemplateTypeParameter, - (Scope, getString(Name), Type, File, Line, Column)); - Metadata *Ops[] = {File, Scope, Name, Type}; - DEFINE_GETIMPL_STORE(MDTemplateTypeParameter, (Line, Column), Ops); + (Scope, getString(Name), Type)); + Metadata *Ops[] = {Scope, 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, Metadata *File, unsigned Line, - unsigned Column, StorageType Storage, bool ShouldCreate) { + Metadata *Type, Metadata *Value, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); - DEFINE_GETIMPL_LOOKUP( - MDTemplateValueParameter, - (Tag, Scope, getString(Name), Type, Value, File, Line, Column)); - Metadata *Ops[] = {File, Scope, Name, Type, Value}; - DEFINE_GETIMPL_STORE(MDTemplateValueParameter, (Tag, Line, Column), Ops); + DEFINE_GETIMPL_LOOKUP(MDTemplateValueParameter, + (Tag, Scope, getString(Name), Type, Value)); + Metadata *Ops[] = {Scope, Name, Type, Value}; + DEFINE_GETIMPL_STORE(MDTemplateValueParameter, (Tag), Ops); } MDGlobalVariable * diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index 6a3d59289f4..824c4322351 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -649,26 +649,17 @@ template <> struct MDNodeKeyImpl<MDTemplateTypeParameter> { Metadata *Scope; StringRef Name; Metadata *Type; - Metadata *File; - unsigned Line; - unsigned Column; - MDNodeKeyImpl(Metadata *Scope, StringRef Name, Metadata *Type, Metadata *File, - unsigned Line, unsigned Column) - : Scope(Scope), Name(Name), Type(Type), File(File), Line(Line), - Column(Column) {} + MDNodeKeyImpl(Metadata *Scope, StringRef Name, Metadata *Type) + : Scope(Scope), Name(Name), Type(Type) {} MDNodeKeyImpl(const MDTemplateTypeParameter *N) - : Scope(N->getScope()), Name(N->getName()), Type(N->getType()), - File(N->getFile()), Line(N->getLine()), Column(N->getColumn()) {} + : Scope(N->getScope()), Name(N->getName()), Type(N->getType()) {} bool isKeyOf(const MDTemplateTypeParameter *RHS) const { return Scope == RHS->getScope() && Name == RHS->getName() && - Type == RHS->getType() && File == RHS->getFile() && - Line == RHS->getLine() && Column == RHS->getColumn(); - } - unsigned getHashValue() const { - return hash_combine(Scope, Name, Type, File, Line, Column); + Type == RHS->getType(); } + unsigned getHashValue() const { return hash_combine(Scope, Name, Type); } }; template <> struct MDNodeKeyImpl<MDTemplateValueParameter> { @@ -677,27 +668,21 @@ template <> struct MDNodeKeyImpl<MDTemplateValueParameter> { StringRef Name; Metadata *Type; Metadata *Value; - Metadata *File; - unsigned Line; - unsigned Column; MDNodeKeyImpl(unsigned Tag, Metadata *Scope, StringRef Name, Metadata *Type, - Metadata *Value, Metadata *File, unsigned Line, unsigned Column) - : Tag(Tag), Scope(Scope), Name(Name), Type(Type), Value(Value), - File(File), Line(Line), Column(Column) {} + Metadata *Value) + : Tag(Tag), Scope(Scope), 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()), File(N->getFile()), - Line(N->getLine()), Column(N->getColumn()) {} + 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() && File == RHS->getFile() && - Line == RHS->getLine() && Column == RHS->getColumn(); + Value == RHS->getValue(); } unsigned getHashValue() const { - return hash_combine(Tag, Scope, Name, Type, Value, File, Line, Column); + return hash_combine(Tag, Scope, Name, Type, Value); } }; |