[llvm-commits] [TV] r79363 - in /television/trunk/tools/llvm-tv: CodeViewer.cpp CodeViewer.h

Misha Brukman brukman+llvm at gmail.com
Tue Aug 18 13:37:25 PDT 2009


Author: brukman
Date: Tue Aug 18 15:37:25 2009
New Revision: 79363

URL: http://llvm.org/viewvc/llvm-project?rev=79363&view=rev
Log:
* Fixed comment deletion in strings -- instructions no longer have trailing EOL
* Simplified code with new wxS() utility and updated wxWidgets API
* Disabled Hide()/Show() as the latter doesn't seem to undo the former
  in wxWidgets 2.8.7

Modified:
    television/trunk/tools/llvm-tv/CodeViewer.cpp
    television/trunk/tools/llvm-tv/CodeViewer.h

Modified: television/trunk/tools/llvm-tv/CodeViewer.cpp
URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/CodeViewer.cpp?rev=79363&r1=79362&r2=79363&view=diff

==============================================================================
--- television/trunk/tools/llvm-tv/CodeViewer.cpp (original)
+++ television/trunk/tools/llvm-tv/CodeViewer.cpp Tue Aug 18 15:37:25 2009
@@ -2,6 +2,7 @@
 #include "TVApplication.h"
 #include "TVTreeItem.h"
 #include "TVFrame.h"
+#include "wxUtils.h"
 #include "llvm/Function.h"
 #include "llvm/Instruction.h"
 #include "llvm/Value.h"
@@ -20,7 +21,7 @@
     label = BB->getName().str() + ":";
   else if (Instruction *I = dyn_cast<Instruction>(Val)) {
     std::ostringstream out;
-    I->print(out);
+    out << *I;
     label = out.str();
     // Post-processing for more attractive display
     for (unsigned i = 0; i != label.length(); ++i)
@@ -30,33 +31,34 @@
         label[i] = ' ';
         label.insert(label.begin()+i+1, ' ');
       } else if (label[i] == ';') {                      // Delete comments!
-        unsigned Idx = label.find('\n', i+1);            // Find end of line
-        label.erase(label.begin()+i, label.begin()+Idx);
+        label.erase(label.begin()+i, label.end());
         --i;
       }
-
   } else
     label = "<invalid value>";
 
-  SetText(wxString(label.c_str(), wxConvUTF8));
+  SetText(wxS(label));
 }
 
 //===----------------------------------------------------------------------===//
 
+// FIXME: calling Show() after Hide() does not seem to bring back the display of
+// items, so we are disabling them for now, but we'll need to revisit this if
+// the refresh rate is too slow.
 void TVCodeListCtrl::refreshView() {
   // Hide the list while rewriting it from scratch to speed up rendering
-  Hide();
+  // Hide();
 
   // Clear out the list and then re-add all the items.
   long index = 0;
   ClearAll();
   for (Items::iterator i = itemList.begin(), e = itemList.end(); i != e; ++i) {
-    InsertItem(index, (**i).m_text.c_str());
+    InsertItem(index, (*i)->GetText());
     ItemToIndex[*i] = index;
     ++index;
   }
 
-  Show();
+  // Show();
 }
 
 template<class T> void wipe (T x) { delete x; }

Modified: television/trunk/tools/llvm-tv/CodeViewer.h
URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/CodeViewer.h?rev=79363&r1=79362&r2=79363&view=diff

==============================================================================
--- television/trunk/tools/llvm-tv/CodeViewer.h (original)
+++ television/trunk/tools/llvm-tv/CodeViewer.h Tue Aug 18 15:37:25 2009
@@ -7,12 +7,12 @@
 #ifndef CODEVIEWER_H
 #define CODEVIEWER_H
 
+#include "ItemDisplayer.h"
 #include <wx/wx.h>
 #include <wx/listctrl.h>
 #include <map>
 #include <string>
 #include <vector>
-#include "ItemDisplayer.h"
 
 class TVApplication;
 





More information about the llvm-commits mailing list