From 2ee19a308fd7eaee249e20ae156653e46b0b4a71 Mon Sep 17 00:00:00 2001 From: Adam Nemet Date: Mon, 26 Feb 2018 21:15:50 +0000 Subject: [PATCH] [opt-viewer] Set title for the source pages git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326125 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/tools/opt-viewer/Outputs/basic/basic_or.c.html | 1 + test/tools/opt-viewer/Outputs/basic/basic_or.h.html | 1 + test/tools/opt-viewer/Outputs/suppress/s.swift.html | 1 + .../opt-viewer/Outputs/unicode-function-name/s.swift.html | 1 + tools/opt-viewer/opt-viewer.py | 4 +++- 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/tools/opt-viewer/Outputs/basic/basic_or.c.html b/test/tools/opt-viewer/Outputs/basic/basic_or.c.html index 0a706b631c9..225ebabdbde 100644 --- a/test/tools/opt-viewer/Outputs/basic/basic_or.c.html +++ b/test/tools/opt-viewer/Outputs/basic/basic_or.c.html @@ -1,5 +1,6 @@ +or.c diff --git a/test/tools/opt-viewer/Outputs/basic/basic_or.h.html b/test/tools/opt-viewer/Outputs/basic/basic_or.h.html index 6ca5a18f29d..7cbda8a66c7 100644 --- a/test/tools/opt-viewer/Outputs/basic/basic_or.h.html +++ b/test/tools/opt-viewer/Outputs/basic/basic_or.h.html @@ -1,5 +1,6 @@ +or.h diff --git a/test/tools/opt-viewer/Outputs/suppress/s.swift.html b/test/tools/opt-viewer/Outputs/suppress/s.swift.html index eae4c4f5610..813db9f9820 100644 --- a/test/tools/opt-viewer/Outputs/suppress/s.swift.html +++ b/test/tools/opt-viewer/Outputs/suppress/s.swift.html @@ -1,5 +1,6 @@ +s.swift diff --git a/test/tools/opt-viewer/Outputs/unicode-function-name/s.swift.html b/test/tools/opt-viewer/Outputs/unicode-function-name/s.swift.html index 470c7f8061a..67514d556c3 100644 --- a/test/tools/opt-viewer/Outputs/unicode-function-name/s.swift.html +++ b/test/tools/opt-viewer/Outputs/unicode-function-name/s.swift.html @@ -1,5 +1,6 @@ +s.swift diff --git a/tools/opt-viewer/opt-viewer.py b/tools/opt-viewer/opt-viewer.py index a3eaba1495c..4887043e0f9 100755 --- a/tools/opt-viewer/opt-viewer.py +++ b/tools/opt-viewer/opt-viewer.py @@ -44,6 +44,7 @@ def suppress(remark): class SourceFileRenderer: def __init__(self, source_dir, output_dir, filename, no_highlight): + self.filename = filename existing_filename = None if os.path.exists(filename): existing_filename = filename @@ -131,6 +132,7 @@ class SourceFileRenderer: print(''' +{} @@ -147,7 +149,7 @@ class SourceFileRenderer: Inline Context -''', file=self.stream) +'''.format(os.path.basename(self.filename)), file=self.stream) self.render_source_lines(self.source_stream, line_remarks) print('''