[PATCH] D34646: [opt-viewer] Handle file names that contain '#'

Brian Gesiak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 14:53:25 PDT 2017


modocache created this revision.
Herald added a subscriber: fhahn.

When using opt-viewer.py with files with '#' in their name, such as
'foo#bar.cpp', opt-viewer.py would generate links such as
'/path/to/foo#bar.cpp.opt.yaml#L42'. In this case, the link is
interpreted by browsers as a link to the file '/path/to/foo', and to the
section within that file with ID 'bar.cpp.opt.yaml#L42'.

To work around this issue, replace '#' with '_' in file names and links
in opt-viewer.py.


https://reviews.llvm.org/D34646

Files:
  utils/opt-viewer/optrecord.py


Index: utils/opt-viewer/optrecord.py
===================================================================
--- utils/opt-viewer/optrecord.py
+++ utils/opt-viewer/optrecord.py
@@ -47,7 +47,7 @@
 
 
 def html_file_name(filename):
-    return filename.replace('/', '_') + ".html"
+    return filename.replace('/', '_').replace('#', '_') + ".html"
 
 
 def make_link(File, Line):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34646.104026.patch
Type: text/x-patch
Size: 374 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170626/ee239e75/attachment.bin>


More information about the llvm-commits mailing list