summaryrefslogtreecommitdiff
path: root/lib/Sema/MultiplexExternalSemaSource.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2018-06-25 13:23:49 +0000
committerHans Wennborg <hans@hanshq.net>2018-06-25 13:23:49 +0000
commit7f055b7e1a07716517c5ef7564aa95b7749fc2f7 (patch)
tree815f3cd286d172c0ca238b2f0d293dc1d10ef2a0 /lib/Sema/MultiplexExternalSemaSource.cpp
parent9bbcb03216cb2f853c4603bf367284992c47a1aa (diff)
downloadclang-7f055b7e1a07716517c5ef7564aa95b7749fc2f7.tar.gz
[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 'lib/Sema/MultiplexExternalSemaSource.cpp')
-rw-r--r--lib/Sema/MultiplexExternalSemaSource.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Sema/MultiplexExternalSemaSource.cpp b/lib/Sema/MultiplexExternalSemaSource.cpp
index 9370cf27ef..7e61ccbb10 100644
--- a/lib/Sema/MultiplexExternalSemaSource.cpp
+++ b/lib/Sema/MultiplexExternalSemaSource.cpp
@@ -171,6 +171,13 @@ Module *MultiplexExternalSemaSource::getModule(unsigned ID) {
return nullptr;
}
+bool MultiplexExternalSemaSource::DeclIsFromPCHWithObjectFile(const Decl *D) {
+ for (auto *S : Sources)
+ if (S->DeclIsFromPCHWithObjectFile(D))
+ return true;
+ return false;
+}
+
bool MultiplexExternalSemaSource::layoutRecordType(const RecordDecl *Record,
uint64_t &Size,
uint64_t &Alignment,