[llvm] [llvm][mustache][NFC] Use type alias for escape symbols (PR #138050)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 30 16:42:13 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 -- llvm/lib/Support/Mustache.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Support/Mustache.cpp b/llvm/lib/Support/Mustache.cpp
index f201e1c37..da6b6cdcd 100644
--- a/llvm/lib/Support/Mustache.cpp
+++ b/llvm/lib/Support/Mustache.cpp
@@ -125,16 +125,14 @@ public:
   };
 
   ASTNode(llvm::StringMap<AstPtr> &Partials, llvm::StringMap<Lambda> &Lambdas,
-          llvm::StringMap<SectionLambda> &SectionLambdas,
-          EscapeMap &Escapes)
+          llvm::StringMap<SectionLambda> &SectionLambdas, EscapeMap &Escapes)
       : Partials(Partials), Lambdas(Lambdas), SectionLambdas(SectionLambdas),
         Escapes(Escapes), Ty(Type::Root), Parent(nullptr),
         ParentContext(nullptr) {}
 
   ASTNode(std::string Body, ASTNode *Parent, llvm::StringMap<AstPtr> &Partials,
           llvm::StringMap<Lambda> &Lambdas,
-          llvm::StringMap<SectionLambda> &SectionLambdas,
-          EscapeMap &Escapes)
+          llvm::StringMap<SectionLambda> &SectionLambdas, EscapeMap &Escapes)
       : Partials(Partials), Lambdas(Lambdas), SectionLambdas(SectionLambdas),
         Escapes(Escapes), Ty(Type::Text), Body(std::move(Body)), Parent(Parent),
         ParentContext(nullptr) {}
@@ -142,8 +140,7 @@ public:
   // Constructor for Section/InvertSection/Variable/UnescapeVariable Nodes
   ASTNode(Type Ty, Accessor Accessor, ASTNode *Parent,
           llvm::StringMap<AstPtr> &Partials, llvm::StringMap<Lambda> &Lambdas,
-          llvm::StringMap<SectionLambda> &SectionLambdas,
-          EscapeMap &Escapes)
+          llvm::StringMap<SectionLambda> &SectionLambdas, EscapeMap &Escapes)
       : Partials(Partials), Lambdas(Lambdas), SectionLambdas(SectionLambdas),
         Escapes(Escapes), Ty(Ty), Parent(Parent),
         AccessorValue(std::move(Accessor)), ParentContext(nullptr) {}
@@ -728,20 +725,17 @@ void Template::registerLambda(std::string Name, SectionLambda L) {
   SectionLambdas[Name] = L;
 }
 
-void Template::overrideEscapeCharacters(EscapeMap E) {
-  Escapes = std::move(E);
-}
+void Template::overrideEscapeCharacters(EscapeMap E) { Escapes = std::move(E); }
 
 Template::Template(StringRef TemplateStr) {
   Parser P = Parser(TemplateStr);
   Tree = P.parse(Partials, Lambdas, SectionLambdas, Escapes);
   // The default behavior is to escape html entities.
-  const
-  EscapeMap HtmlEntities = {{'&', "&"},
-                                              {'<', "<"},
-                                              {'>', ">"},
-                                              {'"', """},
-                                              {'\'', "'"}};
+  const EscapeMap HtmlEntities = {{'&', "&"},
+                                  {'<', "<"},
+                                  {'>', ">"},
+                                  {'"', """},
+                                  {'\'', "'"}};
   overrideEscapeCharacters(HtmlEntities);
 }
 

``````````

</details>


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


More information about the llvm-commits mailing list