summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/LLVMContextImpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/LLVMContextImpl.h')
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index f1cc12a2902..55443c598f9 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -763,18 +763,16 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
Metadata *Type;
bool IsLocalToUnit;
bool IsDefinition;
- Metadata *Expr;
Metadata *StaticDataMemberDeclaration;
uint32_t AlignInBits;
MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *LinkageName,
Metadata *File, unsigned Line, Metadata *Type,
bool IsLocalToUnit, bool IsDefinition,
- Metadata *Expr, Metadata *StaticDataMemberDeclaration,
- uint32_t AlignInBits)
+ Metadata *StaticDataMemberDeclaration, uint32_t AlignInBits)
: Scope(Scope), Name(Name), LinkageName(LinkageName), File(File),
Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit),
- IsDefinition(IsDefinition), Expr(Expr),
+ IsDefinition(IsDefinition),
StaticDataMemberDeclaration(StaticDataMemberDeclaration),
AlignInBits(AlignInBits) {}
MDNodeKeyImpl(const DIGlobalVariable *N)
@@ -782,7 +780,6 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
LinkageName(N->getRawLinkageName()), File(N->getRawFile()),
Line(N->getLine()), Type(N->getRawType()),
IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
- Expr(N->getRawExpr()),
StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()),
AlignInBits(N->getAlignInBits()) {}
@@ -792,7 +789,6 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
File == RHS->getRawFile() && Line == RHS->getLine() &&
Type == RHS->getRawType() && IsLocalToUnit == RHS->isLocalToUnit() &&
IsDefinition == RHS->isDefinition() &&
- Expr == RHS->getRawExpr() &&
StaticDataMemberDeclaration ==
RHS->getRawStaticDataMemberDeclaration() &&
AlignInBits == RHS->getAlignInBits();
@@ -806,7 +802,7 @@ template <> struct MDNodeKeyImpl<DIGlobalVariable> {
// generated IR is random for each run and test fails with Align included.
// TODO: make hashing work fine with such situations
return hash_combine(Scope, Name, LinkageName, File, Line, Type,
- IsLocalToUnit, IsDefinition, /* AlignInBits, */ Expr,
+ IsLocalToUnit, IsDefinition, /* AlignInBits, */
StaticDataMemberDeclaration);
}
};
@@ -863,6 +859,22 @@ template <> struct MDNodeKeyImpl<DIExpression> {
}
};
+template <> struct MDNodeKeyImpl<DIGlobalVariableExpression> {
+ Metadata *Variable;
+ Metadata *Expression;
+
+ MDNodeKeyImpl(Metadata *Variable, Metadata *Expression)
+ : Variable(Variable), Expression(Expression) {}
+ MDNodeKeyImpl(const DIGlobalVariableExpression *N)
+ : Variable(N->getRawVariable()), Expression(N->getRawExpression()) {}
+
+ bool isKeyOf(const DIGlobalVariableExpression *RHS) const {
+ return Variable == RHS->getRawVariable() &&
+ Expression == RHS->getRawExpression();
+ }
+ unsigned getHashValue() const { return hash_combine(Variable, Expression); }
+};
+
template <> struct MDNodeKeyImpl<DIObjCProperty> {
MDString *Name;
Metadata *File;
OpenPOWER on IntegriCloud