diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-10-02 21:21:09 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-10-02 21:21:09 +0000 |
commit | 46e006c497bc962e7c2aff5b2e66c16fa94ae12d (patch) | |
tree | 1f700aa64b101997a68e047bb3ce0c8a7c5d6ae2 /llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | |
parent | 6dda6712cca5c41baa192d51ec8d3ec892063113 (diff) | |
download | bcm5719-llvm-46e006c497bc962e7c2aff5b2e66c16fa94ae12d.tar.gz bcm5719-llvm-46e006c497bc962e7c2aff5b2e66c16fa94ae12d.zip |
llvm-dwarfdump: support the --ignore-case option.
llvm-svn: 314723
Diffstat (limited to 'llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp')
-rw-r--r-- | llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index 28b4a136fb1..9abc92b7b83 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -143,6 +143,12 @@ static list<std::string> "-name option can be used instead."), value_desc("name"), cat(DwarfDumpCategory)); static alias FindAlias("f", desc("Alias for -find"), aliasopt(Find)); +static opt<bool> + IgnoreCase("ignore-case", + desc("Ignore case distinctions in when searching by name."), + value_desc("i"), cat(DwarfDumpCategory)); +static alias IgnoreCaseAlias("i", desc("Alias for -ignore-case"), + aliasopt(IgnoreCase)); static list<std::string> Name("name", desc("Find and print all debug info entries whose name (DW_AT_name " @@ -265,8 +271,11 @@ static void filterByName(const StringSet<> &Names, for (const auto &CU : CUs) for (const auto &Entry : CU->dies()) { DWARFDie Die = {CU.get(), &Entry}; - if (Names.count(Die.getName(DINameKind::ShortName))) - Die.dump(OS, 0, getDumpOpts()); + if (const char *NamePtr = Die.getName(DINameKind::ShortName)) { + std::string Name = IgnoreCase ? StringRef(NamePtr).lower() : NamePtr; + if (Names.count(Name)) + Die.dump(OS, 0, getDumpOpts()); + } } } @@ -283,7 +292,7 @@ static bool dumpObjectFile(ObjectFile &Obj, DWARFContext &DICtx, Twine Filename, if (!Name.empty()) { StringSet<> Names; for (auto name : Name) - Names.insert(name); + Names.insert(IgnoreCase ? StringRef(name).lower() : name); filterByName(Names, DICtx.compile_units(), OS); filterByName(Names, DICtx.dwo_compile_units(), OS); |