[clang-tools-extra] [clang-doc] [feat] add --repository-line-prefix argument (PR #131280)

via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 21 20:13:37 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 3840f787a21a66686f5d8bf61877d41f3a65f205 109fd75a7fd3e5d8292579e571440c429a0b9cc2 --extensions cpp,h -- clang-tools-extra/clang-doc/HTMLGenerator.cpp clang-tools-extra/clang-doc/MDGenerator.cpp clang-tools-extra/clang-doc/Representation.cpp clang-tools-extra/clang-doc/Representation.h clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang-tools-extra/clang-doc/MDGenerator.cpp b/clang-tools-extra/clang-doc/MDGenerator.cpp
index 993596c708..7b7473f5e4 100644
--- a/clang-tools-extra/clang-doc/MDGenerator.cpp
+++ b/clang-tools-extra/clang-doc/MDGenerator.cpp
@@ -8,9 +8,9 @@
 
 #include "Generators.h"
 #include "Representation.h"
-#include "llvm/Support/FormatVariadic.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Path.h"
 #include <string>
 
@@ -61,7 +61,7 @@ static void writeFileDefinition(const ClangDocContext &CDCtx, const Location &L,
 
     std::string LineAnchor =
         formatv("#{0}{1}", CDCtx.RepositoryLinePrefix.value_or(""),
-                      std::to_string(L.LineNumber));
+                std::to_string(L.LineNumber));
 
     OS << formatv("*Defined at [{0}{1}]({0}{2})*", LineAnchor, L.Filename,
                   StringRef{*CDCtx.RepositoryUrl});
diff --git a/clang-tools-extra/clang-doc/Representation.h b/clang-tools-extra/clang-doc/Representation.h
index 04293edc98..bf6e6a8513 100644
--- a/clang-tools-extra/clang-doc/Representation.h
+++ b/clang-tools-extra/clang-doc/Representation.h
@@ -507,8 +507,7 @@ struct ClangDocContext {
   ClangDocContext() = default;
   ClangDocContext(tooling::ExecutionContext *ECtx, StringRef ProjectName,
                   bool PublicOnly, StringRef OutDirectory, StringRef SourceRoot,
-                  StringRef RepositoryUrl,
-                  StringRef RepositoryCodeLinePrefix,
+                  StringRef RepositoryUrl, StringRef RepositoryCodeLinePrefix,
                   std::vector<std::string> UserStylesheets);
   tooling::ExecutionContext *ECtx;
   std::string ProjectName; // Name of project clang-doc is documenting.

``````````

</details>


https://github.com/llvm/llvm-project/pull/131280


More information about the cfe-commits mailing list