Fix v22 regen regressions: namespace qualifier placement, nested-type over-qualification, computed-pointer GUID ref readonly - #828
Merged
tannergooding merged 5 commits intoJul 19, 2026
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 aconst-pointer parameter came out asGdiplus::const BlurParams *instead ofconst Gdiplus::BlurParams *.GetNamespaceQualifiedNativeTypeNamenow skips leadingconst/volatilebefore 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 asGDI_NONREMOTE._u_e__Union u;even from insideGDI_NONREMOTE. The qualification chain now stops at the reference site's shared enclosing scope, while still qualifying genuine cross-scope references.Keep
ref readonlyon computed-pointer GUID#definemacros (25x inDirectX/um/dinput/DIPROP.cs)#827 fixed the
#define IID_X IID_Yproperty-alias form. The sameref readonlydrop persisted for the#define X MAKEDIPROP(n)form (expands to*(const GUID*)(n)): the body emitted aref-return but the return type droppedref readonly, leaving a malformed by-valueGuidreturn paired with a=> refbody. The copy-constructorReferencecheck now also matches a pointer-dereference arg, so both ref-returning#defineGUID forms keepref 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 defensiveunchecked, removedCA1508pragma).