[llvm-commits] [TV] r79021 - in /television/trunk/tools/llvm-tv: CFGGraphDrawer.cpp CallGraphDrawer.h CodeViewer.cpp CodeViewer.h DSAGraphDrawer.cpp GraphDrawer.cpp GraphDrawer.h GraphPrinters.cpp TVFrame.h TVTreeItem.h
Misha Brukman
brukman+llvm at gmail.com
Fri Aug 14 11:57:50 PDT 2009
Author: brukman
Date: Fri Aug 14 13:57:50 2009
New Revision: 79021
URL: http://llvm.org/viewvc/llvm-project?rev=79021&view=rev
Log:
* Updated to current LLVM and wxWidgets APIs
* Fixed compiler errors and warnings
* Removed trailing whitespace
Modified:
television/trunk/tools/llvm-tv/CFGGraphDrawer.cpp
television/trunk/tools/llvm-tv/CallGraphDrawer.h
television/trunk/tools/llvm-tv/CodeViewer.cpp
television/trunk/tools/llvm-tv/CodeViewer.h
television/trunk/tools/llvm-tv/DSAGraphDrawer.cpp
television/trunk/tools/llvm-tv/GraphDrawer.cpp
television/trunk/tools/llvm-tv/GraphDrawer.h
television/trunk/tools/llvm-tv/GraphPrinters.cpp
television/trunk/tools/llvm-tv/TVFrame.h
television/trunk/tools/llvm-tv/TVTreeItem.h
Modified: television/trunk/tools/llvm-tv/CFGGraphDrawer.cpp
URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/CFGGraphDrawer.cpp?rev=79021&r1=79020&r2=79021&view=diff
==============================================================================
--- television/trunk/tools/llvm-tv/CFGGraphDrawer.cpp (original)
+++ television/trunk/tools/llvm-tv/CFGGraphDrawer.cpp Fri Aug 14 13:57:50 2009
@@ -17,7 +17,7 @@
PM.run (*fn);
MP->releaseModule (); // Don't delete it when you go away, says I
delete MP;
- return buildwxImageFromDotFile ("cfg." + fn->getName() + ".dot");
+ return buildwxImageFromDotFile ("cfg." + fn->getName().str() + ".dot");
}
std::string CFGGraphDrawer::getDisplayTitle (TVTreeItemData *item) {
Modified: television/trunk/tools/llvm-tv/CallGraphDrawer.h
URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/CallGraphDrawer.h?rev=79021&r1=79020&r2=79021&view=diff
==============================================================================
--- television/trunk/tools/llvm-tv/CallGraphDrawer.h (original)
+++ television/trunk/tools/llvm-tv/CallGraphDrawer.h Fri Aug 14 13:57:50 2009
@@ -5,7 +5,7 @@
namespace llvm {
class Module;
-};
+}
//===----------------------------------------------------------------------===//
Modified: television/trunk/tools/llvm-tv/CodeViewer.cpp
URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/CodeViewer.cpp?rev=79021&r1=79020&r2=79021&view=diff
==============================================================================
--- television/trunk/tools/llvm-tv/CodeViewer.cpp (original)
+++ television/trunk/tools/llvm-tv/CodeViewer.cpp Fri Aug 14 13:57:50 2009
@@ -16,7 +16,7 @@
if (!Val)
label = "<badref>";
else if (BasicBlock *BB = dyn_cast<BasicBlock>(Val))
- label = BB->getName() + ":";
+ label = BB->getName().str() + ":";
else if (Instruction *I = dyn_cast<Instruction>(Val)) {
std::ostringstream out;
I->print(out);
@@ -37,7 +37,7 @@
} else
label = "<invalid value>";
- SetText(label.c_str());
+ SetText(wxString(label.c_str(), wxConvUTF8));
}
//===----------------------------------------------------------------------===//
@@ -95,7 +95,8 @@
wxLC_LIST) {
}
-void TVCodeListCtrl::changeItemTextAttrs (TVCodeItem *item, wxColour *newColor,
+void TVCodeListCtrl::changeItemTextAttrs (TVCodeItem *item,
+ const wxColour *newColor,
int newFontWeight) {
item->m_itemId = ItemToIndex[item];
item->SetTextColour(*newColor);
@@ -132,7 +133,7 @@
if (User *U = dyn_cast<User>(V))
for (User::op_iterator op = U->op_begin(), e = U->op_end(); op != e; ++op)
if (TVCodeItem *TCI = ValueToItem[*op])
- changeItemTextAttrs (ValueToItem[*op], wxBLACK, wxNORMAL);
+ changeItemTextAttrs (TCI, wxBLACK, wxNORMAL);
}
Modified: television/trunk/tools/llvm-tv/CodeViewer.h
URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/CodeViewer.h?rev=79021&r1=79020&r2=79021&view=diff
==============================================================================
--- television/trunk/tools/llvm-tv/CodeViewer.h (original)
+++ television/trunk/tools/llvm-tv/CodeViewer.h Fri Aug 14 13:57:50 2009
@@ -43,7 +43,8 @@
std::map<TVCodeItem*, long> ItemToIndex;
void refreshView();
- void changeItemTextAttrs (TVCodeItem *item, wxColour *newColor, int newWgt);
+ void changeItemTextAttrs (TVCodeItem *item, const wxColour *newColor,
+ int newWgt);
public:
void SetFunction (llvm::Function *F);
Modified: television/trunk/tools/llvm-tv/DSAGraphDrawer.cpp
URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/DSAGraphDrawer.cpp?rev=79021&r1=79020&r2=79021&view=diff
==============================================================================
--- television/trunk/tools/llvm-tv/DSAGraphDrawer.cpp (original)
+++ television/trunk/tools/llvm-tv/DSAGraphDrawer.cpp Fri Aug 14 13:57:50 2009
@@ -19,7 +19,7 @@
// DSGraphDrawer implementation
wxImage *DSGraphDrawer::drawModuleGraph(Module *M) {
PassManager PM;
- PM.add(new TargetData("llvm-tv", M));
+ PM.add(new TargetData(M));
PM.add(getModulePass());
PM.run(*M);
return buildwxImageFromDotFile(getFilename(M));
@@ -28,7 +28,7 @@
wxImage *DSGraphDrawer::drawFunctionGraph(Function *F) {
Module *M = F->getParent();
PassManager PM;
- PM.add(new TargetData("llvm-tv", M));
+ PM.add(new TargetData(M));
PM.add(getFunctionPass(F));
PM.run(*M);
return buildwxImageFromDotFile(getFilename(F));
@@ -46,7 +46,7 @@
}
std::string BUGraphDrawer::getFilename(Function *F) {
- return "buds." + F->getName() + ".dot";
+ return "buds." + F->getName().str() + ".dot";
}
std::string BUGraphDrawer::getFilename(Module *M) {
@@ -72,7 +72,7 @@
}
std::string TDGraphDrawer::getFilename(Function *F) {
- return "tdds." + F->getName() + ".dot";
+ return "tdds." + F->getName().str() + ".dot";
}
std::string TDGraphDrawer::getFilename(Module *M) {
@@ -98,7 +98,7 @@
}
std::string LocalGraphDrawer::getFilename(Function *F) {
- return "localds." + F->getName() + ".dot";
+ return "localds." + F->getName().str() + ".dot";
}
std::string LocalGraphDrawer::getFilename(Module *M) {
Modified: television/trunk/tools/llvm-tv/GraphDrawer.cpp
URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/GraphDrawer.cpp?rev=79021&r1=79020&r2=79021&view=diff
==============================================================================
--- television/trunk/tools/llvm-tv/GraphDrawer.cpp (original)
+++ television/trunk/tools/llvm-tv/GraphDrawer.cpp Fri Aug 14 13:57:50 2009
@@ -12,9 +12,9 @@
extern void FatalErrorBox (const std::string msg);
-wxImage *GraphDrawer::buildwxImageFromDotFile (const std::string filename) {
+wxImage *GraphDrawer::buildwxImageFromDotFile (const std::string &filename) {
sys::Path File (filename);
- if (! File.readable ())
+ if (! File.canRead ())
FatalErrorBox ("buildwxImageFromDotFile() got passed a bogus filename: '"
+ filename + "'");
@@ -25,7 +25,7 @@
unlink (filename.c_str ());
wxImage *img = new wxImage;
- if (!img->LoadFile ("image.png"))
+ if (!img->LoadFile (wxString("image.png", wxConvUTF8)))
FatalErrorBox("buildwxImageFromDotFile() produced a non-loadable PNG file");
unlink ("image.png");
@@ -42,7 +42,8 @@
frame->Show (false);
std::string errMsg = "Sorry, you can't draw that kind of graph on "
+ item->getTitle() + ".";
- wxMessageBox (errMsg.c_str (), "Error");
+ wxMessageBox (wxString(errMsg.c_str(), wxConvUTF8),
+ wxString("Error", wxConvUTF8));
return;
}
myPictureCanvas->SetImage (graphImage);
Modified: television/trunk/tools/llvm-tv/GraphDrawer.h
URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/GraphDrawer.h?rev=79021&r1=79020&r2=79021&view=diff
==============================================================================
--- television/trunk/tools/llvm-tv/GraphDrawer.h (original)
+++ television/trunk/tools/llvm-tv/GraphDrawer.h Fri Aug 14 13:57:50 2009
@@ -15,7 +15,7 @@
namespace llvm {
class Module;
class Function;
-};
+}
class TVTreeItemData;
@@ -25,7 +25,7 @@
PictureCanvas *myPictureCanvas;
protected:
- static wxImage *buildwxImageFromDotFile (const std::string filename);
+ static wxImage *buildwxImageFromDotFile (const std::string &filename);
GraphDrawer (wxWindow *parent)
: myPictureCanvas (new PictureCanvas (parent)) { }
Modified: television/trunk/tools/llvm-tv/GraphPrinters.cpp
URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/GraphPrinters.cpp?rev=79021&r1=79020&r2=79021&view=diff
==============================================================================
--- television/trunk/tools/llvm-tv/GraphPrinters.cpp (original)
+++ television/trunk/tools/llvm-tv/GraphPrinters.cpp Fri Aug 14 13:57:50 2009
@@ -1,10 +1,10 @@
//===- GraphPrinters.cpp - DOT printers for various graph types -----------===//
-//
+//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This file defines several printers for various different types of graphs used
@@ -21,6 +21,7 @@
#include "llvm/Analysis/DataStructure/DataStructure.h"
#include "llvm/Analysis/DataStructure/DSGraph.h"
#include "llvm/Support/GraphWriter.h"
+#include "llvm/Support/raw_ostream.h"
#include <fstream>
using namespace llvm;
@@ -30,7 +31,7 @@
std::string Filename = GraphName + ".dot";
O << "Writing '" << Filename << "'...";
std::ofstream F(Filename.c_str());
-
+
if (F.good())
WriteGraph(F, GT);
else
@@ -49,7 +50,7 @@
static std::string getGraphName(CallGraph *F) {
return "Call Graph";
}
-
+
static std::string getNodeLabel(CallGraphNode *Node, CallGraph *Graph) {
if (Node->getFunction())
return ((Value*)Node->getFunction())->getName();
@@ -67,7 +68,7 @@
}
void print(std::ostream &OS) const {}
-
+
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<CallGraph>();
AU.setPreservesAll();
@@ -98,7 +99,7 @@
DS->getGlobalsGraph().print(of);
of.close();
} else
- std::cerr << "Error writing to " << File << "!\n";
+ errs() << "Error writing to " << File << "!\n";
return false;
}
@@ -119,7 +120,7 @@
public:
DSFunctionPrinter(Function *_F) : F(_F) {}
- bool runOnModule(Module &M) {
+ bool runOnModule(Module &M) {
DSType *DS = &getAnalysis<DSType>();
std::string File = getFilename(*F);
std::ofstream of(File.c_str());
@@ -185,7 +186,7 @@
std::string getFilename() { return "localds.dot"; }
};
struct LocalFunctionPrinter : public DSFunctionPrinter<LocalDataStructures> {
- LocalFunctionPrinter(Function *F)
+ LocalFunctionPrinter(Function *F)
: DSFunctionPrinter<LocalDataStructures>(F) {}
std::string getFilename(Function &F) {
return "localds." + F.getName() + ".dot";
Modified: television/trunk/tools/llvm-tv/TVFrame.h
URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/TVFrame.h?rev=79021&r1=79020&r2=79021&view=diff
==============================================================================
--- television/trunk/tools/llvm-tv/TVFrame.h (original)
+++ television/trunk/tools/llvm-tv/TVFrame.h Fri Aug 14 13:57:50 2009
@@ -4,8 +4,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef TVFRAME_H
-#define TVFRAME_H
+#ifndef LLVMTV_TVFRAME_H
+#define LLVMTV_TVFRAME_H
#include "TVSnapshotList.h"
#include "TVWindowIDs.h"
@@ -18,25 +18,26 @@
#include <string>
#include <vector>
+class TVFrame;
+
/// TVTreeCtrl - A specialization of wxTreeCtrl that displays a list of LLVM
/// Modules and Functions from a snapshot
///
-class TVFrame;
class TVTreeCtrl : public wxTreeCtrl {
TVFrame *myFrame;
public:
- TVTreeCtrl::TVTreeCtrl(wxWindow *parent, TVFrame *frame, const wxWindowID id,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxTR_HIDE_ROOT | wxTR_DEFAULT_STYLE
- | wxSUNKEN_BORDER);
+ TVTreeCtrl(wxWindow *parent, TVFrame *frame, const wxWindowID id,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = wxTR_HIDE_ROOT | wxTR_DEFAULT_STYLE
+ | wxSUNKEN_BORDER);
virtual ~TVTreeCtrl() { }
void AddSnapshotsToTree(TVSnapshotList*);
void updateSnapshotList(TVSnapshotList*);
void OnSelChanged(wxTreeEvent &event);
TVTreeItemData *GetSelectedItemData ();
- DECLARE_EVENT_TABLE();
+ DECLARE_EVENT_TABLE()
};
///==---------------------------------------------------------------------==///
@@ -56,7 +57,8 @@
void OnSelChanged (wxNotebookEvent &event);
bool AddItemDisplayer (ItemDisplayer *displayWidget);
void SetSelectedItem (TVTreeItemData *newSelectedItem);
- DECLARE_EVENT_TABLE ()
+
+ DECLARE_EVENT_TABLE()
};
///==---------------------------------------------------------------------==///
@@ -67,7 +69,7 @@
class TVApplication;
class TVFrame : public wxFrame {
TVApplication *myApp;
-
+
wxSplitterWindow *splitterWindow; // divides this into left & right sides
TVTreeCtrl *myTreeCtrl; // left side - displays tree view of module
TVNotebook *notebook; // right side - tab views w/ item displayers
@@ -91,7 +93,7 @@
void initializeSnapshotListAndView ();
void updateDisplayedItem (TVTreeItemData *newlyDisplayedItem);
- DECLARE_EVENT_TABLE ();
+ DECLARE_EVENT_TABLE()
};
-#endif // TVFRAME_H
+#endif // LLVMTV_TVFRAME_H
Modified: television/trunk/tools/llvm-tv/TVTreeItem.h
URL: http://llvm.org/viewvc/llvm-project/television/trunk/tools/llvm-tv/TVTreeItem.h?rev=79021&r1=79020&r2=79021&view=diff
==============================================================================
--- television/trunk/tools/llvm-tv/TVTreeItem.h (original)
+++ television/trunk/tools/llvm-tv/TVTreeItem.h Fri Aug 14 13:57:50 2009
@@ -21,7 +21,7 @@
}
/// TVTreeItemData - Base class for LLVM TV Tree Data
-///
+///
class TVTreeItemData : public wxTreeItemData {
public:
const wxChar *GetDesc() const { return m_desc.c_str(); }
@@ -49,37 +49,37 @@
};
/// TVTreeModuleItem - Tree Item containing a Module
-///
+///
class TVTreeModuleItem : public TVTreeItemData {
private:
llvm::Module *myModule;
public:
- TVTreeModuleItem(const wxString& desc, llvm::Module *mod)
+ TVTreeModuleItem(const wxString& desc, llvm::Module *mod)
: TVTreeItemData(desc), myModule(mod) {}
-
+
void print(std::ostream &out);
wxImage *graphOn(GraphDrawer *grapher) {
return grapher->drawModuleGraph (myModule);
}
void viewCodeOn(TVCodeViewer *viewer) { viewer->viewModuleCode (myModule); }
- virtual std::string getTitle () { return m_desc.c_str(); }
+ virtual std::string getTitle () { return std::string(m_desc.mb_str()); }
virtual std::string dsGraphName () { return "globals graph"; }
};
/// TVTreeFunctionItem - Tree Item containing a Function
-///
+///
class TVTreeFunctionItem : public TVTreeItemData {
private:
llvm::Function *myFunc;
public:
TVTreeFunctionItem(const wxString& desc, llvm::Function *func)
: TVTreeItemData(desc), myFunc(func) {}
-
+
void print(std::ostream &out);
wxImage *graphOn(GraphDrawer *grapher) {
- return grapher->drawFunctionGraph (myFunc);
+ return grapher->drawFunctionGraph (myFunc);
}
void viewCodeOn(TVCodeViewer *viewer) { viewer->viewFunctionCode (myFunc); }
More information about the llvm-commits
mailing list