[llvm] r308346 - [opt-viewer] Handle file names that contain '#'

Brian Gesiak via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 12:25:34 PDT 2017


Author: modocache
Date: Tue Jul 18 12:25:34 2017
New Revision: 308346

URL: http://llvm.org/viewvc/llvm-project?rev=308346&view=rev
Log:
[opt-viewer] Handle file names that contain '#'

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

Modified:
    llvm/trunk/tools/opt-viewer/optrecord.py

Modified: llvm/trunk/tools/opt-viewer/optrecord.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt-viewer/optrecord.py?rev=308346&r1=308345&r2=308346&view=diff
==============================================================================
--- llvm/trunk/tools/opt-viewer/optrecord.py (original)
+++ llvm/trunk/tools/opt-viewer/optrecord.py Tue Jul 18 12:25:34 2017
@@ -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):




More information about the llvm-commits mailing list