[clang] [clang-tools-extra] [clang] Add formal linkage to textual AST dump (PR #194600)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Fri May 1 09:58:39 PDT 2026


Endilll wrote:

There are multiple decisions we need to make, mostly around the placement and verbosity:
- All templates are specified to have linkage. Do we emit linkage on `TemplateDecl`s or on their children (`CXXRecordDecl`, `FunctionDecl`), or both? (At the time of writing the answer is "only on `TemplateDecl`s")
- Typedefs and type aliases which are not templates do not have linkage, but what do we do with unnamed structs and enums that have typedef name for linkage purposes? (At the time of writing the answer is "emit linkage of typedefs in such cases")
- Variables at block scopes rarely have linkage (`extern` is needed). Do we bother emitting `no-linkage` for 99% of `VarDecl`s? (At the time of writing the answer is "`no-linkage` is assumed and never emitted".)

Implementation is in `TextNodeDumper.cpp`. If reviewers have time to look at tests, I suggest looking at the new `ast-dump-linkage.cpp` test, where a lot of interesting cases are brought under the same roof.

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


More information about the cfe-commits mailing list