Added GDB pretty printer for StringMap

Reviewed By: csigg, dblaikie

Differential Revision: https://reviews.llvm.org/D91183

GitOrigin-RevId: 5747380772e0bbf5762e5ed9c39e6c9265bafc87
diff --git a/llvm-prettyprinters/gdb/llvm-support.cpp b/llvm-prettyprinters/gdb/llvm-support.cpp
index a6e535b..54c26dc 100644
--- a/llvm-prettyprinters/gdb/llvm-support.cpp
+++ b/llvm-prettyprinters/gdb/llvm-support.cpp
@@ -5,6 +5,7 @@
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/ADT/ilist.h"
 #include "llvm/Support/Error.h"
@@ -15,6 +16,7 @@
 llvm::ArrayRef<int> ArrayRef(Array);
 llvm::MutableArrayRef<int> MutableArrayRef(Array);
 llvm::DenseMap<int, int> DenseMap = {{4, 5}, {6, 7}};
+llvm::StringMap<int> StringMap = {{"foo", 123}, {"bar", 456}};
 llvm::Expected<int> ExpectedValue(8);
 llvm::Expected<int> ExpectedError(llvm::createStringError({}, ""));
 llvm::Optional<int> OptionalValue(9);
diff --git a/llvm-prettyprinters/gdb/llvm-support.gdb b/llvm-prettyprinters/gdb/llvm-support.gdb
index 6ae1c70..b07eabf 100644
--- a/llvm-prettyprinters/gdb/llvm-support.gdb
+++ b/llvm-prettyprinters/gdb/llvm-support.gdb
@@ -40,6 +40,9 @@
 # CHECK: "\"foo\"\"bar\""
 p Twine
 
+# CHECK: llvm::StringMap with 2 elements = {["foo"] = 123, ["bar"] = 456}
+p StringMap
+
 # CHECK: {pointer = 0xabc, value = 1}
 p PointerIntPair