[cfe-commits] r48410 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/AST/DeclObjC.cpp lib/Sema/SemaDeclObjC.cpp
Chris Lattner
sabre at nondot.org
Sat Mar 15 18:23:04 PDT 2008
Author: lattner
Date: Sat Mar 15 20:23:04 2008
New Revision: 48410
URL: http://llvm.org/viewvc/llvm-project?rev=48410&view=rev
Log:
Give ObjCProtocolDecl a Create method.
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/AST/DeclObjC.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=48410&r1=48409&r2=48410&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Sat Mar 15 20:23:04 2008
@@ -226,8 +226,7 @@
SourceLocation AtEndLoc; // marks the end of the entire interface.
ObjCInterfaceDecl(SourceLocation atLoc, unsigned numRefProtos,
- IdentifierInfo *Id, bool FD = false,
- bool isInternal = false)
+ IdentifierInfo *Id, bool FD, bool isInternal)
: TypeDecl(ObjCInterface, atLoc, Id, 0), SuperClass(0),
ReferencedProtocols(0), NumReferencedProtocols(0), Ivars(0),
NumIvars(-1),
@@ -429,16 +428,21 @@
SourceLocation EndLoc; // marks the '>' or identifier.
SourceLocation AtEndLoc; // marks the end of the entire interface.
-public:
+
ObjCProtocolDecl(SourceLocation L, unsigned numRefProtos,
- IdentifierInfo *Id, bool FD = false)
+ IdentifierInfo *Id, bool FD)
: NamedDecl(ObjCProtocol, L, Id),
ReferencedProtocols(0), NumReferencedProtocols(0),
InstanceMethods(0), NumInstanceMethods(-1),
ClassMethods(0), NumClassMethods(-1),
isForwardProtoDecl(FD) {
- AllocReferencedProtocols(numRefProtos);
- }
+ AllocReferencedProtocols(numRefProtos);
+ }
+public:
+ static ObjCProtocolDecl *Create(ASTContext &C, SourceLocation L,
+ unsigned numRefProtos, IdentifierInfo *Id,
+ bool ForwardDecl = false);
+
void AllocReferencedProtocols(unsigned numRefProtos) {
if (numRefProtos) {
ReferencedProtocols = new ObjCProtocolDecl*[numRefProtos];
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=48410&r1=48409&r2=48410&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Sat Mar 15 20:23:04 2008
@@ -47,6 +47,14 @@
return new (Mem) ObjCIvarDecl(L, Id, T);
}
+ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, SourceLocation L,
+ unsigned numRefProtos,
+ IdentifierInfo *Id,
+ bool ForwardDecl) {
+ void *Mem = C.getAllocator().Allocate<ObjCProtocolDecl>();
+ return new (Mem) ObjCProtocolDecl(L, numRefProtos, Id, ForwardDecl);
+}
+
//===----------------------------------------------------------------------===//
// Objective-C Decl Implementation
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=48410&r1=48409&r2=48410&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Sat Mar 15 20:23:04 2008
@@ -211,10 +211,10 @@
}
}
else {
- PDecl = new ObjCProtocolDecl(AtProtoInterfaceLoc, NumProtoRefs,
- ProtocolName);
+ PDecl = ObjCProtocolDecl::Create(Context, AtProtoInterfaceLoc, NumProtoRefs,
+ ProtocolName);
ObjCProtocols[ProtocolName] = PDecl;
- }
+ }
if (NumProtoRefs) {
/// Check then save referenced protocols
@@ -260,7 +260,7 @@
ObjCProtocolDecl *PDecl = ObjCProtocols[P];
if (!PDecl) { // Not already seen?
// FIXME: Pass in the location of the identifier!
- PDecl = new ObjCProtocolDecl(AtProtocolLoc, 0, P, true);
+ PDecl = ObjCProtocolDecl::Create(Context, AtProtocolLoc, 0, P, true);
ObjCProtocols[P] = PDecl;
}
More information about the cfe-commits
mailing list