forked from OSchip/llvm-project
Read/write to/from PCH DeclarationNameLocs, DeclarationNameInfos and QualifierInfos (rdar://8513756).
llvm-svn: 116598
This commit is contained in:
parent
c46e8cb258
commit
434383d703
|
@ -471,6 +471,9 @@ public:
|
|||
static bool classofKind(Kind K) {
|
||||
return K >= firstDeclarator && K <= lastDeclarator;
|
||||
}
|
||||
|
||||
friend class ASTDeclReader;
|
||||
friend class ASTDeclWriter;
|
||||
};
|
||||
|
||||
/// \brief Structure used to store a statement, the constant value to
|
||||
|
|
|
@ -2095,6 +2095,9 @@ public:
|
|||
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
|
||||
static bool classof(const UnresolvedUsingValueDecl *D) { return true; }
|
||||
static bool classofKind(Kind K) { return K == UnresolvedUsingValue; }
|
||||
|
||||
friend class ASTDeclReader;
|
||||
friend class ASTDeclWriter;
|
||||
};
|
||||
|
||||
/// UnresolvedUsingTypenameDecl - Represents a dependent using
|
||||
|
|
|
@ -1897,6 +1897,9 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
friend class ASTReader;
|
||||
friend class ASTStmtWriter;
|
||||
};
|
||||
|
||||
/// CompoundLiteralExpr - [C99 6.5.2.5]
|
||||
|
|
|
@ -1553,6 +1553,9 @@ public:
|
|||
T->getStmtClass() == UnresolvedMemberExprClass;
|
||||
}
|
||||
static bool classof(const OverloadExpr *) { return true; }
|
||||
|
||||
friend class ASTStmtReader;
|
||||
friend class ASTStmtWriter;
|
||||
};
|
||||
|
||||
/// \brief A reference to a name which we were able to look up during
|
||||
|
@ -1838,6 +1841,9 @@ public:
|
|||
|
||||
virtual StmtIterator child_begin();
|
||||
virtual StmtIterator child_end();
|
||||
|
||||
friend class ASTStmtReader;
|
||||
friend class ASTStmtWriter;
|
||||
};
|
||||
|
||||
class CXXExprWithTemporaries : public Expr {
|
||||
|
@ -2250,6 +2256,9 @@ public:
|
|||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
|
||||
friend class ASTStmtReader;
|
||||
friend class ASTStmtWriter;
|
||||
};
|
||||
|
||||
/// \brief Represents a C++ member access expression for which lookup
|
||||
|
|
|
@ -1021,6 +1021,14 @@ public:
|
|||
|
||||
/// \brief Read a declaration name.
|
||||
DeclarationName ReadDeclarationName(const RecordData &Record, unsigned &Idx);
|
||||
void ReadDeclarationNameLoc(PerFileData &F,
|
||||
DeclarationNameLoc &DNLoc, DeclarationName Name,
|
||||
const RecordData &Record, unsigned &Idx);
|
||||
void ReadDeclarationNameInfo(PerFileData &F, DeclarationNameInfo &NameInfo,
|
||||
const RecordData &Record, unsigned &Idx);
|
||||
|
||||
void ReadQualifierInfo(PerFileData &F, QualifierInfo &Info,
|
||||
const RecordData &Record, unsigned &Idx);
|
||||
|
||||
NestedNameSpecifier *ReadNestedNameSpecifier(const RecordData &Record,
|
||||
unsigned &Idx);
|
||||
|
|
|
@ -400,6 +400,12 @@ public:
|
|||
|
||||
/// \brief Emit a declaration name.
|
||||
void AddDeclarationName(DeclarationName Name, RecordData &Record);
|
||||
void AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc,
|
||||
DeclarationName Name, RecordData &Record);
|
||||
void AddDeclarationNameInfo(const DeclarationNameInfo &NameInfo,
|
||||
RecordData &Record);
|
||||
|
||||
void AddQualifierInfo(const QualifierInfo &Info, RecordData &Record);
|
||||
|
||||
/// \brief Emit a nested name specifier.
|
||||
void AddNestedNameSpecifier(NestedNameSpecifier *NNS, RecordData &Record);
|
||||
|
|
|
@ -3845,6 +3845,61 @@ ASTReader::ReadDeclarationName(const RecordData &Record, unsigned &Idx) {
|
|||
return DeclarationName();
|
||||
}
|
||||
|
||||
void ASTReader::ReadDeclarationNameLoc(PerFileData &F,
|
||||
DeclarationNameLoc &DNLoc,
|
||||
DeclarationName Name,
|
||||
const RecordData &Record, unsigned &Idx) {
|
||||
switch (Name.getNameKind()) {
|
||||
case DeclarationName::CXXConstructorName:
|
||||
case DeclarationName::CXXDestructorName:
|
||||
case DeclarationName::CXXConversionFunctionName:
|
||||
DNLoc.NamedType.TInfo = GetTypeSourceInfo(F, Record, Idx);
|
||||
break;
|
||||
|
||||
case DeclarationName::CXXOperatorName:
|
||||
DNLoc.CXXOperatorName.BeginOpNameLoc
|
||||
= ReadSourceLocation(F, Record, Idx).getRawEncoding();
|
||||
DNLoc.CXXOperatorName.EndOpNameLoc
|
||||
= ReadSourceLocation(F, Record, Idx).getRawEncoding();
|
||||
break;
|
||||
|
||||
case DeclarationName::CXXLiteralOperatorName:
|
||||
DNLoc.CXXLiteralOperatorName.OpNameLoc
|
||||
= ReadSourceLocation(F, Record, Idx).getRawEncoding();
|
||||
break;
|
||||
|
||||
case DeclarationName::Identifier:
|
||||
case DeclarationName::ObjCZeroArgSelector:
|
||||
case DeclarationName::ObjCOneArgSelector:
|
||||
case DeclarationName::ObjCMultiArgSelector:
|
||||
case DeclarationName::CXXUsingDirective:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ASTReader::ReadDeclarationNameInfo(PerFileData &F,
|
||||
DeclarationNameInfo &NameInfo,
|
||||
const RecordData &Record, unsigned &Idx) {
|
||||
NameInfo.setName(ReadDeclarationName(Record, Idx));
|
||||
NameInfo.setLoc(ReadSourceLocation(F, Record, Idx));
|
||||
DeclarationNameLoc DNLoc;
|
||||
ReadDeclarationNameLoc(F, DNLoc, NameInfo.getName(), Record, Idx);
|
||||
NameInfo.setInfo(DNLoc);
|
||||
}
|
||||
|
||||
void ASTReader::ReadQualifierInfo(PerFileData &F, QualifierInfo &Info,
|
||||
const RecordData &Record, unsigned &Idx) {
|
||||
Info.NNS = ReadNestedNameSpecifier(Record, Idx);
|
||||
Info.NNSRange = ReadSourceRange(F, Record, Idx);
|
||||
unsigned NumTPLists = Record[Idx++];
|
||||
Info.NumTemplParamLists = NumTPLists;
|
||||
if (NumTPLists) {
|
||||
Info.TemplParamLists = new (*Context) TemplateParameterList*[NumTPLists];
|
||||
for (unsigned i=0; i != NumTPLists; ++i)
|
||||
Info.TemplParamLists[i] = ReadTemplateParameterList(F, Record, Idx);
|
||||
}
|
||||
}
|
||||
|
||||
TemplateName
|
||||
ASTReader::ReadTemplateName(const RecordData &Record, unsigned &Idx) {
|
||||
TemplateName::NameKind Kind = (TemplateName::NameKind)Record[Idx++];
|
||||
|
|
|
@ -49,6 +49,18 @@ namespace clang {
|
|||
unsigned &I) {
|
||||
return Reader.GetTypeSourceInfo(F, R, I);
|
||||
}
|
||||
void ReadQualifierInfo(QualifierInfo &Info,
|
||||
const ASTReader::RecordData &R, unsigned &I) {
|
||||
Reader.ReadQualifierInfo(F, Info, R, I);
|
||||
}
|
||||
void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc, DeclarationName Name,
|
||||
const ASTReader::RecordData &R, unsigned &I) {
|
||||
Reader.ReadDeclarationNameLoc(F, DNLoc, Name, R, I);
|
||||
}
|
||||
void ReadDeclarationNameInfo(DeclarationNameInfo &NameInfo,
|
||||
const ASTReader::RecordData &R, unsigned &I) {
|
||||
Reader.ReadDeclarationNameInfo(F, NameInfo, R, I);
|
||||
}
|
||||
|
||||
public:
|
||||
ASTDeclReader(ASTReader &Reader, ASTReader::PerFileData &F,
|
||||
|
@ -202,9 +214,13 @@ void ASTDeclReader::VisitTagDecl(TagDecl *TD) {
|
|||
TD->setEmbeddedInDeclarator(Record[Idx++]);
|
||||
TD->setRBraceLoc(ReadSourceLocation(Record, Idx));
|
||||
TD->setTagKeywordLoc(ReadSourceLocation(Record, Idx));
|
||||
// FIXME: maybe read optional qualifier and its range.
|
||||
TD->setTypedefForAnonDecl(
|
||||
cast_or_null<TypedefDecl>(Reader.GetDecl(Record[Idx++])));
|
||||
if (Record[Idx++]) { // hasExtInfo
|
||||
TagDecl::ExtInfo *Info = new (*Reader.getContext()) TagDecl::ExtInfo();
|
||||
ReadQualifierInfo(*Info, Record, Idx);
|
||||
TD->TypedefDeclOrQualifier = Info;
|
||||
} else
|
||||
TD->setTypedefForAnonDecl(
|
||||
cast_or_null<TypedefDecl>(Reader.GetDecl(Record[Idx++])));
|
||||
}
|
||||
|
||||
void ASTDeclReader::VisitEnumDecl(EnumDecl *ED) {
|
||||
|
@ -243,17 +259,21 @@ void ASTDeclReader::VisitEnumConstantDecl(EnumConstantDecl *ECD) {
|
|||
|
||||
void ASTDeclReader::VisitDeclaratorDecl(DeclaratorDecl *DD) {
|
||||
VisitValueDecl(DD);
|
||||
TypeSourceInfo *TInfo = GetTypeSourceInfo(Record, Idx);
|
||||
if (TInfo)
|
||||
DD->setTypeSourceInfo(TInfo);
|
||||
// FIXME: read optional qualifier and its range.
|
||||
if (Record[Idx++]) { // hasExtInfo
|
||||
DeclaratorDecl::ExtInfo *Info
|
||||
= new (*Reader.getContext()) DeclaratorDecl::ExtInfo();
|
||||
ReadQualifierInfo(*Info, Record, Idx);
|
||||
Info->TInfo = GetTypeSourceInfo(Record, Idx);
|
||||
DD->DeclInfo = Info;
|
||||
} else
|
||||
DD->DeclInfo = GetTypeSourceInfo(Record, Idx);
|
||||
}
|
||||
|
||||
void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
|
||||
VisitDeclaratorDecl(FD);
|
||||
VisitRedeclarable(FD);
|
||||
// FIXME: read DeclarationNameLoc.
|
||||
|
||||
ReadDeclarationNameLoc(FD->DNLoc, FD->getDeclName(), Record, Idx);
|
||||
FD->IdentifierNamespace = Record[Idx++];
|
||||
switch ((FunctionDecl::TemplatedKind)Record[Idx++]) {
|
||||
default: assert(false && "Unhandled TemplatedKind!");
|
||||
|
@ -689,7 +709,7 @@ void ASTDeclReader::VisitUsingDecl(UsingDecl *D) {
|
|||
D->setUsingLocation(ReadSourceLocation(Record, Idx));
|
||||
D->setNestedNameRange(ReadSourceRange(Record, Idx));
|
||||
D->setTargetNestedNameDecl(Reader.ReadNestedNameSpecifier(Record, Idx));
|
||||
// FIXME: read the DNLoc component.
|
||||
ReadDeclarationNameLoc(D->DNLoc, D->getDeclName(), Record, Idx);
|
||||
|
||||
// FIXME: It would probably be more efficient to read these into a vector
|
||||
// and then re-cosntruct the shadow decl set over that vector since it
|
||||
|
@ -731,7 +751,7 @@ void ASTDeclReader::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
|
|||
D->setTargetNestedNameRange(ReadSourceRange(Record, Idx));
|
||||
D->setUsingLoc(ReadSourceLocation(Record, Idx));
|
||||
D->setTargetNestedNameSpecifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
||||
// FIXME: read the DNLoc component.
|
||||
ReadDeclarationNameLoc(D->DNLoc, D->getDeclName(), Record, Idx);
|
||||
}
|
||||
|
||||
void ASTDeclReader::VisitUnresolvedUsingTypenameDecl(
|
||||
|
|
|
@ -38,6 +38,14 @@ namespace clang {
|
|||
unsigned &I) {
|
||||
return Reader.GetTypeSourceInfo(F, R, I);
|
||||
}
|
||||
void ReadDeclarationNameLoc(DeclarationNameLoc &DNLoc, DeclarationName Name,
|
||||
const ASTReader::RecordData &R, unsigned &I) {
|
||||
Reader.ReadDeclarationNameLoc(F, DNLoc, Name, R, I);
|
||||
}
|
||||
void ReadDeclarationNameInfo(DeclarationNameInfo &NameInfo,
|
||||
const ASTReader::RecordData &R, unsigned &I) {
|
||||
Reader.ReadDeclarationNameInfo(F, NameInfo, R, I);
|
||||
}
|
||||
|
||||
public:
|
||||
ASTStmtReader(ASTReader &Reader, ASTReader::PerFileData &F,
|
||||
|
@ -421,8 +429,8 @@ void ASTStmtReader::VisitDeclRefExpr(DeclRefExpr *E) {
|
|||
NumTemplateArgs);
|
||||
|
||||
E->setDecl(cast<ValueDecl>(Reader.GetDecl(Record[Idx++])));
|
||||
// FIXME: read DeclarationNameLoc.
|
||||
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||
ReadDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName(), Record, Idx);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitIntegerLiteral(IntegerLiteral *E) {
|
||||
|
@ -1186,9 +1194,7 @@ ASTStmtReader::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
|
|||
E->setQualifierRange(ReadSourceRange(Record, Idx));
|
||||
E->setFirstQualifierFoundInScope(
|
||||
cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++])));
|
||||
// FIXME: read whole DeclarationNameInfo.
|
||||
E->setMember(Reader.ReadDeclarationName(Record, Idx));
|
||||
E->setMemberLoc(ReadSourceLocation(Record, Idx));
|
||||
ReadDeclarationNameInfo(E->MemberNameInfo, Record, Idx);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1202,9 +1208,7 @@ ASTStmtReader::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
|
|||
ReadExplicitTemplateArgumentList(E->getExplicitTemplateArgs(),
|
||||
NumTemplateArgs);
|
||||
|
||||
// FIXME: read whole DeclarationNameInfo.
|
||||
E->setDeclName(Reader.ReadDeclarationName(Record, Idx));
|
||||
E->setLocation(ReadSourceLocation(Record, Idx));
|
||||
ReadDeclarationNameInfo(E->NameInfo, Record, Idx);
|
||||
E->setQualifierRange(ReadSourceRange(Record, Idx));
|
||||
E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
||||
}
|
||||
|
@ -1240,11 +1244,9 @@ void ASTStmtReader::VisitOverloadExpr(OverloadExpr *E) {
|
|||
}
|
||||
E->initializeResults(*Reader.getContext(), Decls.begin(), Decls.end());
|
||||
|
||||
// FIXME: read whole DeclarationNameInfo.
|
||||
E->setName(Reader.ReadDeclarationName(Record, Idx));
|
||||
ReadDeclarationNameInfo(E->NameInfo, Record, Idx);
|
||||
E->setQualifier(Reader.ReadNestedNameSpecifier(Record, Idx));
|
||||
E->setQualifierRange(ReadSourceRange(Record, Idx));
|
||||
E->setNameLoc(ReadSourceLocation(Record, Idx));
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
|
||||
|
@ -1518,7 +1520,6 @@ Stmt *ASTReader::ReadStmtFromStream(PerFileData &F) {
|
|||
QualType T = GetType(Record[Idx++]);
|
||||
Expr *Base = ReadSubExpr();
|
||||
ValueDecl *MemberD = cast<ValueDecl>(GetDecl(Record[Idx++]));
|
||||
// FIXME: read DeclarationNameLoc.
|
||||
SourceLocation MemberLoc = ReadSourceLocation(F, Record, Idx);
|
||||
DeclarationNameInfo MemberNameInfo(MemberD->getDeclName(), MemberLoc);
|
||||
bool IsArrow = Record[Idx++];
|
||||
|
@ -1526,6 +1527,8 @@ Stmt *ASTReader::ReadStmtFromStream(PerFileData &F) {
|
|||
S = MemberExpr::Create(*Context, Base, IsArrow, NNS, QualifierRange,
|
||||
MemberD, FoundDecl, MemberNameInfo,
|
||||
NumTemplateArgs ? &ArgInfo : 0, T);
|
||||
ReadDeclarationNameLoc(F, cast<MemberExpr>(S)->MemberDNLoc,
|
||||
MemberD->getDeclName(), Record, Idx);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -2929,6 +2929,55 @@ void ASTWriter::AddDeclarationName(DeclarationName Name, RecordData &Record) {
|
|||
}
|
||||
}
|
||||
|
||||
void ASTWriter::AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc,
|
||||
DeclarationName Name, RecordData &Record) {
|
||||
switch (Name.getNameKind()) {
|
||||
case DeclarationName::CXXConstructorName:
|
||||
case DeclarationName::CXXDestructorName:
|
||||
case DeclarationName::CXXConversionFunctionName:
|
||||
AddTypeSourceInfo(DNLoc.NamedType.TInfo, Record);
|
||||
break;
|
||||
|
||||
case DeclarationName::CXXOperatorName:
|
||||
AddSourceLocation(
|
||||
SourceLocation::getFromRawEncoding(DNLoc.CXXOperatorName.BeginOpNameLoc),
|
||||
Record);
|
||||
AddSourceLocation(
|
||||
SourceLocation::getFromRawEncoding(DNLoc.CXXOperatorName.EndOpNameLoc),
|
||||
Record);
|
||||
break;
|
||||
|
||||
case DeclarationName::CXXLiteralOperatorName:
|
||||
AddSourceLocation(
|
||||
SourceLocation::getFromRawEncoding(DNLoc.CXXLiteralOperatorName.OpNameLoc),
|
||||
Record);
|
||||
break;
|
||||
|
||||
case DeclarationName::Identifier:
|
||||
case DeclarationName::ObjCZeroArgSelector:
|
||||
case DeclarationName::ObjCOneArgSelector:
|
||||
case DeclarationName::ObjCMultiArgSelector:
|
||||
case DeclarationName::CXXUsingDirective:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ASTWriter::AddDeclarationNameInfo(const DeclarationNameInfo &NameInfo,
|
||||
RecordData &Record) {
|
||||
AddDeclarationName(NameInfo.getName(), Record);
|
||||
AddSourceLocation(NameInfo.getLoc(), Record);
|
||||
AddDeclarationNameLoc(NameInfo.getInfo(), NameInfo.getName(), Record);
|
||||
}
|
||||
|
||||
void ASTWriter::AddQualifierInfo(const QualifierInfo &Info,
|
||||
RecordData &Record) {
|
||||
AddNestedNameSpecifier(Info.NNS, Record);
|
||||
AddSourceRange(Info.NNSRange, Record);
|
||||
Record.push_back(Info.NumTemplParamLists);
|
||||
for (unsigned i=0, e=Info.NumTemplParamLists; i != e; ++i)
|
||||
AddTemplateParameterList(Info.TemplParamLists[i], Record);
|
||||
}
|
||||
|
||||
void ASTWriter::AddNestedNameSpecifier(NestedNameSpecifier *NNS,
|
||||
RecordData &Record) {
|
||||
// Nested name specifiers usually aren't too long. I think that 8 would
|
||||
|
|
|
@ -170,8 +170,11 @@ void ASTDeclWriter::VisitTagDecl(TagDecl *D) {
|
|||
Record.push_back(D->isEmbeddedInDeclarator());
|
||||
Writer.AddSourceLocation(D->getRBraceLoc(), Record);
|
||||
Writer.AddSourceLocation(D->getTagKeywordLoc(), Record);
|
||||
// FIXME: maybe write optional qualifier and its range.
|
||||
Writer.AddDeclRef(D->getTypedefForAnonDecl(), Record);
|
||||
Record.push_back(D->hasExtInfo());
|
||||
if (D->hasExtInfo())
|
||||
Writer.AddQualifierInfo(*D->getExtInfo(), Record);
|
||||
else
|
||||
Writer.AddDeclRef(D->getTypedefForAnonDecl(), Record);
|
||||
}
|
||||
|
||||
void ASTDeclWriter::VisitEnumDecl(EnumDecl *D) {
|
||||
|
@ -212,15 +215,17 @@ void ASTDeclWriter::VisitEnumConstantDecl(EnumConstantDecl *D) {
|
|||
|
||||
void ASTDeclWriter::VisitDeclaratorDecl(DeclaratorDecl *D) {
|
||||
VisitValueDecl(D);
|
||||
Record.push_back(D->hasExtInfo());
|
||||
if (D->hasExtInfo())
|
||||
Writer.AddQualifierInfo(*D->getExtInfo(), Record);
|
||||
Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record);
|
||||
// FIXME: write optional qualifier and its range.
|
||||
}
|
||||
|
||||
void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
|
||||
VisitDeclaratorDecl(D);
|
||||
VisitRedeclarable(D);
|
||||
// FIXME: write DeclarationNameLoc.
|
||||
|
||||
Writer.AddDeclarationNameLoc(D->DNLoc, D->getDeclName(), Record);
|
||||
Record.push_back(D->getIdentifierNamespace());
|
||||
Record.push_back(D->getTemplatedKind());
|
||||
switch (D->getTemplatedKind()) {
|
||||
|
@ -648,6 +653,7 @@ void ASTDeclWriter::VisitUsingDecl(UsingDecl *D) {
|
|||
Writer.AddSourceRange(D->getNestedNameRange(), Record);
|
||||
Writer.AddSourceLocation(D->getUsingLocation(), Record);
|
||||
Writer.AddNestedNameSpecifier(D->getTargetNestedNameDecl(), Record);
|
||||
Writer.AddDeclarationNameLoc(D->DNLoc, D->getDeclName(), Record);
|
||||
Record.push_back(D->getNumShadowDecls());
|
||||
for (UsingDecl::shadow_iterator P = D->shadow_begin(),
|
||||
PEnd = D->shadow_end(); P != PEnd; ++P)
|
||||
|
@ -681,6 +687,7 @@ void ASTDeclWriter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
|
|||
Writer.AddSourceRange(D->getTargetNestedNameRange(), Record);
|
||||
Writer.AddSourceLocation(D->getUsingLoc(), Record);
|
||||
Writer.AddNestedNameSpecifier(D->getTargetNestedNameSpecifier(), Record);
|
||||
Writer.AddDeclarationNameLoc(D->DNLoc, D->getDeclName(), Record);
|
||||
Code = serialization::DECL_UNRESOLVED_USING_VALUE;
|
||||
}
|
||||
|
||||
|
@ -1103,6 +1110,7 @@ void ASTWriter::WriteDeclsBlockAbbrevs() {
|
|||
// ValueDecl
|
||||
Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
|
||||
// DeclaratorDecl
|
||||
Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
|
||||
Abv->Add(BitCodeAbbrevOp(serialization::PREDEF_TYPE_NULL_ID)); // InfoType
|
||||
// VarDecl
|
||||
Abv->Add(BitCodeAbbrevOp(0)); // StorageClass
|
||||
|
|
|
@ -385,8 +385,8 @@ void ASTStmtWriter::VisitDeclRefExpr(DeclRefExpr *E) {
|
|||
AddExplicitTemplateArgumentList(E->getExplicitTemplateArgs());
|
||||
|
||||
Writer.AddDeclRef(E->getDecl(), Record);
|
||||
// FIXME: write DeclarationNameLoc.
|
||||
Writer.AddSourceLocation(E->getLocation(), Record);
|
||||
Writer.AddDeclarationNameLoc(E->DNLoc, E->getDecl()->getDeclName(), Record);
|
||||
Code = serialization::EXPR_DECL_REF;
|
||||
}
|
||||
|
||||
|
@ -555,9 +555,10 @@ void ASTStmtWriter::VisitMemberExpr(MemberExpr *E) {
|
|||
Writer.AddTypeRef(E->getType(), Record);
|
||||
Writer.AddStmt(E->getBase());
|
||||
Writer.AddDeclRef(E->getMemberDecl(), Record);
|
||||
// FIXME: write DeclarationNameLoc.
|
||||
Writer.AddSourceLocation(E->getMemberLoc(), Record);
|
||||
Record.push_back(E->isArrow());
|
||||
Writer.AddDeclarationNameLoc(E->MemberDNLoc,
|
||||
E->getMemberDecl()->getDeclName(), Record);
|
||||
Code = serialization::EXPR_MEMBER;
|
||||
}
|
||||
|
||||
|
@ -1190,9 +1191,7 @@ ASTStmtWriter::VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E){
|
|||
Writer.AddNestedNameSpecifier(E->getQualifier(), Record);
|
||||
Writer.AddSourceRange(E->getQualifierRange(), Record);
|
||||
Writer.AddDeclRef(E->getFirstQualifierFoundInScope(), Record);
|
||||
// FIXME: write whole DeclarationNameInfo.
|
||||
Writer.AddDeclarationName(E->getMember(), Record);
|
||||
Writer.AddSourceLocation(E->getMemberLoc(), Record);
|
||||
Writer.AddDeclarationNameInfo(E->MemberNameInfo, Record);
|
||||
Code = serialization::EXPR_CXX_DEPENDENT_SCOPE_MEMBER;
|
||||
}
|
||||
|
||||
|
@ -1212,9 +1211,7 @@ ASTStmtWriter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
|
|||
Record.push_back(0);
|
||||
}
|
||||
|
||||
// FIXME: write whole DeclarationNameInfo.
|
||||
Writer.AddDeclarationName(E->getDeclName(), Record);
|
||||
Writer.AddSourceLocation(E->getLocation(), Record);
|
||||
Writer.AddDeclarationNameInfo(E->NameInfo, Record);
|
||||
Writer.AddSourceRange(E->getQualifierRange(), Record);
|
||||
Writer.AddNestedNameSpecifier(E->getQualifier(), Record);
|
||||
Code = serialization::EXPR_CXX_DEPENDENT_SCOPE_DECL_REF;
|
||||
|
@ -1255,11 +1252,9 @@ void ASTStmtWriter::VisitOverloadExpr(OverloadExpr *E) {
|
|||
Record.push_back(OvI.getAccess());
|
||||
}
|
||||
|
||||
// FIXME: write whole DeclarationNameInfo.
|
||||
Writer.AddDeclarationName(E->getName(), Record);
|
||||
Writer.AddDeclarationNameInfo(E->NameInfo, Record);
|
||||
Writer.AddNestedNameSpecifier(E->getQualifier(), Record);
|
||||
Writer.AddSourceRange(E->getQualifierRange(), Record);
|
||||
Writer.AddSourceLocation(E->getNameLoc(), Record);
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/class1.cpp
|
||||
// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/class2.cpp
|
||||
// RUN: %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s
|
||||
// RUN: false
|
||||
// XFAIL: *
|
||||
|
||||
// CHECK: class1.cpp:5:8: warning: type 'B' has incompatible definitions in different translation units
|
||||
// CHECK: class1.cpp:6:9: note: field 'y' has type 'float' here
|
||||
|
|
Loading…
Reference in New Issue