This is an archive of the discontinued LLVM Phabricator instance.

PR27132: Proper mangling for __unaligned qualifier (now with both PR27367 and PR27666 fixed)
ClosedPublic

Authored by andreybokhanko on May 10 2016, 8:22 AM.

Details

Summary

This is exactly same patch as http://reviews.llvm.org/D19654 (already reviewed and LGTMed by majnemer), with a couple of changes to fix PR27666:

  • __unaligned is not considered when checking type compatibility in CompareReferenceRelationship and TryReferenceInit, as MS compiler does the same (and qos2.h header relies on this)
  • Test from PR27666 added to SemaCXX/MicrosoftExtensions.cpp

I verified the patch on a huge selection of Windows headers (including qos2.h), so hopefully there will be no more reverts! :-)

Yours,

Andrey

Software Engineer
Intel Compiler Team

Diff Detail

Event Timeline

andreybokhanko retitled this revision from to PR27132: Proper mangling for __unaligned qualifier (now with both PR27367 and PR27666 fixed).
andreybokhanko updated this object.
andreybokhanko added reviewers: rnk, majnemer, thakis.
andreybokhanko added a subscriber: cfe-commits.
majnemer edited edge metadata.May 10 2016, 8:43 AM

Can we test pointers to data members? Is it possible to have __unaligned int *S::* or int *S::* __unaligned or even __unaligned int *S::* __unaligned ?

include/clang/AST/Type.h
446

Could this be !other.hasUnaligned() || hasUnaligned() ?

5393–5399

Variables should be capitalized.

lib/Sema/SemaType.cpp
2680–2681

If this was a ranged-for over Fixits, we wouldn't need to keep updating the loop bounds.

andreybokhanko edited edge metadata.

Patch updated to address David's comments.

Yours,
Andrey

andreybokhanko marked 3 inline comments as done.May 11 2016, 4:25 AM

Can we test pointers to data members? Is it possible to have __unaligned int *S::* or int *S::* __unaligned or even __unaligned int *S::* __unaligned ?

I added these three cases to MicrosoftExtensions.cpp. We behave exactly like MS compiler: allow all three usages, disallow assignment of an unaligned pointer to a non-unaligned one.

include/clang/AST/Type.h
446

Fixed

5393–5399

Fixed

lib/Sema/SemaType.cpp
2680–2681

Fixed

majnemer accepted this revision.May 11 2016, 8:55 AM
majnemer edited edge metadata.

LGTM, thanks!

This revision is now accepted and ready to land.May 11 2016, 8:55 AM
This revision was automatically updated to reflect the committed changes.