summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/DebugLoc.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-04-06 05:36:52 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-04-06 05:36:52 +0000
commitddc72895d09f8dd41cafe9ceff4ba7434ae8de95 (patch)
tree8a76aad7a343d2eee82889a4977ef98d5315aac0 /llvm/lib/VMCore/DebugLoc.cpp
parent3cacdf5dbb0d66242edef973ec2d907176b59725 (diff)
downloadbcm5719-llvm-ddc72895d09f8dd41cafe9ceff4ba7434ae8de95.tar.gz
bcm5719-llvm-ddc72895d09f8dd41cafe9ceff4ba7434ae8de95.zip
Support using DebugLoc's in a DenseMap.
llvm-svn: 128988
Diffstat (limited to 'llvm/lib/VMCore/DebugLoc.cpp')
-rw-r--r--llvm/lib/VMCore/DebugLoc.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/DebugLoc.cpp b/llvm/lib/VMCore/DebugLoc.cpp
index f8b45eed0d5..cb077cb4374 100644
--- a/llvm/lib/VMCore/DebugLoc.cpp
+++ b/llvm/lib/VMCore/DebugLoc.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Support/DebugLoc.h"
+#include "llvm/ADT/DenseMapInfo.h"
#include "LLVMContextImpl.h"
using namespace llvm;
@@ -128,6 +129,29 @@ DebugLoc DebugLoc::getFromDILocation(MDNode *N) {
}
//===----------------------------------------------------------------------===//
+// DenseMap specialization
+//===----------------------------------------------------------------------===//
+
+DebugLoc DenseMapInfo<DebugLoc>::getEmptyKey() {
+ return DebugLoc();
+}
+
+DebugLoc DenseMapInfo<DebugLoc>::getTombstoneKey() {
+ return DebugLoc::getTombstoneKey();
+}
+
+unsigned DenseMapInfo<DebugLoc>::getHashValue(const DebugLoc &Key) {
+ FoldingSetNodeID ID;
+ ID.AddInteger(Key.LineCol);
+ ID.AddInteger(Key.ScopeIdx);
+ return ID.ComputeHash();
+}
+
+bool DenseMapInfo<DebugLoc>::isEqual(const DebugLoc &LHS, const DebugLoc &RHS) {
+ return LHS == RHS;
+}
+
+//===----------------------------------------------------------------------===//
// LLVMContextImpl Implementation
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud