diff --git a/clang/tools/scan-build/bin/scan-build b/clang/tools/scan-build/bin/scan-build
index 37241c6d85c5b..b90e635d31757 100755
--- a/clang/tools/scan-build/bin/scan-build
+++ b/clang/tools/scan-build/bin/scan-build
@@ -820,7 +820,8 @@ ENDTEXT
}
# Emit the "View" link.
- print OUT "
View Report | ";
+ my $EncodedReport = URLEscape($ReportFile);
+ print OUT "View Report | ";
# Emit REPORTBUG markers.
print OUT "\n\n";
@@ -1465,6 +1466,16 @@ sub HtmlEscape {
return $tmp;
}
+##----------------------------------------------------------------------------##
+# URLEscape - encode characters that are special in URLs
+##----------------------------------------------------------------------------##
+
+sub URLEscape {
+ my $arg = shift || '';
+ $arg =~ s/\+/%2B/g;
+ return $arg;
+}
+
##----------------------------------------------------------------------------##
# ShellEscape - backslash escape characters that are special to the shell
##----------------------------------------------------------------------------##