diff options
author | Johnny Chen <johnny.chen@apple.com> | 2011-05-21 00:55:57 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2011-05-21 00:55:57 +0000 |
commit | 1c464d496168fb54fcd88f483921aeb40e94d8af (patch) | |
tree | 36047732118c5b1aa090d7998ddcc7de4b663f7b /lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp | |
parent | e7faaa6688bcc04f31f17284a6449de8ed98adbc (diff) | |
download | bcm5719-llvm-1c464d496168fb54fcd88f483921aeb40e94d8af.tar.gz bcm5719-llvm-1c464d496168fb54fcd88f483921aeb40e94d8af.zip |
A little refactoring.
llvm-svn: 131779
Diffstat (limited to 'lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp')
-rw-r--r-- | lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp index c2e0ef288f4..ea31a82798c 100644 --- a/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp +++ b/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp @@ -108,6 +108,13 @@ StripSpaces(llvm::StringRef &Str) while (!Str.empty() && isspace(Str.back())) Str = Str.substr(0, Str.size()-1); } +static void +Align(Stream *s, const char *str) +{ + llvm::StringRef raw_disasm(str); + StripSpaces(raw_disasm); + s->PutCString(raw_disasm.str().c_str()); +} void InstructionLLVM::Dump @@ -342,9 +349,7 @@ InstructionLLVM::Dump if (EDGetInstString(&str, m_inst)) return; - llvm::StringRef raw_disasm(str); - StripSpaces(raw_disasm); - s->PutCString(raw_disasm.str().c_str()); + Align(s, str); } else { @@ -374,10 +379,8 @@ InstructionLLVM::Dump else { // EDis fails to parse the tokens of this inst. Need to align this - // raw disassembly with the rest of output. - llvm::StringRef raw_disasm(str); - StripSpaces(raw_disasm); - s->PutCString(raw_disasm.str().c_str()); + // raw disassembly's opcode with the rest of output. + Align(s, str); } } } |