Modules: Do not serialize #pragma pack state
The modules side of r299226, which serializes #pragma pack state, doesn't work well. The main purpose was to make -include and -include-pch match semantics (the PCH side). We also started serializing #pragma pack in PCMs, in the hopes of making modules and non-modules builds more consistent. But consider: $ cat a.h $ cat b.h #pragma pack(push, 2) $ cat module.modulemap module M { module a { header "a.h" } module b { header "b.h" } } $ cat t.cpp #include "a.h" #pragma pack(show) As of r299226, the #pragma pack(show) gives "2", even though we've only included "a.h". - With -fmodules-local-submodule-visibility, this is clearly wrong. We should get the default state (8 on x86_64). - Without -fmodules-local-submodule-visibility, this kind of matches how other things work (as if include-the-whole-module), but it's still really terrible, and it doesn't actually make modules and non-modules builds more consistent. This commit disables the serialization for modules, essentially a partial revert of r299226. Going forward: 1. Having this #pragma pack stuff escape is terrible design (or, more often, a horrible bug). We should prioritize adding warnings (maybe -Werror by default?). 2. If we eventually reintroduce this for modules, it should only apply to -fmodules-local-submodule-visibility, and it should be tracked on a per-submodule basis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300380 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- lib/Serialization/ASTWriter.cpp 5 additions, 0 deletionslib/Serialization/ASTWriter.cpp
- test/Modules/Inputs/module.map 3 additions, 14 deletionstest/Modules/Inputs/module.map
- test/Modules/Inputs/pragma_pack_push.h 0 additions, 6 deletionstest/Modules/Inputs/pragma_pack_push.h
- test/Modules/Inputs/pragma_pack_reset_push.h 0 additions, 4 deletionstest/Modules/Inputs/pragma_pack_reset_push.h
- test/Modules/pragma-pack.c 0 additions, 35 deletionstest/Modules/pragma-pack.c
- test/Modules/pragma-pack.cpp 25 additions, 0 deletionstest/Modules/pragma-pack.cpp
Loading
Please register or sign in to comment