summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReaderDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-12-11 22:41:00 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-12-11 22:41:00 +0000
commit8aed42229414d212faeb658ba6fe1c0a6cdd38cd (patch)
tree26f5d21d9761b706ab36c7c55c5788b283fd448c /clang/lib/Serialization/ASTReaderDecl.cpp
parent84824edd0b44855a699dc05aaf055a727bb51a5a (diff)
downloadbcm5719-llvm-8aed42229414d212faeb658ba6fe1c0a6cdd38cd.tar.gz
bcm5719-llvm-8aed42229414d212faeb658ba6fe1c0a6cdd38cd.zip
[modules] If the semantic and lexical DC of a decl are the same, write out the
second one as 0 instead of writing the same bits to the module file twice. This typically reduces PCM file size by about 1%. llvm-svn: 255384
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r--clang/lib/Serialization/ASTReaderDecl.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index e55786ef0c4..2c868cbb9fc 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -476,6 +476,8 @@ void ASTDeclReader::VisitDecl(Decl *D) {
// placeholder.
GlobalDeclID SemaDCIDForTemplateParmDecl = ReadDeclID(Record, Idx);
GlobalDeclID LexicalDCIDForTemplateParmDecl = ReadDeclID(Record, Idx);
+ if (!LexicalDCIDForTemplateParmDecl)
+ LexicalDCIDForTemplateParmDecl = SemaDCIDForTemplateParmDecl;
Reader.addPendingDeclContextInfo(D,
SemaDCIDForTemplateParmDecl,
LexicalDCIDForTemplateParmDecl);
@@ -483,6 +485,8 @@ void ASTDeclReader::VisitDecl(Decl *D) {
} else {
DeclContext *SemaDC = ReadDeclAs<DeclContext>(Record, Idx);
DeclContext *LexicalDC = ReadDeclAs<DeclContext>(Record, Idx);
+ if (!LexicalDC)
+ LexicalDC = SemaDC;
DeclContext *MergedSemaDC = Reader.MergedDeclContexts.lookup(SemaDC);
// Avoid calling setLexicalDeclContext() directly because it uses
// Decl::getASTContext() internally which is unsafe during derialization.
OpenPOWER on IntegriCloud