diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-01-22 01:41:56 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-01-22 01:41:56 +0000 |
commit | 5156c3857066396e744137cdadf94fb18fa29da2 (patch) | |
tree | afcc4c56db5547c8bd452d99b338bb50e81f8b55 /clang/lib/Serialization/ASTReaderDecl.cpp | |
parent | 1d59f99f5c1c28035bd5fa35626d5813dc2b0500 (diff) | |
download | bcm5719-llvm-5156c3857066396e744137cdadf94fb18fa29da2.tar.gz bcm5719-llvm-5156c3857066396e744137cdadf94fb18fa29da2.zip |
[modules] It's possible to merge into the pattern of a class template before we
load the definition data from the declaration itself. In that case, merge
properly; don't assume the prior definition is the same as our own.
llvm-svn: 226761
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index a783183d2ef..8c03b0b8b27 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -1457,9 +1457,13 @@ void ASTDeclReader::ReadCXXRecordDefinition(CXXRecordDecl *D) { ReadCXXDefinitionData(*DD, Record, Idx); - // If we're reading an update record, we might already have a definition for - // this record. If so, just merge into it. - if (D->DefinitionData.getNotUpdated()) { + // We might already have a definition for this record. This can happen either + // because we're reading an update record, or because we've already done some + // merging. Either way, just merge into it. + if (auto *CanonDD = D->DefinitionData.getNotUpdated()) { + if (CanonDD->Definition != DD->Definition) + Reader.MergedDeclContexts.insert( + std::make_pair(DD->Definition, CanonDD->Definition)); MergeDefinitionData(D, *DD); return; } |