summaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTWriterDecl.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-01-31 01:06:56 +0000
committerBen Langmuir <blangmuir@apple.com>2014-01-31 01:06:56 +0000
commit80c2e6dedfc856ae6b7f9d349a2fefe7a9166a3d (patch)
treeebfca635234733e9b72eb0fa67773e057961bb0b /lib/Serialization/ASTWriterDecl.cpp
parentb680ae8cb62816ff207be02dca49688a66d43a6f (diff)
downloadclang-80c2e6dedfc856ae6b7f9d349a2fefe7a9166a3d.tar.gz
clang-80c2e6dedfc856ae6b7f9d349a2fefe7a9166a3d.tar.bz2
clang-80c2e6dedfc856ae6b7f9d349a2fefe7a9166a3d.tar.xz
Fix autolinking when modules are imported in pch files
Add the ImportDecl to the set of interesting delcarations that are deserialized eagerly when an AST file is loaded (rather than lazily like most decls). This is required to get auto linking to work when there is no explicit import in the main file. Also resolve a FIXME to rename 'ExternalDefinitions', since that is only one of the things that need eager deserialization. The new name is 'EagerlyDeserializedDecls'. The corresponding AST bitcode is also renamed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200505 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r--lib/Serialization/ASTWriterDecl.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp
index 89f9b4885f..5d5e4bb428 100644
--- a/lib/Serialization/ASTWriterDecl.cpp
+++ b/lib/Serialization/ASTWriterDecl.cpp
@@ -1817,8 +1817,10 @@ static bool isRequiredDecl(const Decl *D, ASTContext &Context) {
// An ObjCMethodDecl is never considered as "required" because its
// implementation container always is.
- // File scoped assembly or obj-c implementation must be seen.
- if (isa<FileScopeAsmDecl>(D) || isa<ObjCImplDecl>(D))
+ // File scoped assembly or obj-c implementation must be seen. ImportDecl is
+ // used by codegen to determine the set of imported modules to search for
+ // inputs for automatic linking.
+ if (isa<FileScopeAsmDecl>(D) || isa<ObjCImplDecl>(D) || isa<ImportDecl>(D))
return true;
return Context.DeclMustBeEmitted(D);
@@ -1906,10 +1908,8 @@ void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
// Flush C++ base specifiers, if there are any.
FlushCXXBaseSpecifiers();
- // Note "external" declarations so that we can add them to a record in the
- // AST file later.
- //
- // FIXME: This should be renamed, the predicate is much more complicated.
+ // Note declarations that should be deserialized eagerly so that we can add
+ // them to a record in the AST file later.
if (isRequiredDecl(D, Context))
- ExternalDefinitions.push_back(ID);
+ EagerlyDeserializedDecls.push_back(ID);
}