[cfe-commits] r49553 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/AST/DeclObjC.cpp lib/Sema/Sema.cpp lib/Sema/SemaDeclObjC.cpp
Steve Naroff
snaroff at apple.com
Fri Apr 11 12:35:35 PDT 2008
Author: snaroff
Date: Fri Apr 11 14:35:35 2008
New Revision: 49553
URL: http://llvm.org/viewvc/llvm-project?rev=49553&view=rev
Log:
Add class and super class location info to ObjCInterfaceDecl...
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/AST/DeclObjC.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=49553&r1=49552&r2=49553&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Fri Apr 11 14:35:35 2008
@@ -235,12 +235,15 @@
bool ForwardDecl:1; // declared with @class.
bool InternalInterface:1; // true - no @interface for @implementation
+ SourceLocation ClassLoc; // location of the class identifier.
+ SourceLocation SuperClassLoc; // location of the super class identifier.
SourceLocation EndLoc; // marks the '>', '}', or identifier.
SourceLocation AtEndLoc; // marks the end of the entire interface.
ObjCInterfaceDecl(SourceLocation atLoc,
unsigned numRefProtos,
- IdentifierInfo *Id, bool FD, bool isInternal)
+ IdentifierInfo *Id, SourceLocation CLoc,
+ bool FD, bool isInternal)
: NamedDecl(ObjCInterface, atLoc, Id), DeclContext(ObjCInterface),
TypeForDecl(0), SuperClass(0),
ReferencedProtocols(0), NumReferencedProtocols(0), Ivars(0),
@@ -248,14 +251,17 @@
InstanceMethods(0), NumInstanceMethods(0),
ClassMethods(0), NumClassMethods(0),
CategoryList(0), PropertyDecl(0), NumPropertyDecl(0),
- ForwardDecl(FD), InternalInterface(isInternal) {
+ ForwardDecl(FD), InternalInterface(isInternal),
+ ClassLoc(CLoc) {
AllocIntfRefProtocols(numRefProtos);
}
public:
static ObjCInterfaceDecl *Create(ASTContext &C,
SourceLocation atLoc,
- unsigned numRefProtos, IdentifierInfo *Id,
+ unsigned numRefProtos,
+ IdentifierInfo *Id,
+ SourceLocation ClassLoc = SourceLocation(),
bool ForwardDecl = false,
bool isInternal = false);
@@ -363,6 +369,10 @@
SourceLocation getLocEnd() const { return EndLoc; }
void setLocEnd(SourceLocation LE) { EndLoc = LE; };
+ SourceLocation getClassLoc() const { return ClassLoc; }
+ void setSuperClassLoc(SourceLocation Loc) { SuperClassLoc = Loc; }
+ SourceLocation getSuperClassLoc() const { return SuperClassLoc; }
+
// We also need to record the @end location.
SourceLocation getAtEndLoc() const { return AtEndLoc; }
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=49553&r1=49552&r2=49553&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Fri Apr 11 14:35:35 2008
@@ -37,11 +37,12 @@
ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,
SourceLocation atLoc,
unsigned numRefProtos,
- IdentifierInfo *Id,
+ IdentifierInfo *Id,
+ SourceLocation ClassLoc,
bool ForwardDecl, bool isInternal){
void *Mem = C.getAllocator().Allocate<ObjCInterfaceDecl>();
return new (Mem) ObjCInterfaceDecl(atLoc, numRefProtos,
- Id, ForwardDecl,
+ Id, ClassLoc, ForwardDecl,
isInternal);
}
Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=49553&r1=49552&r2=49553&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Fri Apr 11 14:35:35 2008
@@ -112,7 +112,8 @@
// Synthesize "@class Protocol;
ObjCInterfaceDecl *ProtocolDecl =
ObjCInterfaceDecl::Create(Context, SourceLocation(), 0,
- &Context.Idents.get("Protocol"), true);
+ &Context.Idents.get("Protocol"),
+ SourceLocation(), true);
Context.setObjCProtoType(Context.getObjCInterfaceType(ProtocolDecl));
// Synthesize "typedef struct objc_object { Class isa; } *id;"
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=49553&r1=49552&r2=49553&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Apr 11 14:35:35 2008
@@ -98,7 +98,7 @@
}
else {
IDecl = ObjCInterfaceDecl::Create(Context, AtInterfaceLoc, NumProtocols,
- ClassName);
+ ClassName, ClassLoc);
ObjCInterfaceDecls[ClassName] = IDecl;
// Remember that this needs to be removed when the scope is popped.
@@ -126,6 +126,7 @@
}
}
IDecl->setSuperClass(SuperClassEntry);
+ IDecl->setSuperClassLoc(SuperLoc);
IDecl->setLocEnd(SuperLoc);
} else { // we have a root class.
IDecl->setLocEnd(ClassLoc);
@@ -383,7 +384,7 @@
// Legacy case of @implementation with no corresponding @interface.
// Build, chain & install the interface decl into the identifier.
IDecl = ObjCInterfaceDecl::Create(Context, AtClassImplLoc, 0, ClassName,
- false, true);
+ ClassLoc, false, true);
ObjCInterfaceDecls[ClassName] = IDecl;
IDecl->setSuperClass(SDecl);
IDecl->setLocEnd(ClassLoc);
@@ -591,7 +592,7 @@
ObjCInterfaceDecl *IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
if (!IDecl) { // Not already seen? Make a forward decl.
IDecl = ObjCInterfaceDecl::Create(Context, AtClassLoc, 0, IdentList[i],
- true);
+ SourceLocation(), true);
ObjCInterfaceDecls[IdentList[i]] = IDecl;
// Remember that this needs to be removed when the scope is popped.
More information about the cfe-commits
mailing list