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

Johnny Chen johnny.chen at apple.com
Wed May 18 15:48:41 PDT 2011


Author: johnny
Date: Wed May 18 17:48:41 2011
New Revision: 131594

URL: http://llvm.org/viewvc/llvm-project?rev=131594&view=rev
Log:
Some refactorings with respect to setting of the 'printTokenized' flag.
Add some comments.

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=131594&r1=131593&r2=131594&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Wed May 18 17:48:41 2011
@@ -200,35 +200,31 @@
         EDTokenRef token;
         const char *tokenStr;
 
-        if (EDGetToken(&token, m_inst, tokenIndex))
+        if (EDGetToken(&token, m_inst, tokenIndex)) // 0 on success
             printTokenized = false;
-
-        if (!printTokenized || !EDTokenIsOpcode(token))
+        else if (!EDTokenIsOpcode(token))
             printTokenized = false;
-
-        if (!printTokenized || EDGetTokenString(&tokenStr, token))
+        else if (EDGetTokenString(&tokenStr, token)) // 0 on success
             printTokenized = false;
 
-        // Put the token string into our opcode string
-        opcode.PutCString(tokenStr);
-
-        // If anything follows, it probably starts with some whitespace.  Skip it.
-
-        tokenIndex++;
-
-        if (printTokenized && tokenIndex < numTokens)
+        if (printTokenized)
         {
-            if(!printTokenized || EDGetToken(&token, m_inst, tokenIndex))
-                printTokenized = false;
+            // Put the token string into our opcode string
+            opcode.PutCString(tokenStr);
 
-            if(!printTokenized || !EDTokenIsWhitespace(token))
-                printTokenized = false;
-        }
+            // If anything follows, it probably starts with some whitespace.  Skip it.
+            if (++tokenIndex < numTokens)
+            {
+                if (EDGetToken(&token, m_inst, tokenIndex)) // 0 on success
+                    printTokenized = false;
+                else if (!EDTokenIsWhitespace(token))
+                    printTokenized = false;
+            }
 
-        tokenIndex++;
+            ++tokenIndex;
+        }
 
         // Handle the operands and the comment.
-
         StreamString operands;
         StreamString comment;
 





More information about the lldb-commits mailing list