[llvm] [clang-doc] fix mustache template whitespace (PR #153724)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 25 15:11:23 PDT 2025


ilovepi wrote:

> Sorry I'm new here and still getting familiar with the project. I thought the unit tests at https://github.com/llvm/llvm-project/blob/main/llvm/unittests/Support/MustacheTest.cpp were meant to test conformance. Although I see now that there are tests from https://github.com/mustache/spec v1.4.3 that are missing.

No need to apologize. Those tests do largely mimic the spec tests, but are a bit incomplete. We've mostly focused on the base spec to date.

> 
> > We have an in-tree tool to test the conformance
> 
> How is this tool different
> 

The unittests make sure that our implementation is working(in so far as they've been implemented), but we don't control the upstream spec. I wanted us to have a way to simply link in our implementation and test agains the public spec.  Ideally, we'd get the full suite of tests translated into our unit tests, and fix the implementation as we go. But even then, I'd expect the `llvm-test-mustache-spec` tool to be useful for periodically checking our conformance as the spec updates.

> , and when should I use one over the other?
For understanding conformance, use the tool. For testing our implementation is working the way we expect (which may not match the spec) you can use the unit tests.

> > My intuition is that the whitespace issue you're fixing on the clang-doc side is a symptom of this deficiency in our mustache implementation.
> 
> Ah, then perhaps I've really misunderstood this one. I thought llvm/lib/Support/Mustache.cpp was 'our mustache implementation'? Where should I be looking to sort that out?
> 

oh, geez. I misread your patch. It seems you are touching the exact bits I'm talking about. sorry for the confusion. In this case the [clang-doc] tag is a bit misleading, since this is a change to `[llvm]`, IMO. I'm guessing I didn't look closely enough after I saw the [clang-doc] tag and assumed your changes were to the clang-doc code under clang-tools-extra. Sorry for the misunderstanding.

> > That may be true, but clang-doc is supposed to be a standalone tool with no external dependencies. You're right that another library or external tool may be even more well suited to the task, but its our goal to provide a compelling implementation here, and to not require any other third-party dependencies. We're just not quite there yet.
> 
> I figured this was the case. Understood.

So, since it seems I've misread a part of your patch and given some rather questionable directions, let me summarize things briefly:

1) your change is in the right place
2) it still needs some kind of testing. 
3) you can/should also test w/ the `llvm-test-mustache-spec` tool, since after your patch, we'd need to update the xfail tests (hopefully). Anything that was xfail that now passes can be added to the unit tests.



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


More information about the llvm-commits mailing list