[clang] [clang-tools-extra] [clang] Add formal linkage to textual AST dump (PR #194600)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Fri May 1 10:30:00 PDT 2026
================
@@ -1429,6 +1429,30 @@ static void dumpBasePath(raw_ostream &OS, const CastExpr *Node) {
OS << ')';
}
+void TextNodeDumper::dumpFormalLinkage(const NamedDecl *ND) {
+ switch (ND->getFormalLinkage()) {
+ case Linkage::None:
+ // A lot of declarations have no linkage, so we only dump linkage if there
+ // is one.
+ break;
+ case Linkage::Internal:
+ OS << " internal-linkage";
+ break;
+ case Linkage::External:
+ OS << " external-linkage";
+ break;
+ case Linkage::Module:
+ OS << " module-linkage";
+ break;
+ case Linkage::Invalid:
+ OS << " invalid-linkage";
+ break;
----------------
mizvekov wrote:
```suggestion
case Linkage::Invalid:
llvm_unreachable("Linkage hasn't been computed!");
```
I don't think this can be observed over an AST dump.
This is used internally to mark declarations that haven't had their linkage computed yet.
https://github.com/llvm/llvm-project/pull/194600
More information about the cfe-commits
mailing list