hanchenye-llvm-project/clang/lib/Serialization
Duncan P. N. Exon Smith 03df14c6dd 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.

llvm-svn: 300380
2017-04-15 00:07:57 +00:00
..
ASTCommon.cpp Add an explicit derived class of FunctionDecl to model deduction guides rather 2017-02-17 20:05:37 +00:00
ASTCommon.h PR29097: add an update record when we instantiate the default member 2016-08-24 21:25:37 +00:00
ASTReader.cpp [modules] Delay calling DeclMustBeEmitted until it's safe. 2017-04-12 21:56:05 +00:00
ASTReaderDecl.cpp [modules] Delay calling DeclMustBeEmitted until it's safe. 2017-04-12 21:56:05 +00:00
ASTReaderInternals.h Remove move constructors that are identical to the generated default move ctor. 2016-10-21 18:55:07 +00:00
ASTReaderStmt.cpp Encapsulate FPOptions and use it consistently 2017-03-27 19:17:25 +00:00
ASTWriter.cpp Modules: Do not serialize #pragma pack state 2017-04-15 00:07:57 +00:00
ASTWriterDecl.cpp Modular Codegen: Separate flags for function and debug info support 2017-04-12 20:58:33 +00:00
ASTWriterStmt.cpp Encapsulate FPOptions and use it consistently 2017-03-27 19:17:25 +00:00
CMakeLists.txt Introduce module file extensions to piggy-back data onto module files. 2015-11-03 18:33:07 +00:00
GeneratePCH.cpp Apply clang-tidy's performance-unnecessary-value-param to parts of clang. 2017-03-21 21:35:04 +00:00
GlobalModuleIndex.cpp Modules: Use hash of PCM content for SIGNATURE 2017-03-13 18:45:08 +00:00
Module.cpp Modules: Simplify the ModuleFile constructor; likely NFC 2017-01-29 00:39:09 +00:00
ModuleFileExtension.cpp [NFC] Header cleanup 2016-07-18 19:02:11 +00:00
ModuleManager.cpp Spelling mistakes in comments. NFCI. (PR27635) 2017-03-30 14:13:19 +00:00
MultiOnDiskHashTable.h [NFC] Header cleanup 2016-07-18 19:02:11 +00:00