[Lldb-commits] [lldb] r131779 - /lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp

Johnny Chen johnny.chen at apple.com
Fri May 20 17:55:57 PDT 2011


Author: johnny
Date: Fri May 20 19:55:57 2011
New Revision: 131779

URL: http://llvm.org/viewvc/llvm-project?rev=131779&view=rev
Log:
A little refactoring.

Modified:
    lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp

Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=131779&r1=131778&r2=131779&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Fri May 20 19:55:57 2011
@@ -108,6 +108,13 @@
     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 @@
 
                 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 @@
         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);
         }
     }
 }





More information about the lldb-commits mailing list