From 99fdb9d9270c9df61e29a926787c8aa4317187ba Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Thu, 28 Sep 2017 18:10:52 +0000 Subject: llvm-dwarfdump: implement --find for .apple_names This patch implements the dwarfdump option --find=. This option looks for a DIE in the accelerator tables and dumps it if found. This initial patch only adds support for .apple_names to keep the review small, adding the other sections and pubnames support should be trivial though. Differential Revision: https://reviews.llvm.org/D38282 llvm-svn: 314439 --- llvm/lib/BinaryFormat/Dwarf.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'llvm/lib/BinaryFormat/Dwarf.cpp') diff --git a/llvm/lib/BinaryFormat/Dwarf.cpp b/llvm/lib/BinaryFormat/Dwarf.cpp index 37c4579ef0f..86e3b02577f 100644 --- a/llvm/lib/BinaryFormat/Dwarf.cpp +++ b/llvm/lib/BinaryFormat/Dwarf.cpp @@ -575,3 +575,10 @@ bool llvm::dwarf::isValidFormForVersion(Form F, unsigned Version, } return ExtensionsOk; } + +uint32_t llvm::dwarf::djbHash(StringRef Buffer) { + uint32_t H = 5381; + for (char C : Buffer.bytes()) + H = ((H << 5) + H) + C; + return H; +} -- cgit v1.2.3