From: Diego Astiazaran Date: Fri, 26 Jul 2019 18:02:42 +0000 (+0000) Subject: [clang-format] Fix style of css file paths X-Git-Tag: llvmorg-11-init~13461 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d6cdd98a25b85a4c14a79542f5b832b21fc5592a;p=platform%2Fupstream%2Fllvm.git [clang-format] Fix style of css file paths CSS files included in HTML should have a path in posix style, it should not be different for Windows. Differential Revision: https://reviews.llvm.org/D65309 llvm-svn: 367137 --- diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp index 56ed976..50660ff 100644 --- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp +++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp @@ -231,6 +231,8 @@ genStylesheetsHTML(StringRef InfoPath, const ClangDocContext &CDCtx) { SmallString<128> StylesheetPath = computeRelativePath("", InfoPath); llvm::sys::path::append(StylesheetPath, llvm::sys::path::filename(FilePath)); + // Paths in HTML must be in posix-style + llvm::sys::path::native(StylesheetPath, llvm::sys::path::Style::posix); LinkNode->Attributes.try_emplace("href", StylesheetPath); Out.emplace_back(std::move(LinkNode)); } diff --git a/clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp b/clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp index 81fcdb1..454ab7d 100644 --- a/clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp +++ b/clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp @@ -110,34 +110,23 @@ TEST(HTMLGeneratorTest, emitRecordHTML) { ClangDocContext CDCtx = getClangDocContext(); auto Err = G->generateDocForInfo(&I, Actual, CDCtx); assert(!Err); - SmallString<16> PathToF; - llvm::sys::path::native("../../../path/to/F.html", PathToF); - SmallString<16> PathToInt; - llvm::sys::path::native("../int.html", PathToInt); - SmallString<16> PathToSylesheet; - llvm::sys::path::native("../../../clang-doc-default-stylesheet.css", - PathToSylesheet); std::string Expected = R"raw( class r - +

class r

Defined at line 10 of test.cpp

Inherits from - F + F , G

Members