summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReaderDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-01-26 22:39:55 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-01-26 22:39:55 +0000
commitc0ca4c2c956703eb414b506f5bef9a2e33b59db1 (patch)
tree8f6299f82de50ecece018c58261a014ba4f9410e /clang/lib/Serialization/ASTReaderDecl.cpp
parentabb5b7965aca25c056196dc50819513763906c19 (diff)
downloadbcm5719-llvm-c0ca4c2c956703eb414b506f5bef9a2e33b59db1.tar.gz
bcm5719-llvm-c0ca4c2c956703eb414b506f5bef9a2e33b59db1.zip
[modules] When reading / writing a typedef that is a name for linkage for
another declaration, ensure we actually serialize / deserialize that declaration. Before this patch, if another copy of the typedef were merged with the parsed version, we would emit type information referring to the merged version and consequently emit nothing about the parsed anonymous struct. This resulted in us losing information, particularly the visible merged module set for the parsed definition. Force that information to be emitted and to be loaded when the typedef is used. llvm-svn: 293219
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r--clang/lib/Serialization/ASTReaderDecl.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index 4a7e24c007a..afda1a83c2a 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -592,6 +592,11 @@ ASTDeclReader::VisitTypedefNameDecl(TypedefNameDecl *TD) {
TD->setModedTypeSourceInfo(TInfo, modedT);
} else
TD->setTypeSourceInfo(TInfo);
+ // Read and discard the declaration for which this is a typedef name for
+ // linkage, if it exists. We cannot rely on our type to pull in this decl,
+ // because it might have been merged with a type from another module and
+ // thus might not refer to our version of the declaration.
+ ReadDecl();
return Redecl;
}
OpenPOWER on IntegriCloud