summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-05-21 00:55:57 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-05-21 00:55:57 +0000
commit1c464d496168fb54fcd88f483921aeb40e94d8af (patch)
tree36047732118c5b1aa090d7998ddcc7de4b663f7b /lldb/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
parente7faaa6688bcc04f31f17284a6449de8ed98adbc (diff)
downloadbcm5719-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.cpp17
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);
}
}
}
OpenPOWER on IntegriCloud