aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-15 22:34:59 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-15 22:34:59 +0000
commit05c272fed899b8d3142cf080e86a235fc6168862 (patch)
tree1d822da7f91782d042b281ea72a850a7c25de6ed /lib/Sema
parentbcb3b981da3d29844fea4099c529b43e814b6d7d (diff)
Move ObjCInterfaceDecl's "EndLoc" into DefinitionData, since it only
applies to an actual definition. Plus, clarify the purpose of this field and give the accessor a different name, since getLocEnd() is supposed to be the same as getSourceRange().getEnd(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146694 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaDecl.cpp2
-rw-r--r--lib/Sema/SemaDeclObjC.cpp22
2 files changed, 14 insertions, 10 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index a42b4a54a8..5edeab416d 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -9341,7 +9341,7 @@ void Sema::ActOnFields(Scope* S,
ObjCIvarDecl **ClsFields =
reinterpret_cast<ObjCIvarDecl**>(RecFields.data());
if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(EnclosingDecl)) {
- ID->setLocEnd(RBrac);
+ ID->setEndOfDefinitionLoc(RBrac);
// Add ivar's to class's DeclContext.
for (unsigned i = 0, e = RecFields.size(); i != e; ++i) {
ClsFields[i]->setLexicalDeclContext(ID);
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 3d1f01fec3..02a83e5327 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -419,7 +419,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
if (declaresSameEntity(PrevDecl, IDecl)) {
Diag(SuperLoc, diag::err_recursive_superclass)
<< SuperName << ClassName << SourceRange(AtInterfaceLoc, ClassLoc);
- IDecl->setLocEnd(ClassLoc);
+ IDecl->setEndOfDefinitionLoc(ClassLoc);
} else {
ObjCInterfaceDecl *SuperClassDecl =
dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
@@ -466,17 +466,17 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
}
IDecl->setSuperClass(SuperClassDecl);
IDecl->setSuperClassLoc(SuperLoc);
- IDecl->setLocEnd(SuperLoc);
+ IDecl->setEndOfDefinitionLoc(SuperLoc);
}
} else { // we have a root class.
- IDecl->setLocEnd(ClassLoc);
+ IDecl->setEndOfDefinitionLoc(ClassLoc);
}
// Check then save referenced protocols.
if (NumProtoRefs) {
IDecl->setProtocolList((ObjCProtocolDecl**)ProtoRefs, NumProtoRefs,
ProtoLocs, Context);
- IDecl->setLocEnd(EndProtoLoc);
+ IDecl->setEndOfDefinitionLoc(EndProtoLoc);
}
CheckObjCDeclScope(IDecl);
@@ -930,9 +930,14 @@ Decl *Sema::ActOnStartClassImplementation(
IDecl = ObjCInterfaceDecl::Create(Context, CurContext, AtClassImplLoc,
ClassName, ClassLoc, true);
IDecl->startDefinition();
- IDecl->setSuperClass(SDecl);
- IDecl->setLocEnd(ClassLoc);
-
+ if (SDecl) {
+ IDecl->setSuperClass(SDecl);
+ IDecl->setSuperClassLoc(SuperClassLoc);
+ IDecl->setEndOfDefinitionLoc(SuperClassLoc);
+ } else {
+ IDecl->setEndOfDefinitionLoc(ClassLoc);
+ }
+
PushOnScopeChains(IDecl, TUScope);
} else {
// Mark the interface as being completed, even if it was just as
@@ -978,7 +983,7 @@ void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
/// (legacy objective-c @implementation decl without an @interface decl).
/// Add implementations's ivar to the synthesize class's ivar list.
if (IDecl->isImplicitInterfaceDecl()) {
- IDecl->setLocEnd(RBrace);
+ IDecl->setEndOfDefinitionLoc(RBrace);
// Add ivar's to class's DeclContext.
for (unsigned i = 0, e = numIvars; i != e; ++i) {
ivars[i]->setLexicalDeclContext(ImpDecl);
@@ -1773,7 +1778,6 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
= ObjCInterfaceDecl::Create(Context, CurContext, AtClassLoc,
IdentList[i], IdentLocs[i], true);
IDecl->setAtEndRange(IdentLocs[i]);
- IDecl->setLocEnd(IdentLocs[i]);
// If there was a previous declaration, link to it.
if (ObjCInterfaceDecl *PrevIDecl