From 1074cf2e345d945689549111004df4eeddb8354b Mon Sep 17 00:00:00 2001 From: bangbangsheshotmedown Date: Sun, 1 Mar 2026 17:20:18 +0100 Subject: [PATCH 1/2] Skip forward declaration --- dsymbol/src/dsymbol/conversion/first.d | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dsymbol/src/dsymbol/conversion/first.d b/dsymbol/src/dsymbol/conversion/first.d index 6cad7ff8..af6c154b 100644 --- a/dsymbol/src/dsymbol/conversion/first.d +++ b/dsymbol/src/dsymbol/conversion/first.d @@ -874,6 +874,14 @@ private: dec.accept(this); return; } + // Skip forward declarations (struct Foo;) only process full definitions + // otherwise it'll overwrite the useful one, and dmd -H has the tendency to + // generate a lot of them specially with ImportC + static if (!is(AggType == const(TemplateDeclaration))) + { + if (dec.structBody is null) + return; + } pushSymbol(dec.name.text, kind, symbolFile, dec.name.index); scope(exit) popSymbol(); From 167c817ca3712169148993ad0c49ad0ed08eb9da Mon Sep 17 00:00:00 2001 From: bangbangsheshotmedown Date: Sun, 1 Mar 2026 17:23:35 +0100 Subject: [PATCH 2/2] Only for struct/union --- dsymbol/src/dsymbol/conversion/first.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsymbol/src/dsymbol/conversion/first.d b/dsymbol/src/dsymbol/conversion/first.d index af6c154b..c1b12c45 100644 --- a/dsymbol/src/dsymbol/conversion/first.d +++ b/dsymbol/src/dsymbol/conversion/first.d @@ -879,7 +879,7 @@ private: // generate a lot of them specially with ImportC static if (!is(AggType == const(TemplateDeclaration))) { - if (dec.structBody is null) + if (dec.structBody is null && (kind == CompletionKind.structName || kind == CompletionKind.unionName)) return; } pushSymbol(dec.name.text, kind, symbolFile, dec.name.index);