chore: bump LLVM to 77e43ec1 (May 21, 2026)#1241
Conversation
✨ Highlights
🧾 Changes by Scope
🔝 Top Files
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1241 +/- ##
========================================
Coverage 83.16% 83.16%
========================================
Files 35 35
Lines 3658 3660 +2
Branches 843 844 +1
========================================
+ Hits 3042 3044 +2
Misses 409 409
Partials 207 207
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
An automated preview of the documentation is available at https://1241.mrdocs.prtest2.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-07-09 14:35:48 UTC |
c7b6850 to
feddc6f
Compare
There was a problem hiding this comment.
Nice bump :)
Reimplementing rawCommentForDecl ourselves ended up a little verbose. We could add the pinned commit (77e43ec1) to the comment on locsForCommentSearch so the next bump can compare the port against the exact revision it came from. We could also check why they removed it in their PRs, issues and git blame (doing that might even reveal a better way of doing things) and we should consider filing an issue upstream asking to re-expose a per-declaration lookup (making getRawCommentNoCache public would do). If Clang takes it, we can delete the port on a later bump.
| # *.profraw. | ||
| - name: Prune third-party profraw | ||
| if: matrix.coverage | ||
| run: find build/third-party -name '*.profraw' -delete |
There was a problem hiding this comment.
What’s this profraw issue? The explanation is more descriptive than explanatory of the motivation of the command. It seems to me like if this is happening and coverage is globing the wrong directory, that’s what should be fixed instead of a second workaround to accommodate the first mistake.
There was a problem hiding this comment.
The issue is that the coverage step scans build/ for *.profraw, which happens to include the *.profraw test fixtures in the LLVM extracted source tree; but they are in an older format, which makes the llvm-profdata merge fail. I'm not sure why this issue didn't occur when the cache was cold, the first time. Yes, this would better be fixed in the action.
| append-common-cxxflags: | | ||
| clang: -gz=zstd | ||
| extra-values: | | ||
| # libc++ runtimes: clang + (ASan or MSan) needs instrumented libc++ |
There was a problem hiding this comment.
Why are these gone? Weren't they being used? Interesting. I thought we used the custom libc++ whenever we had msan or asan. It it because the logic for this necessity is now being checked in the bootstrap script?
There was a problem hiding this comment.
Since this was an unrelated change, I restored them. Anyway, the decision of whether to build an instrumented libc++ is made in bootstrap, even on develop.
| // Non-allocating placement allocation functions | ||
| void* operator new ( std::size_t count, void* ptr ); | ||
| void* operator new[]( std::size_t count, void* ptr ); | ||
| #include <vcruntime_new.h> |
There was a problem hiding this comment.
Interesting. Is this something being fixed in passing or do we have something about the new version that interacts with the libc stubs? In fact, I would have this question about all other changes to the libc stubs. It's unexpected to me that they interacted in an LLVM bump.
| <source-path>function-template.cpp</source-path> | ||
| <line-number>22</line-number> | ||
| <column-number>6</column-number> | ||
| <column-number>1</column-number> |
There was a problem hiding this comment.
These changes to line numbers and column numbers are curious. Since the fixtures didn't change, we need to check whether they were broken before or whether they're broken now. Or maybe they're referencing a different part of the symbol.
| return False | ||
| san = sanitizer_flag_name(sanitizer.lower()) | ||
| if san not in ("address", "memory"): | ||
| if san != "memory": |
There was a problem hiding this comment.
We could discuss this with Matheus, but I believe the changes to this file are incorrect. At the very least we lose some std lib annotations, and so on. ASan doesn't need sanitized dependencies as much as MSan but it's less effective without sanitized dependencies. And we're building+caching our own libc++ anyway so the cost is low.
| #ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_VCRUNTIME_NEW_H | ||
| #define MRDOCS_SHARE_HEADERS_LIBC_STUBS_VCRUNTIME_NEW_H | ||
|
|
||
| // libc++ includes this Microsoft runtime header (through <__new/align_val_t.h>) |
There was a problem hiding this comment.
This whole comment, especially "Provide just enough of it for parsing." seems redundant because this is true for all stubs by definition. They're headers libc++ includes for its own functionality and we provide only enough for parsing.
feddc6f to
e0bd9e6
Compare
Good news! None of the above applies! :-) Turns out that I misread ASTContext.h and |
e0bd9e6 to
21e4e77
Compare
The new pin includes llvm/llvm-project#198452, which attaches documentation comments to macro definitions. That is the prerequisite for reading them from Clang directly instead of scanning the source, as we were initially doing in PR cppalliance#1192. The pin was about six months behind, so this also adapts MrDocs to the Clang API changes across that range: - USRGeneration.h moved from clang/Index to clang/UnifiedSymbolResolution; the `clang::index` namespace and signatures are unchanged. - `clang::DiagnosticConsumer::finish()` was removed, so the collecting diagnostic consumer relies on the forwarded `EndSourceFile()` instead. - The driver option table moved to clang/Options/Options.h, with its enumerators now in `clang::options` and `getDriverOptTable()` in `clang`. - `cl::getRegisteredOptions()` now returns a `DenseMap`, so its entries expose `.second` instead of `getValue()`. - `SubstituteConstraintExpressionWithoutSatisfaction` was re-synced with Clang's current implementation. Parsing the newer libc++ also needs a new vcruntime_new.h stub, since its align_val_t.h now includes vcruntime_new.h under the vcruntime ABI. The regenerated goldens change only because Clang's output drifted over the six months: constrained templates and destructors get different symbol IDs from USR generation, though their structure is identical (requires-clause, dtor-overloads), and a few declaration locations changed.
The MSan and ASan jobs build MrDocs against a sanitizer-instrumented libc++. MSan requires that, since it reports false positives on any uninstrumented code; ASan doesn't require it, but is more effective with it, through libc++'s container-overflow annotations. The pinned libc++ contains a self-guard (added upstream in llvm/llvm-project#168955) that errors out when an ASan-instrumented libc++ is parsed without ASan, and MrDocs parses libc++ with normal flags for the libcxx.cpp golden. So an instrumented libc++ can no longer double as the one MrDocs reads. Thus, install both an instrumented and an uninstrumented libc++. Specifically, install the instrumented libc++ into a prefix separate from the main LLVM build's plain libc++; `needs_libcxx_runtimes` still selects it for Clang + ASan/MSan. MrDocs links the instrumented library through `libcxx_runtime_flags` but parses the plain headers the main build leaves at the LLVM install prefix. Also, move Clang ASan and MSan to the latest Clang, since building the pinned libc++ from source needs a recent one.
The coverage step globs build/ for *.profraw, which after the bump also holds the extracted LLVM source tree. That tree ships llvm-profdata test fixtures in an older raw-profile version that llvm-profdata rejects, failing the merge. Delete build/third-party profraw first; MrDocs' own profraw live elsewhere under build/.
21e4e77 to
cc2c819
Compare
The new pin includes llvm/llvm-project#198452, which attaches documentation comments to macro definitions. That is the prerequisite for reading them from Clang directly instead of scanning the source, as we were initially doing in PR #1192.
Changes
Third-party: Bump LLVM to 77e43ec1 (Associate documentation comments with macro definitions llvm/llvm-project#198452).
CI: Update the hardcoded LLVM hash in the cache key (ci-matrix.yml) and its mirror unit test (test_cache_keys.py) to match the new pin, so the key misses and LLVM builds fresh instead of restoring the old install. Build an instrumented libc++ for MSan only (the newer libc++ needs the latest Clang, and ASan works with the normal libc++), and prune the LLVM source tree's stray .profraw fixtures.
Source: The pin was about six months behind, so this also adapts MrDocs to the Clang API changes across that range:
clang::indexnamespace and signatures are unchanged.clang::DiagnosticConsumer::finish()was removed, so the collecting diagnostic consumer relies on the forwardedEndSourceFile()instead.clang::optionsandgetDriverOptTable()inclang.cl::getRegisteredOptions()now returns aDenseMap, so its entries expose.secondinstead ofgetValue().SubstituteConstraintExpressionWithoutSatisfactionwas re-synced with Clang's current implementation.getRawCommentForDeclNoCache, the per-declaration comment lookupgetDocumentationrelied on, is no longer public. Its only public replacement,getRawCommentForAnyRedecl, follows the redeclaration chain and so cannot return a single declaration's own comment.getDocumentationkeeps the per-declaration behavior by porting Clang's declaration-path comment search (getLocsForCommentSearchandgetRawCommentNoCacheImpl) as file-local helpers.Parsing the newer libc++ also needs a new vcruntime_new.h stub and C++ guards so stdbool.h, stdalign.h, and threads.h stop redefining
bool,alignas, andthread_local, which are keywords, not macros, in C++.Golden tests: The regenerated goldens change only because Clang's output drifted over the six months: constrained templates and destructors get different symbol IDs from USR generation, though their structure is identical (requires-clause, dtor-overloads), and a few declaration locations shifted by a line or column (auto, param-types, function-template).
Testing
No new tests are added; this is a toolchain bump. The existing unit and golden suites already cover the affected behavior and run in CI on every build, and the goldens whose output changed have been regenerated as described above.
Documentation
No documentation changes are needed: this is an internal toolchain bump with no user-facing API changes.