diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-19 20:59:20 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-05-19 20:59:20 +0000 |
commit | 851072efb735dcd66d1fbfaa434c2c9d7708e29a (patch) | |
tree | cfc7e71519d6586be724be73cee0593f7790fb6a /clang/lib/Serialization/ASTReaderDecl.cpp | |
parent | cb172b104a6ae03001dfc5a2971efc49cef083ab (diff) | |
download | bcm5719-llvm-851072efb735dcd66d1fbfaa434c2c9d7708e29a.tar.gz bcm5719-llvm-851072efb735dcd66d1fbfaa434c2c9d7708e29a.zip |
If two sibling modules declare the same entity, and we indirectly pull a
declaration of that entity in from one of those modules, keep track of the fact
that we've not completed the redeclaration chain yet so that we can pull the
remaining declarations in from the other module if they're needed.
llvm-svn: 209161
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 719d56edf2c..bb87632962e 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -208,6 +208,10 @@ namespace clang { static void attachLatestDeclImpl(...); static void attachLatestDecl(Decl *D, Decl *latest); + template <typename DeclT> + static void markIncompleteDeclChainImpl(Redeclarable<DeclT> *D); + static void markIncompleteDeclChainImpl(...); + /// \brief Determine whether this declaration has a pending body. bool hasPendingBody() const { return HasPendingBody; } @@ -2510,6 +2514,25 @@ void ASTDeclReader::attachLatestDecl(Decl *D, Decl *Latest) { } } +template<typename DeclT> +void ASTDeclReader::markIncompleteDeclChainImpl(Redeclarable<DeclT> *D) { + D->RedeclLink.markIncomplete(); +} +void ASTDeclReader::markIncompleteDeclChainImpl(...) { + llvm_unreachable("markIncompleteDeclChain on non-redeclarable declaration"); +} + +void ASTReader::markIncompleteDeclChain(Decl *D) { + switch (D->getKind()) { +#define ABSTRACT_DECL(TYPE) +#define DECL(TYPE, BASE) \ + case Decl::TYPE: \ + ASTDeclReader::markIncompleteDeclChainImpl(cast<TYPE##Decl>(D)); \ + break; +#include "clang/AST/DeclNodes.inc" + } +} + ASTReader::MergedDeclsMap::iterator ASTReader::combineStoredMergedDecls(Decl *Canon, GlobalDeclID CanonID) { // If we don't have any stored merged declarations, just look in the |