Index: include/clang/Serialization/ASTReader.h =================================================================== --- include/clang/Serialization/ASTReader.h +++ include/clang/Serialization/ASTReader.h @@ -843,6 +843,9 @@ /// \brief Whether we have tried loading the global module index yet. bool TriedLoadingGlobalIndex; + ///\brief Whether we are currently processing update records. + bool ProcessingUpdateRecords; + typedef llvm::DenseMap SwitchCaseMapTy; /// \brief Mapping from switch-case IDs in the chain to switch-case statements /// @@ -2130,6 +2133,8 @@ /// \brief Loads comments ranges. void ReadComments() override; + + bool isProcessingUpdateRecords() { return ProcessingUpdateRecords; } }; /// \brief Helper class that saves the current stream position and Index: lib/Serialization/ASTReader.cpp =================================================================== --- lib/Serialization/ASTReader.cpp +++ lib/Serialization/ASTReader.cpp @@ -8628,6 +8628,7 @@ void ASTReader::FinishedDeserializing() { assert(NumCurrentElementsDeserializing && "FinishedDeserializing not paired with StartedDeserializing"); + ProcessingUpdateRecords = true; if (NumCurrentElementsDeserializing == 1) { // We decrease NumCurrentElementsDeserializing only after pending actions // are finished, to avoid recursively re-calling finishPendingActions(). @@ -8649,6 +8650,7 @@ Context.adjustExceptionSpec(cast(Redecl), ESI); } } + ProcessingUpdateRecords = false; if (ReadTimer) ReadTimer->stopTimer(); @@ -8711,6 +8713,7 @@ AllowConfigurationMismatch(AllowConfigurationMismatch), ValidateSystemInputs(ValidateSystemInputs), UseGlobalIndex(UseGlobalIndex), TriedLoadingGlobalIndex(false), + ProcessingUpdateRecords(false), CurrSwitchCaseStmts(&SwitchCaseStmts), NumSLocEntriesRead(0), TotalNumSLocEntries(0), NumStatementsRead(0), TotalNumStatements(0), NumMacrosRead(0), TotalNumMacros(0), NumIdentifierLookups(0), Index: lib/Serialization/ASTWriter.cpp =================================================================== --- lib/Serialization/ASTWriter.cpp +++ lib/Serialization/ASTWriter.cpp @@ -5714,6 +5714,7 @@ } void ASTWriter::ResolvedExceptionSpec(const FunctionDecl *FD) { + if (Chain && Chain->isProcessingUpdateRecords()) return ; assert(!DoneWritingDeclsAndTypes && "Already done writing updates!"); if (!Chain) return; Chain->forEachImportedKeyDecl(FD, [&](const Decl *D) { Index: test/Modules/Inputs/PR28332/TextualInclude.h =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28332/TextualInclude.h @@ -0,0 +1,7 @@ +#ifndef LLVM_ADT_SMALLVECTORIMPL_H +#define LLVM_ADT_SMALLVECTORIMPL_H +class SmallVectorImpl { +public: + ~SmallVectorImpl(); +}; +#endif \ No newline at end of file Index: test/Modules/Inputs/PR28332/a.h =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28332/a.h @@ -0,0 +1,8 @@ +#include "b.h" + +class A { + SmallVector LegalIntWidths; + A() {} +}; + +#include "c.h" Index: test/Modules/Inputs/PR28332/b.h =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28332/b.h @@ -0,0 +1,3 @@ +#include "TextualInclude.h" +template class SmallVector : SmallVectorImpl {}; + Index: test/Modules/Inputs/PR28332/c.h =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28332/c.h @@ -0,0 +1,2 @@ +#include "TextualInclude.h" + Index: test/Modules/Inputs/PR28332/module.modulemap =================================================================== --- /dev/null +++ test/Modules/Inputs/PR28332/module.modulemap @@ -0,0 +1,3 @@ +module "c.h" { header "c.h" export * } +module "b.h" { header "b.h" export * } +module "a.h" { header "a.h" } Index: test/Modules/pr28332.cpp =================================================================== --- /dev/null +++ test/Modules/pr28332.cpp @@ -0,0 +1,8 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -std=c++11 -I%S/Inputs/PR28332 -verify %s +// RUN: %clang_cc1 -std=c++11 -fmodules -fmodule-map-file=%S/Inputs/PR28332/module.modulemap -fmodules-cache-path=%t -I%S/Inputs/PR28332 -verify %s + +#include "a.h" + +// expected-no-diagnostics +