[llvm] r283896 - [opt-viewer] Convert another HTML output to use a multiline string
Adam Nemet via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 11 09:19:06 PDT 2016
Author: anemet
Date: Tue Oct 11 11:19:06 2016
New Revision: 283896
URL: http://llvm.org/viewvc/llvm-project?rev=283896&view=rev
Log:
[opt-viewer] Convert another HTML output to use a multiline string
Modified:
llvm/trunk/utils/opt-viewer/opt-viewer.py
Modified: llvm/trunk/utils/opt-viewer/opt-viewer.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/opt-viewer/opt-viewer.py?rev=283896&r1=283895&r2=283896&view=diff
==============================================================================
--- llvm/trunk/utils/opt-viewer/opt-viewer.py (original)
+++ llvm/trunk/utils/opt-viewer/opt-viewer.py Tue Oct 11 11:19:06 2016
@@ -36,10 +36,16 @@ class Remark(yaml.YAMLObject):
def Column(self):
return self.DebugLoc['Column']
- def getDebugLoc(self):
+ @property
+ def DebugLocString(self):
return "{}:{}:{}".format(self.File, self.Line, self.Column)
- def getLink(self):
+ @property
+ def DemangledFunctionName(self):
+ return demangle(self.Function)
+
+ @property
+ def Link(self):
return "{}#L{}".format(SourceFileRenderer.html_file_name(self.File), self.Line)
def getArgString(self, pair):
@@ -133,14 +139,14 @@ class IndexRenderer:
def __init__(self):
self.stream = open(os.path.join(args.output_dir, 'index.html'), 'w')
- def render_entry(self, remark):
- html = SourceFileRenderer.html_file_name(remark.File)
- link = "<a href={}>{}</a>".format(remark.getLink(), remark.getDebugLoc())
-
- dem_name = demangle(remark.Function)
- print("<tr><td>{}<td>{}<td>{}<td class=\"column-entry-{}\">{}</tr>".format(
- link,
- remark.Hotness, dem_name, remark.color, remark.Pass), file=self.stream)
+ def render_entry(self, r):
+ print('''
+<tr>
+<td><a href={r.Link}>{r.DebugLocString}</a></td>
+<td>{r.Hotness}%</td>
+<td>{r.DemangledFunctionName}</td>
+<td class=\"column-entry-{r.color}\">{r.Pass}</td>
+</tr>'''.format(**locals()), file=self.stream)
def render(self, all_remarks):
print('''
More information about the llvm-commits
mailing list