]> granicus.if.org Git - llvm/commitdiff
[opt-viewer] Handle file names that contain '#'
authorBrian Gesiak <modocache@gmail.com>
Tue, 18 Jul 2017 19:25:34 +0000 (19:25 +0000)
committerBrian Gesiak <modocache@gmail.com>
Tue, 18 Jul 2017 19:25:34 +0000 (19:25 +0000)
Summary:
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.

Reviewers: anemet, davidxl

Reviewed By: davidxl

Subscribers: llvm-commits, fhahn

Differential Revision: https://reviews.llvm.org/D34646

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308346 91177308-0d34-0410-b5e6-96231b3b80d8

tools/opt-viewer/optrecord.py

index 6f6537ab055d36c4f4fbab0e9a3b5b750c142e65..4599e12d7e68844223ff62199e9952c7cc394ae6 100644 (file)
@@ -49,7 +49,7 @@ def demangle(name):
 
 
 def html_file_name(filename):
-    return filename.replace('/', '_') + ".html"
+    return filename.replace('/', '_').replace('#', '_') + ".html"
 
 
 def make_link(File, Line):