From 6b943ff3a3f8617113ecbf611cf0f8957e4e19d2 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 2 May 2011 19:34:44 +0000 Subject: Vendor import of llvm trunk r130700: http://llvm.org/svn/llvm-project/llvm/trunk@130700 --- lib/VMCore/DebugLoc.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'lib/VMCore/DebugLoc.cpp') diff --git a/lib/VMCore/DebugLoc.cpp b/lib/VMCore/DebugLoc.cpp index f8b45eed0d5e..520333cbbcf2 100644 --- a/lib/VMCore/DebugLoc.cpp +++ b/lib/VMCore/DebugLoc.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/DebugLoc.h" +#include "llvm/ADT/DenseMapInfo.h" #include "LLVMContextImpl.h" using namespace llvm; @@ -108,7 +109,7 @@ MDNode *DebugLoc::getAsMDNode(const LLVMContext &Ctx) const { ConstantInt::get(Int32, getLine()), ConstantInt::get(Int32, getCol()), Scope, IA }; - return MDNode::get(Ctx2, &Elts[0], 4); + return MDNode::get(Ctx2, Elts); } /// getFromDILocation - Translate the DILocation quad into a DebugLoc. @@ -127,6 +128,29 @@ DebugLoc DebugLoc::getFromDILocation(MDNode *N) { return get(LineNo, ColNo, Scope, dyn_cast_or_null(N->getOperand(3))); } +//===----------------------------------------------------------------------===// +// DenseMap specialization +//===----------------------------------------------------------------------===// + +DebugLoc DenseMapInfo::getEmptyKey() { + return DebugLoc::getEmptyKey(); +} + +DebugLoc DenseMapInfo::getTombstoneKey() { + return DebugLoc::getTombstoneKey(); +} + +unsigned DenseMapInfo::getHashValue(const DebugLoc &Key) { + FoldingSetNodeID ID; + ID.AddInteger(Key.LineCol); + ID.AddInteger(Key.ScopeIdx); + return ID.ComputeHash(); +} + +bool DenseMapInfo::isEqual(const DebugLoc &LHS, const DebugLoc &RHS) { + return LHS == RHS; +} + //===----------------------------------------------------------------------===// // LLVMContextImpl Implementation //===----------------------------------------------------------------------===// -- cgit v1.3