This is an archive of the discontinued LLVM Phabricator instance.

[MSVC] Allow declaration of multi-dim 'property' array fields
ClosedPublic

Authored by mikerice on Apr 5 2023, 8:42 AM.

Details

Summary

MSVC allows declaration of multi-dim arrays like this:

__declspec(property(get=GetX, put=PutX)) int x[][][];

This syntax can appear in generated typelib headers.

Currently clang errors on declarators like this since it forms an array
type of incomplete array. Rather than try to handle such a type, ignore
adjacent empty chunks so this is treated as if there was only one empty
array chunk (i.e. int x[]).

The functionality to handle multi-dim subscripts of property fields
already works, but only if declared as a single-dim array.

Diff Detail

Event Timeline

mikerice created this revision.Apr 5 2023, 8:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2023, 8:42 AM
mikerice requested review of this revision.Apr 5 2023, 8:42 AM
erichkeane accepted this revision.Apr 5 2023, 9:42 AM

LGTM, this does what I'd expect it to do. Thanks!

clang/test/SemaCXX/ms-property-error.cpp
9

These are exactly the cases I despise where we split notes/diags. As discussed externally, that diagnostic message is awful, but I think outside of the scope of this patch.

This revision is now accepted and ready to land.Apr 5 2023, 9:42 AM

Ah, needs a release note however!

aaron.ballman accepted this revision.Apr 5 2023, 9:47 AM

Changes LGTM but please add a release note about the new functionality when landing.