summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Dwarf.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-03 21:16:49 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-03 21:16:49 +0000
commit6f5546cdeee7ee02edf2f7f9d26a0c6ada8895a3 (patch)
tree0bb3a1c5c63b13fe545fd6ad99f23bc2ad2f0dcd /llvm/lib/Support/Dwarf.cpp
parent981811efc811f48ebeeb1204609d386f7cedf749 (diff)
downloadbcm5719-llvm-6f5546cdeee7ee02edf2f7f9d26a0c6ada8895a3.tar.gz
bcm5719-llvm-6f5546cdeee7ee02edf2f7f9d26a0c6ada8895a3.zip
Support: Add string => unsigned mapping for DW_TAG
Add `dwarf::getTag()` to translate from `StringRef` to `unsigned`. llvm-svn: 228031
Diffstat (limited to 'llvm/lib/Support/Dwarf.cpp')
-rw-r--r--llvm/lib/Support/Dwarf.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Support/Dwarf.cpp b/llvm/lib/Support/Dwarf.cpp
index 255d3572365..80dfd102317 100644
--- a/llvm/lib/Support/Dwarf.cpp
+++ b/llvm/lib/Support/Dwarf.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Support/Dwarf.h"
+#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
@@ -27,6 +28,13 @@ const char *llvm::dwarf::TagString(unsigned Tag) {
}
}
+unsigned llvm::dwarf::getTag(StringRef TagString) {
+ return StringSwitch<unsigned>(TagString)
+#define HANDLE_DW_TAG(ID, NAME) .Case("DW_TAG_" #NAME, DW_TAG_##NAME)
+#include "llvm/Support/Dwarf.def"
+ .Default(DW_TAG_invalid);
+}
+
const char *llvm::dwarf::ChildrenString(unsigned Children) {
switch (Children) {
case DW_CHILDREN_no: return "DW_CHILDREN_no";
OpenPOWER on IntegriCloud