Map from local decl IDs to global decl IDs when lazily deserializing friend decl chains.

llvm-svn: 189629
This commit is contained in:
Richard Smith 2013-08-30 00:23:29 +00:00
parent a23f4fb5c9
commit 9dd9f036c6
5 changed files with 24 additions and 3 deletions

View File

@ -1186,8 +1186,8 @@ void ASTDeclReader::ReadCXXDefinitionData(
Reader.ReadUnresolvedSet(F, Data.Conversions, Record, Idx);
Reader.ReadUnresolvedSet(F, Data.VisibleConversions, Record, Idx);
assert(Data.Definition && "Data.Definition should be already set!");
Data.FirstFriend = Record[Idx++];
Data.FirstFriend = ReadDeclID(Record, Idx);
if (Data.IsLambda) {
typedef LambdaExpr::Capture Capture;
CXXRecordDecl::LambdaDefinitionData &Lambda
@ -1339,7 +1339,7 @@ void ASTDeclReader::VisitFriendDecl(FriendDecl *D) {
D->Friend = GetTypeSourceInfo(Record, Idx);
for (unsigned i = 0; i != D->NumTPLists; ++i)
D->getTPLists()[i] = Reader.ReadTemplateParameterList(F, Record, Idx);
D->NextFriend = Record[Idx++];
D->NextFriend = ReadDeclID(Record, Idx);
D->UnsupportedFriend = (Record[Idx++] != 0);
D->FriendLoc = ReadSourceLocation(Record, Idx);
}

View File

@ -0,0 +1,5 @@
class HasFriends {
friend void friend_1(HasFriends);
friend void friend_2(HasFriends);
void private_thing();
};

View File

@ -0,0 +1,3 @@
// This module only exists to make local decl IDs and global decl IDs different.
struct Dummy {} extern *dummy1, *dummy2, *dummy3;

View File

@ -222,6 +222,10 @@ module diag_pragma {
header "diag_pragma.h"
}
module dummy {
header "dummy.h"
}
module builtin {
header "builtin.h"
explicit module sub {

View File

@ -3,6 +3,7 @@
// expected-no-diagnostics
@import dummy;
@import cxx_decls.imported;
void test_delete(int *p) {
@ -10,3 +11,11 @@ void test_delete(int *p) {
// ever been explicitly declared in an unimported submodule.
delete p;
}
void friend_1(HasFriends s) {
s.private_thing();
}
void test_friends(HasFriends s) {
friend_1(s);
friend_2(s);
}