[clang-tools-extra] [clang-doc][NFC] refactor out file helpers (PR #134298)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 3 13:05:39 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- clang-tools-extra/clang-doc/support/File.cpp clang-tools-extra/clang-doc/support/File.h clang-tools-extra/clang-doc/HTMLGenerator.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-doc/support/File.cpp b/clang-tools-extra/clang-doc/support/File.cpp
index a9162bee8..b1fe6f6d8 100644
--- a/clang-tools-extra/clang-doc/support/File.cpp
+++ b/clang-tools-extra/clang-doc/support/File.cpp
@@ -12,8 +12,7 @@
namespace clang {
namespace doc {
-llvm::Error
-copyFile(llvm::StringRef FilePath, llvm::StringRef OutDirectory) {
+llvm::Error copyFile(llvm::StringRef FilePath, llvm::StringRef OutDirectory) {
llvm::SmallString<128> PathWrite;
llvm::sys::path::native(OutDirectory, PathWrite);
llvm::sys::path::append(PathWrite, llvm::sys::path::filename(FilePath));
@@ -29,14 +28,13 @@ copyFile(llvm::StringRef FilePath, llvm::StringRef OutDirectory) {
return llvm::Error::success();
}
-
llvm::SmallString<128> computeRelativePath(llvm::StringRef Destination,
llvm::StringRef Origin) {
// If Origin is empty, the relative path to the Destination is its complete
// path.
if (Origin.empty())
return Destination;
-
+
// The relative path is an empty path if both directories are the same.
if (Destination == Origin)
return {};
diff --git a/clang-tools-extra/clang-doc/support/File.h b/clang-tools-extra/clang-doc/support/File.h
index fc52d185a..828da7df3 100644
--- a/clang-tools-extra/clang-doc/support/File.h
+++ b/clang-tools-extra/clang-doc/support/File.h
@@ -14,11 +14,10 @@
namespace clang {
namespace doc {
-llvm::Error
-copyFile(llvm::StringRef FilePath, llvm::StringRef OutDirectory);
+llvm::Error copyFile(llvm::StringRef FilePath, llvm::StringRef OutDirectory);
-llvm::SmallString<128>
-computeRelativePath(llvm::StringRef Destination,llvm::StringRef Origin);
+llvm::SmallString<128> computeRelativePath(llvm::StringRef Destination,
+ llvm::StringRef Origin);
} // namespace doc
} // namespace clang
``````````
</details>
https://github.com/llvm/llvm-project/pull/134298
More information about the cfe-commits
mailing list