Skip to content

Fix v22 regen regressions: namespace qualifier placement, nested-type over-qualification, computed-pointer GUID ref readonly - #828

Merged
tannergooding merged 5 commits into
dotnet:mainfrom
tannergooding:fix-namespace-qualifier-const-pointer
Jul 19, 2026
Merged

Fix v22 regen regressions: namespace qualifier placement, nested-type over-qualification, computed-pointer GUID ref readonly#828
tannergooding merged 5 commits into
dotnet:mainfrom
tannergooding:fix-namespace-qualifier-const-pointer

Conversation

@tannergooding

Copy link
Copy Markdown
Member

Batch 3 of the v22.1.8 regressions found regenerating terrafx.interop.windows (follows #826 and #827).

Three independent fixes, each with a regression test (existing tests extended -- no duplicate baselines):


Namespace qualifier placed after leading cv-qualifiers (201x across 19 Gdiplus files)

The round-1 namespace-qualification fix prepended Ns:: to the front of the whole declarator, ignoring leading cv-qualifiers, so a const-pointer parameter came out as Gdiplus::const BlurParams * instead of const Gdiplus::BlurParams *. GetNamespaceQualifiedNativeTypeName now skips leading const /volatile before inserting the qualifier. NativeTypeName-string only (no emitted-type change), but it's an incorrect type string.


Don't qualify a nested type referenced from within its own container (12x)

The round-1 code unconditionally qualified a nested type by its container(s), so _u_e__Union u; was emitted as GDI_NONREMOTE._u_e__Union u; even from inside GDI_NONREMOTE. The qualification chain now stops at the reference site's shared enclosing scope, while still qualifying genuine cross-scope references.


Keep ref readonly on computed-pointer GUID #define macros (25x in DirectX/um/dinput/DIPROP.cs)

#827 fixed the #define IID_X IID_Y property-alias form. The same ref readonly drop persisted for the #define X MAKEDIPROP(n) form (expands to *(const GUID*)(n)): the body emitted a ref-return but the return type dropped ref readonly, leaving a malformed by-value Guid return paired with a => ref body. The copy-constructor Reference check now also matches a pointer-dereference arg, so both ref-returning #define GUID forms keep ref readonly.


Full generator suite green (4165 passed), 0 warnings. Also confirmed no action needed on the neutral v22 behavior changes (coclass IID_->CLSID_ reclassification, dropped defensive unchecked, removed CA1508 pragma).

tannergooding and others added 5 commits July 18, 2026 19:13
The clang 22 namespace-qualifier restoration prepended `Namespace::` to the front
of the whole declarator, so a `const` pointer parameter came out as the malformed
`Ns::const Point *` instead of `const Ns::Point *`. Insert the qualifier after any
leading `const`/`volatile` tokens so it lands on the type name.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The clang 22 nested-type qualification unconditionally prefixed a nested type
with its containing record(s), so a field referencing a sibling nested type came
out as `Outer.Inner` even though `Inner` is directly in scope. Stop the
qualification at the scope shared with the reference site so within-container
references stay unqualified while cross-scope references keep their prefix.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A `#define X (*(const GUID*)(n))` macro (as `MAKEDIPROP` expands to) emits a `ref`-returning
body, but the copy-constructor Reference check only matched a `DeclRefExpr` alias, so the return
type dropped `ref readonly` and left a by-value `Guid` paired with a `=> ref` body. Also treat a
pointer dereference arg as ref-returnable.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…lifier

The restored `Namespace::` prefix belongs at the start of the nested-name-specifier, after the full
run of leading type decl-specifiers. cv-qualifiers alone were skipped, so an elaborated `struct`/
`enum` specifier or `__unaligned` still produced a malformed `Ns::struct Point *`. Skip the whole
closed set (cv-qualifiers, the elaborated class-key, and `__unaligned`).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A `#define X (*(const GUID*)(n))` macro (as `MAKEDIPROP` expands to)
targets an arbitrary address, so a managed byref to it is not valid.
Emit it as a `Guid*` returning the pointer rather than a `ref readonly`
alias. A `#define IID_X IID_Y` alias still references real storage and
keeps its `ref readonly` form.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@tannergooding
tannergooding merged commit e10924c into dotnet:main Jul 19, 2026
12 checks passed
@tannergooding
tannergooding deleted the fix-namespace-qualifier-const-pointer branch July 19, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant