[clang-tools-extra] [clang-doc] markdown parser (PR #155887)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 28 10:11:28 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 origin/main HEAD --extensions cpp,h -- clang-tools-extra/clang-doc/MDParser.cpp clang-tools-extra/clang-doc/MDParser.h clang-tools-extra/unittests/clang-doc/MDParserTest.cpp clang-tools-extra/clang-doc/Representation.h
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-doc/MDParser.cpp b/clang-tools-extra/clang-doc/MDParser.cpp
index 80e038600..e27a337b1 100644
--- a/clang-tools-extra/clang-doc/MDParser.cpp
+++ b/clang-tools-extra/clang-doc/MDParser.cpp
@@ -27,8 +27,8 @@ MarkdownParser::processDelimiters(SmallString<64> &Line, const size_t &Origin) {
(!isPunctuation(Proceeding) || isWhitespace(Preceeding) ||
isPunctuation(Preceeding));
bool RightFlanking = !isWhitespace(Preceeding) &&
- (!isPunctuation(Preceeding) || isWhitespace(Proceeding) ||
- isPunctuation(Proceeding));
+ (!isPunctuation(Preceeding) ||
+ isWhitespace(Proceeding) || isPunctuation(Proceeding));
if (LeftFlanking && RightFlanking)
return {DelimiterContext{LeftFlanking, RightFlanking, true, true}, Idx};
diff --git a/clang-tools-extra/clang-doc/MDParser.h b/clang-tools-extra/clang-doc/MDParser.h
index 32599eaae..723d9ec34 100644
--- a/clang-tools-extra/clang-doc/MDParser.h
+++ b/clang-tools-extra/clang-doc/MDParser.h
@@ -23,7 +23,7 @@ enum class MDType {
enum class MDTokenType { LeftDelimiterRun, RightDelimiterRun, Text };
struct Node {
- SmallVector<Node*> Children;
+ SmallVector<Node *> Children;
MDType Type;
Node *Parent;
std::string Content;
@@ -89,7 +89,8 @@ class MarkdownParser {
/// @param Lines An entire Document that resides in a comment.
/// @return the root of a Markdown document.
- Node* parse(std::vector<SmallString<64>> &Lines);
+ Node *parse(std::vector<SmallString<64>> &Lines);
+
public:
MarkdownParser() : Arena(BumpPtrAllocator()), Saver(Arena) {}
std::string render(std::vector<SmallString<64>> &Lines);
``````````
</details>
https://github.com/llvm/llvm-project/pull/155887
More information about the cfe-commits
mailing list