8 Commits

Author SHA1 Message Date
Paul Kirth
ece59a8cb9
Reland Support for mustache templating language (#132467)
The last version of this patch had memory leaks due to using the
BumpPtrAllocator for data types that required destructors to run to
release heap memory (e.g. via std::vector and std::string). This version
avoids that by using smart pointers, and dropping support for
BumpPtrAllocator.

We should refactor this code to use the BumpPtrAllocator again, but that
can be addressed in future patches, since those are more invasive
changes that need to refactor many of the core data types to avoid
owning allocations.

Adds Support for the Mustache Templating Language. See specs here:
https://mustache.github.io/mustache.5.html This patch implements
support+tests for majority of the features of the language including:

    - Variables
    - Comments
    - Lambdas
    - Sections

This meant as a library to support places where we have to generate
HTML, such as in clang-doc.

Co-authored-by: Peter Chou <peter.chou@mail.utoronto.ca>
2025-03-24 17:23:25 -07:00
PeterChou1
08d15e3f64
Revert "reapply [llvm] add support for mustache templating language" (#131228)
This broke:

https://lab.llvm.org/buildbot/#/builders/64/builds/2486
https://lab.llvm.org/buildbot/#/builders/146/builds/2476
2025-03-13 18:08:58 -04:00
PeterChou1
6bf0c4648e
reapply [llvm] add support for mustache templating language (#130876)
Reapply https://github.com/llvm/llvm-project/pull/130732

Fixes errors which broke build bot that uses GCC as a compiler
https://lab.llvm.org/buildbot/#/builders/66/builds/11049

GCC threw an warning due to an issue std::move with a temporary object
which prevents copy elision. Fixes the issue by removing the std::move

Adds Support for the Mustache Templating Language. See specs here:
https://mustache.github.io/mustache.5.html
This patch implements support+tests for majority of the features of the
language including:

- Variables
- Comments
- Lambdas
- Sections

This meant as a library to support places where we have to generate
HTML, such as in clang-doc.
2025-03-12 07:59:28 -04:00
PeterChou1
554347ba45
Revert "[llvm] add support for mustache templating language (#105893)" (#130873)
This patch caused certain GCC buildbots to failed
errors: https://lab.llvm.org/buildbot/#/builders/66/builds/11049
2025-03-11 21:27:43 -04:00
Jie Fu
9415b7d97f [Support] Fix -Wpessimizing-move in Mustache.cpp (NFC)
/llvm-project/llvm/lib/Support/Mustache.cpp:299:27:
error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
    PrevToken.TokenBody = std::move(Unindented.str());
                          ^
/llvm-project/llvm/lib/Support/Mustache.cpp:299:27: note: remove std::move call here
    PrevToken.TokenBody = std::move(Unindented.str());
                          ^~~~~~~~~~                ~
1 error generated.
2025-03-12 08:58:17 +08:00
PeterChou1
8f05f25360
reapply [llvm] add support for mustache templating language (#130732)
Reapply https://github.com/llvm/llvm-project/pull/105893

Fixes errors which broke build bot that uses GCC as a compiler
https://lab.llvm.org/buildbot/#/builders/136/builds/3100

The issue here was that using Accessor defined in the anonymous
namespace introduces Accessor as a type alias. Which is, later redeclare
as members in classes Token and ASTNode with the same name which causes
error in GCC. The patch fixes it by renaming the Accesor to
AccessorValue. It also fixes warnings caused by the compile due to
initialization


Adds Support for the Mustache Templating Language. See specs here:
https://mustache.github.io/mustache.5.html
This patch implements support+tests for majority of the features of the
language including:

   - Variables
   - Comments
   - Lambdas
   - Sections

This meant as a library to support places where we have to generate
HTML, such as in clang-doc.
2025-03-11 20:46:11 -04:00
PeterChou1
5c055cc4eb
Revert "[llvm] add support for mustache templating language (#105893)" (#130676)
This broke some build bot warnings


https://lab.llvm.org/buildbot/#/builders/160/builds/14381/steps/5/logs/stdio

reverts: https://github.com/llvm/llvm-project/pull/105893
2025-03-10 18:09:26 -04:00
PeterChou1
92c8dd6fc9
[llvm] add support for mustache templating language (#105893)
Adds Support for the Mustache Templating Language. See specs here:
https://mustache.github.io/mustache.5.html
This patch implements support+tests for majority of the features of the
language including:
- Variables
- Comments
- Lambdas
- Sections

This meant as a library to support places where we have to generate
HTML, such as in clang-doc.
2025-03-10 17:51:17 -04:00