[llvm] r336829 - Revert "[llvm-objdump] Add -demangle (-C) option"
Paul Semel via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 11 11:09:52 PDT 2018
Author: paulsemel
Date: Wed Jul 11 11:09:52 2018
New Revision: 336829
URL: http://llvm.org/viewvc/llvm-project?rev=336829&view=rev
Log:
Revert "[llvm-objdump] Add -demangle (-C) option"
This reverts commit 3a44ccd156e0edd2e89226f8ed63928e227900bb.
This reverts commit d5cfc836bb5552e20507d3612d13ff66ff9e36a0.
Removed:
llvm/trunk/test/tools/llvm-objdump/disassemble-demangle.test
Modified:
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
llvm/trunk/tools/llvm-objdump/llvm-objdump.h
Removed: llvm/trunk/test/tools/llvm-objdump/disassemble-demangle.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/disassemble-demangle.test?rev=336828&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/disassemble-demangle.test (original)
+++ llvm/trunk/test/tools/llvm-objdump/disassemble-demangle.test (removed)
@@ -1,47 +0,0 @@
-# RUN: yaml2obj %s > %t
-# RUN: llvm-objdump -triple=x86_64-unknown-linux-gnu -d -C %t | FileCheck --check-prefix=DEMANGLE %s
-# RUN: llvm-objdump -triple=x86_64-unknown-linux-gnu -d --demangle=itanium %t | FileCheck --check-prefix=DEMANGLE %s
-# RUN: llvm-objdump -triple=x86_64-unknown-linux-gnu -d %t | FileCheck --check-prefix=NO-DEMANGLE %s
-# RUN: llvm-objdump -triple=x86_64-unknown-linux-gnu -d --demangle=none %t | FileCheck --check-prefix=NO-DEMANGLE %s
-# RUN: llvm-objdump -triple=x86_64-unknown-linux-gnu -d -C=wrong-style %t 2>&1 | FileCheck --check-prefix=BAD-STYLE %s
-
-!ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_EXEC
- Machine: EM_X86_64
-Sections:
- - Name: .text1
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x1000
- AddressAlign: 0x0000000000000010
- Content: "0000000000000000"
- - Name: .text2
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- Address: 0x1010
- AddressAlign: 0x0000000000000010
- Content: "0000000000000000"
-Symbols:
- Local:
- - Name: _Z3fooi
- Type: STT_FUNC
- Section: .text1
- Value: 0x1000
- - Name: _Z3foov
- Type: STT_FUNC
- Section: .text2
- Value: 0x1010
-
-# We just want to check that the symbols are demangled
-# DEMANGLE: foo(int)
-# DEMANGLE: foo()
-
-# NO-DEMANGLE: _Z3fooi
-# NO-DEMANGLE: _Z3foov
-
-# BAD-STYLE: warning: Unsupported demangling style.
-# BAD-STYLE: _Z3fooi
-# BAD-STYLE: _Z3foov
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=336829&r1=336828&r2=336829&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Wed Jul 11 11:09:52 2018
@@ -25,7 +25,6 @@
#include "llvm/CodeGen/FaultMaps.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/Symbolize/Symbolize.h"
-#include "llvm/Demangle/Demangle.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
@@ -91,13 +90,6 @@ static cl::alias
DisassembleAlld("D", cl::desc("Alias for --disassemble-all"),
cl::aliasopt(DisassembleAll));
-cl::opt<std::string> llvm::Demangle("demangle",
- cl::desc("Demangle symbols names"),
- cl::ValueOptional, cl::init("none"));
-
-static cl::alias DemangleShort("C", cl::desc("Alias for --demangle"),
- cl::aliasopt(Demangle));
-
static cl::list<std::string>
DisassembleFunctions("df",
cl::CommaSeparated,
@@ -338,11 +330,6 @@ LLVM_ATTRIBUTE_NORETURN void llvm::error
exit(1);
}
-void llvm::warn(StringRef Message) {
- errs() << ToolName << ": warning: " << Message << ".\n";
- errs().flush();
-}
-
LLVM_ATTRIBUTE_NORETURN void llvm::report_error(StringRef File,
Twine Message) {
errs() << ToolName << ": '" << File << "': " << Message << ".\n";
@@ -1524,25 +1511,7 @@ static void DisassembleObject(const Obje
}
}
- auto PrintSymbol = [](StringRef Name) {
- outs() << '\n' << Name << ":\n";
- };
- StringRef SymbolName = std::get<1>(Symbols[si]);
- if (Demangle.getValue() == "" || Demangle.getValue() == "itanium") {
- char *DemangledSymbol = nullptr;
- size_t Size = 0;
- int Status;
- DemangledSymbol =
- itaniumDemangle(SymbolName.data(), DemangledSymbol, &Size, &Status);
- if (Status == 0)
- PrintSymbol(StringRef(DemangledSymbol));
- else
- PrintSymbol(SymbolName);
-
- if (Size != 0)
- free(DemangledSymbol);
- } else
- PrintSymbol(SymbolName);
+ outs() << '\n' << std::get<1>(Symbols[si]) << ":\n";
// Don't print raw contents of a virtual section. A virtual section
// doesn't have any contents in the file.
@@ -2391,11 +2360,6 @@ int main(int argc, char **argv) {
if (DisassembleAll || PrintSource || PrintLines)
Disassemble = true;
-
- if (Demangle.getValue() != "none" && Demangle.getValue() != "" &&
- Demangle.getValue() != "itanium")
- warn("Unsupported demangling style");
-
if (!Disassemble
&& !Relocations
&& !DynamicRelocations
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.h?rev=336829&r1=336828&r2=336829&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.h (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.h Wed Jul 11 11:09:52 2018
@@ -30,7 +30,6 @@ namespace object {
extern cl::opt<std::string> TripleName;
extern cl::opt<std::string> ArchName;
extern cl::opt<std::string> MCPU;
-extern cl::opt<std::string> Demangle;
extern cl::list<std::string> MAttrs;
extern cl::list<std::string> FilterSections;
extern cl::opt<bool> AllHeaders;
@@ -97,7 +96,6 @@ void PrintSectionHeaders(const object::O
void PrintSectionContents(const object::ObjectFile *o);
void PrintSymbolTable(const object::ObjectFile *o, StringRef ArchiveName,
StringRef ArchitectureName = StringRef());
-void warn(StringRef Message);
LLVM_ATTRIBUTE_NORETURN void error(Twine Message);
LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, Twine Message);
LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, std::error_code EC);
More information about the llvm-commits
mailing list