This is an archive of the discontinued LLVM Phabricator instance.

[MS] Improved implementation #pragma pack (MS pragmas, part 2)
ClosedPublic

Authored by d.zobnin.bugzilla on Apr 29 2016, 8:57 AM.

Details

Summary

An attempt to make implementation of #pragma pack consistent with other "stack" pragmas. Also modifies #pragma options align, since it shares the stack with #pragma pack.
It is the first item from todo list in http://reviews.llvm.org/D19361

The patch doesn't change compiler's behavior, so the tests are not modified.
I'm planning to rework the pragmas' diagnostics in next patch -- it should be a common feature of all "stack" pragmas.

Diff Detail

Repository
rL LLVM

Event Timeline

d.zobnin.bugzilla retitled this revision from to [MS] Improved implementation #pragma pack (MS pragmas, part 2).
d.zobnin.bugzilla updated this object.
d.zobnin.bugzilla added a reviewer: rnk.
lib/Sema/SemaAttr.cpp
277–278 ↗(On Diff #55598)

Here I removed the "no record matching name" diagnostics, which wasn't covered by any test.
I'm going to rework and restore it in future patch.

rnk accepted this revision.Apr 29 2016, 9:59 AM
rnk edited edge metadata.

lgtm

include/clang/Sema/Sema.h
354–357 ↗(On Diff #55598)

Defining a template member function outside of its header is asking for trouble. This is a pre-existing issue that probably shouldn't be dealt with as part of this change, but eventually this needs to move back to the header.

lib/Sema/SemaAttr.cpp
277–278 ↗(On Diff #55598)

Sure, once the pragma stack has support for popping by name.

This revision is now accepted and ready to land.Apr 29 2016, 9:59 AM
This revision was automatically updated to reflect the committed changes.
aaboud added a subscriber: aaboud.Apr 29 2016, 2:10 PM
aaboud added inline comments.
cfe/trunk/lib/Sema/SemaAttr.cpp
110

You forgot to initialize "Alignment" in this case.
This is causing a build failure:
http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux/builds/1758