diff options
author | Hans Wennborg <hans@hanshq.net> | 2018-06-25 13:23:49 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2018-06-25 13:23:49 +0000 |
commit | 7f055b7e1a07716517c5ef7564aa95b7749fc2f7 (patch) | |
tree | 815f3cd286d172c0ca238b2f0d293dc1d10ef2a0 /include/clang/Serialization | |
parent | 9bbcb03216cb2f853c4603bf367284992c47a1aa (diff) |
[clang-cl] Don't emit dllexport inline functions etc. from pch files (PR37801)
With MSVC, PCH files are created along with an object file that needs to
be linked into the final library or executable. That object file
contains the code generated when building the headers. In particular, it
will include definitions of inline dllexport functions, and because they
are emitted in this object file, other files using the PCH do not need
to emit them. See the bug for an example.
This patch makes clang-cl match MSVC's behaviour in this regard, causing
significant compile-time savings when building dlls using precompiled
headers.
For example, in a 64-bit optimized shared library build of Chromium with
PCH, it reduces the binary size and compile time of
stroke_opacity_custom.obj from 9315564 bytes to 3659629 bytes and 14.6
to 6.63 s. The wall-clock time of building blink_core.dll goes from
38m41s to 22m33s. ("user" time goes from 1979m to 1142m).
Differential Revision: https://reviews.llvm.org/D48426
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335466 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Serialization')
-rw-r--r-- | include/clang/Serialization/ASTBitCodes.h | 2 | ||||
-rw-r--r-- | include/clang/Serialization/ASTReader.h | 2 | ||||
-rw-r--r-- | include/clang/Serialization/Module.h | 3 |
3 files changed, 6 insertions, 1 deletions
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h index e98a6236a4..82bb1f5fa1 100644 --- a/include/clang/Serialization/ASTBitCodes.h +++ b/include/clang/Serialization/ASTBitCodes.h @@ -42,7 +42,7 @@ namespace serialization { /// Version 4 of AST files also requires that the version control branch and /// revision match exactly, since there is no backward compatibility of /// AST files at this time. - const unsigned VERSION_MAJOR = 6; + const unsigned VERSION_MAJOR = 7; /// AST file minor version number supported by this version of /// Clang. diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index 7de511ad61..d09a9f4023 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -2071,6 +2071,8 @@ public: /// Note: overrides method in ExternalASTSource Module *getModule(unsigned ID) override; + bool DeclIsFromPCHWithObjectFile(const Decl *D) override; + /// Retrieve the module file with a given local ID within the specified /// ModuleFile. ModuleFile *getLocalModuleFile(ModuleFile &M, unsigned ID); diff --git a/include/clang/Serialization/Module.h b/include/clang/Serialization/Module.h index 5f41f3927a..653981b142 100644 --- a/include/clang/Serialization/Module.h +++ b/include/clang/Serialization/Module.h @@ -157,6 +157,9 @@ public: /// Whether timestamps are included in this module file. bool HasTimestamps = false; + /// Whether the PCH has a corresponding object file. + bool PCHHasObjectFile = false; + /// The file entry for the module file. const FileEntry *File = nullptr; |