diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 81f08e375bd74e672bcf5f473c46c4a7bb21d0fb..00f7b7ad0e3b02d4b887c6a86f53490bc0a91ca5 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -6028,6 +6028,15 @@ void ASTReader::FinishedDeserializing() { assert(NumCurrentElementsDeserializing && "FinishedDeserializing not paired with StartedDeserializing"); if (NumCurrentElementsDeserializing == 1) { + + // Fully load the interesting decls, including deserializing their bodies, + // so that any other declarations that get referenced in the body will be + // fully deserialized by the time we pass them to the consumer. + for (std::deque<Decl *>::iterator + I = InterestingDecls.begin(), + E = InterestingDecls.end(); I != E; ++I) + (*I)->getBody(); + do { // If any identifiers with corresponding top-level declarations have // been loaded, load those declarations now.