aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/ASTImporter.cpp22
-rw-r--r--lib/AST/DeclObjC.cpp29
-rw-r--r--lib/Rewrite/RewriteObjC.cpp2
-rw-r--r--lib/Sema/SemaDeclObjC.cpp20
-rw-r--r--lib/Serialization/ASTReaderDecl.cpp16
-rw-r--r--lib/Serialization/ASTWriterDecl.cpp3
6 files changed, 49 insertions, 43 deletions
diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp
index 476e83aae6..37299d9633 100644
--- a/lib/AST/ASTImporter.cpp
+++ b/lib/AST/ASTImporter.cpp
@@ -2983,7 +2983,7 @@ Decl *ASTNodeImporter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) {
ObjCCategoryDecl *ToCategory = MergeWithCategory;
if (!ToCategory) {
ToCategory = ObjCCategoryDecl::Create(Importer.getToContext(), DC,
- Importer.Import(D->getAtLoc()),
+ Importer.Import(D->getAtStartLoc()),
Loc,
Importer.Import(D->getCategoryNameLoc()),
Name.getAsIdentifierInfo(),
@@ -3056,8 +3056,9 @@ Decl *ASTNodeImporter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
ObjCProtocolDecl *ToProto = MergeWithProtocol;
if (!ToProto || ToProto->isForwardDecl()) {
if (!ToProto) {
- ToProto = ObjCProtocolDecl::Create(Importer.getToContext(), DC, Loc,
- Name.getAsIdentifierInfo());
+ ToProto = ObjCProtocolDecl::Create(Importer.getToContext(), DC,
+ Name.getAsIdentifierInfo(), Loc,
+ Importer.Import(D->getAtStartLoc()));
ToProto->setForwardDecl(D->isForwardDecl());
ToProto->setLexicalDeclContext(LexicalDC);
LexicalDC->addDecl(ToProto);
@@ -3116,10 +3117,9 @@ Decl *ASTNodeImporter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
ObjCInterfaceDecl *ToIface = MergeWithIface;
if (!ToIface || ToIface->isForwardDecl()) {
if (!ToIface) {
- ToIface = ObjCInterfaceDecl::Create(Importer.getToContext(),
- DC, Loc,
- Name.getAsIdentifierInfo(),
- Importer.Import(D->getClassLoc()),
+ ToIface = ObjCInterfaceDecl::Create(Importer.getToContext(), DC,
+ Importer.Import(D->getAtStartLoc()),
+ Name.getAsIdentifierInfo(), Loc,
D->isForwardDecl(),
D->isImplicitInterfaceDecl());
ToIface->setForwardDecl(D->isForwardDecl());
@@ -3229,9 +3229,10 @@ Decl *ASTNodeImporter::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) {
return 0;
ToImpl = ObjCCategoryImplDecl::Create(Importer.getToContext(), DC,
- Importer.Import(D->getLocation()),
Importer.Import(D->getIdentifier()),
- Category->getClassInterface());
+ Category->getClassInterface(),
+ Importer.Import(D->getLocation()),
+ Importer.Import(D->getAtStartLoc()));
DeclContext *LexicalDC = DC;
if (D->getDeclContext() != D->getLexicalDeclContext()) {
@@ -3273,8 +3274,9 @@ Decl *ASTNodeImporter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
// now.
Impl = ObjCImplementationDecl::Create(Importer.getToContext(),
Importer.ImportContext(D->getDeclContext()),
+ Iface, Super,
Importer.Import(D->getLocation()),
- Iface, Super);
+ Importer.Import(D->getAtStartLoc()));
if (D->getDeclContext() != D->getLexicalDeclContext()) {
DeclContext *LexicalDC
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index d7775d5aad..48fbbe0c2b 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -603,11 +603,10 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,
ObjCInterfaceDecl::
ObjCInterfaceDecl(DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id,
SourceLocation CLoc, bool FD, bool isInternal)
- : ObjCContainerDecl(ObjCInterface, DC, atLoc, Id),
+ : ObjCContainerDecl(ObjCInterface, DC, Id, CLoc, atLoc),
TypeForDecl(0), SuperClass(0),
CategoryList(0), IvarList(0),
- ForwardDecl(FD), InternalInterface(isInternal), ExternallyCompleted(false),
- ClassLoc(CLoc) {
+ ForwardDecl(FD), InternalInterface(isInternal), ExternallyCompleted(false) {
}
void ObjCInterfaceDecl::LoadExternalDefinition() const {
@@ -847,9 +846,10 @@ ObjCAtDefsFieldDecl
//===----------------------------------------------------------------------===//
ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, DeclContext *DC,
- SourceLocation L,
- IdentifierInfo *Id) {
- return new (C) ObjCProtocolDecl(DC, L, Id);
+ IdentifierInfo *Id,
+ SourceLocation nameLoc,
+ SourceLocation atStartLoc) {
+ return new (C) ObjCProtocolDecl(DC, Id, nameLoc, atStartLoc);
}
ObjCProtocolDecl *ObjCProtocolDecl::lookupProtocolNamed(IdentifierInfo *Name) {
@@ -979,9 +979,12 @@ void ObjCCategoryDecl::setImplementation(ObjCCategoryImplDecl *ImplD) {
ObjCCategoryImplDecl *
ObjCCategoryImplDecl::Create(ASTContext &C, DeclContext *DC,
- SourceLocation L,IdentifierInfo *Id,
- ObjCInterfaceDecl *ClassInterface) {
- return new (C) ObjCCategoryImplDecl(DC, L, Id, ClassInterface);
+ IdentifierInfo *Id,
+ ObjCInterfaceDecl *ClassInterface,
+ SourceLocation nameLoc,
+ SourceLocation atStartLoc) {
+ return new (C) ObjCCategoryImplDecl(DC, Id, ClassInterface,
+ nameLoc, atStartLoc);
}
ObjCCategoryDecl *ObjCCategoryImplDecl::getCategoryDecl() const {
@@ -1056,10 +1059,12 @@ raw_ostream &clang::operator<<(raw_ostream &OS,
ObjCImplementationDecl *
ObjCImplementationDecl::Create(ASTContext &C, DeclContext *DC,
- SourceLocation L,
ObjCInterfaceDecl *ClassInterface,
- ObjCInterfaceDecl *SuperDecl) {
- return new (C) ObjCImplementationDecl(DC, L, ClassInterface, SuperDecl);
+ ObjCInterfaceDecl *SuperDecl,
+ SourceLocation nameLoc,
+ SourceLocation atStartLoc) {
+ return new (C) ObjCImplementationDecl(DC, ClassInterface, SuperDecl,
+ nameLoc, atStartLoc);
}
void ObjCImplementationDecl::setIvarInitializers(ASTContext &C,
diff --git a/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp
index a62f4aa622..c7a567812e 100644
--- a/lib/Rewrite/RewriteObjC.cpp
+++ b/lib/Rewrite/RewriteObjC.cpp
@@ -3359,7 +3359,7 @@ void RewriteObjC::SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl,
// This clause is segregated to avoid breaking the common case.
if (BufferContainsPPDirectives(startBuf, cursor)) {
SourceLocation L = RCDecl ? CDecl->getSuperClassLoc() :
- CDecl->getClassLoc();
+ CDecl->getAtStartLoc();
const char *endHeader = SM->getCharacterData(L);
endHeader += Lexer::MeasureTokenLength(L, *SM, LangOpts);
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index b4def893af..c1c000e030 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -376,9 +376,9 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
// FIXME: don't leak the objects passed in!
return IDecl;
} else {
- IDecl->setLocation(AtInterfaceLoc);
+ IDecl->setLocation(ClassLoc);
IDecl->setForwardDecl(false);
- IDecl->setClassLoc(ClassLoc);
+ IDecl->setAtStartLoc(AtInterfaceLoc);
// If the forward decl was in a PCH, we need to write it again in a
// dependent AST file.
IDecl->setChangedSinceDeserialization(true);
@@ -595,8 +595,8 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
// Repeat in dependent AST files.
PDecl->setChangedSinceDeserialization(true);
} else {
- PDecl = ObjCProtocolDecl::Create(Context, CurContext,
- AtProtoInterfaceLoc,ProtocolName);
+ PDecl = ObjCProtocolDecl::Create(Context, CurContext, ProtocolName,
+ ProtocolLoc, AtProtoInterfaceLoc);
PushOnScopeChains(PDecl, TUScope);
PDecl->setForwardDecl(false);
}
@@ -696,8 +696,8 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
ObjCProtocolDecl *PDecl = LookupProtocol(Ident, IdentList[i].second);
bool isNew = false;
if (PDecl == 0) { // Not already seen?
- PDecl = ObjCProtocolDecl::Create(Context, CurContext,
- IdentList[i].second, Ident);
+ PDecl = ObjCProtocolDecl::Create(Context, CurContext, Ident,
+ IdentList[i].second, AtProtocolLoc);
PushOnScopeChains(PDecl, TUScope, false);
isNew = true;
}
@@ -806,8 +806,8 @@ Decl *Sema::ActOnStartCategoryImplementation(
}
ObjCCategoryImplDecl *CDecl =
- ObjCCategoryImplDecl::Create(Context, CurContext, AtCatImplLoc, CatName,
- IDecl);
+ ObjCCategoryImplDecl::Create(Context, CurContext, CatName, IDecl,
+ ClassLoc, AtCatImplLoc);
/// Check that class of this category is already completely declared.
if (!IDecl || IDecl->isForwardDecl()) {
Diag(ClassLoc, diag::err_undef_interface) << ClassName;
@@ -925,8 +925,8 @@ Decl *Sema::ActOnStartClassImplementation(
}
ObjCImplementationDecl* IMPDecl =
- ObjCImplementationDecl::Create(Context, CurContext, AtClassImplLoc,
- IDecl, SDecl);
+ ObjCImplementationDecl::Create(Context, CurContext, IDecl, SDecl,
+ ClassLoc, AtClassImplLoc);
if (CheckObjCDeclScope(IMPDecl))
return IMPDecl;
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp
index 360fcabf51..beaf5f65a9 100644
--- a/lib/Serialization/ASTReaderDecl.cpp
+++ b/lib/Serialization/ASTReaderDecl.cpp
@@ -506,9 +506,8 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {
void ASTDeclReader::VisitObjCContainerDecl(ObjCContainerDecl *CD) {
VisitNamedDecl(CD);
- SourceLocation A = ReadSourceLocation(Record, Idx);
- SourceLocation B = ReadSourceLocation(Record, Idx);
- CD->setAtEndRange(SourceRange(A, B));
+ CD->setAtStartLoc(ReadSourceLocation(Record, Idx));
+ CD->setAtEndRange(ReadSourceRange(Record, Idx));
}
void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) {
@@ -550,7 +549,6 @@ void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) {
ID->setIvarList(0);
ID->setForwardDecl(Record[Idx++]);
ID->setImplicitInterfaceDecl(Record[Idx++]);
- ID->setClassLoc(ReadSourceLocation(Record, Idx));
ID->setSuperClassLoc(ReadSourceLocation(Record, Idx));
ID->setLocEnd(ReadSourceLocation(Record, Idx));
}
@@ -623,7 +621,6 @@ void ASTDeclReader::VisitObjCCategoryDecl(ObjCCategoryDecl *CD) {
Reader.getContext());
CD->NextClassCategory = ReadDeclAs<ObjCCategoryDecl>(Record, Idx);
CD->setHasSynthBitfield(Record[Idx++]);
- CD->setAtLoc(ReadSourceLocation(Record, Idx));
CD->setCategoryNameLoc(ReadSourceLocation(Record, Idx));
}
@@ -1632,7 +1629,8 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) {
0, QualType(), 0, ObjCIvarDecl::None);
break;
case DECL_OBJC_PROTOCOL:
- D = ObjCProtocolDecl::Create(Context, 0, SourceLocation(), 0);
+ D = ObjCProtocolDecl::Create(Context, 0, 0, SourceLocation(),
+ SourceLocation());
break;
case DECL_OBJC_AT_DEFS_FIELD:
D = ObjCAtDefsFieldDecl::Create(Context, 0, SourceLocation(),
@@ -1648,10 +1646,12 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) {
D = ObjCCategoryDecl::Create(Context, Decl::EmptyShell());
break;
case DECL_OBJC_CATEGORY_IMPL:
- D = ObjCCategoryImplDecl::Create(Context, 0, SourceLocation(), 0, 0);
+ D = ObjCCategoryImplDecl::Create(Context, 0, 0, 0, SourceLocation(),
+ SourceLocation());
break;
case DECL_OBJC_IMPLEMENTATION:
- D = ObjCImplementationDecl::Create(Context, 0, SourceLocation(), 0, 0);
+ D = ObjCImplementationDecl::Create(Context, 0, 0, 0, SourceLocation(),
+ SourceLocation());
break;
case DECL_OBJC_COMPATIBLE_ALIAS:
D = ObjCCompatibleAliasDecl::Create(Context, 0, SourceLocation(), 0, 0);
diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp
index 62459f7d3c..81394c25d0 100644
--- a/lib/Serialization/ASTWriterDecl.cpp
+++ b/lib/Serialization/ASTWriterDecl.cpp
@@ -427,6 +427,7 @@ void ASTDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) {
void ASTDeclWriter::VisitObjCContainerDecl(ObjCContainerDecl *D) {
VisitNamedDecl(D);
+ Writer.AddSourceLocation(D->getAtStartLoc(), Record);
Writer.AddSourceRange(D->getAtEndRange(), Record);
// Abstract class (no need to define a stable serialization::DECL code).
}
@@ -463,7 +464,6 @@ void ASTDeclWriter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
Writer.AddDeclRef(D->getCategoryList(), Record);
Record.push_back(D->isForwardDecl());
Record.push_back(D->isImplicitInterfaceDecl());
- Writer.AddSourceLocation(D->getClassLoc(), Record);
Writer.AddSourceLocation(D->getSuperClassLoc(), Record);
Writer.AddSourceLocation(D->getLocEnd(), Record);
Code = serialization::DECL_OBJC_INTERFACE;
@@ -542,7 +542,6 @@ void ASTDeclWriter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) {
Writer.AddSourceLocation(*PL, Record);
Writer.AddDeclRef(D->getNextClassCategory(), Record);
Record.push_back(D->hasSynthBitfield());
- Writer.AddSourceLocation(D->getAtLoc(), Record);
Writer.AddSourceLocation(D->getCategoryNameLoc(), Record);
Code = serialization::DECL_OBJC_CATEGORY;
}