[cfe-commits] r42494 - in /cfe/trunk: AST/ASTContext.cpp AST/Decl.cpp AST/Type.cpp Sema/SemaDecl.cpp Sema/SemaType.cpp clang.xcodeproj/project.pbxproj include/clang/AST/AST.h include/clang/AST/ASTContext.h include/clang/AST/Decl.h include/clang/AST/DeclObjC.h include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
Steve Naroff
snaroff at apple.com
Mon Oct 1 12:00:59 PDT 2007
Author: snaroff
Date: Mon Oct 1 14:00:59 2007
New Revision: 42494
URL: http://llvm.org/viewvc/llvm-project?rev=42494&view=rev
Log:
Move ObjC decls to DeclObjC.h, a new AST header.
Update clients and add to project file.
Added:
cfe/trunk/include/clang/AST/DeclObjC.h
Modified:
cfe/trunk/AST/ASTContext.cpp
cfe/trunk/AST/Decl.cpp
cfe/trunk/AST/Type.cpp
cfe/trunk/Sema/SemaDecl.cpp
cfe/trunk/Sema/SemaType.cpp
cfe/trunk/clang.xcodeproj/project.pbxproj
cfe/trunk/include/clang/AST/AST.h
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=42494&r1=42493&r2=42494&view=diff
==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Mon Oct 1 14:00:59 2007
@@ -13,6 +13,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclObjC.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/SmallVector.h"
Modified: cfe/trunk/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Decl.cpp?rev=42494&r1=42493&r2=42494&view=diff
==============================================================================
--- cfe/trunk/AST/Decl.cpp (original)
+++ cfe/trunk/AST/Decl.cpp Mon Oct 1 14:00:59 2007
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclObjC.h"
#include "clang/Lex/IdentifierTable.h"
using namespace clang;
Modified: cfe/trunk/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Type.cpp?rev=42494&r1=42493&r2=42494&view=diff
==============================================================================
--- cfe/trunk/AST/Type.cpp (original)
+++ cfe/trunk/AST/Type.cpp Mon Oct 1 14:00:59 2007
@@ -14,6 +14,7 @@
#include "clang/Lex/IdentifierTable.h"
#include "clang/AST/Type.h"
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/Support/Streams.h"
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=42494&r1=42493&r2=42494&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Mon Oct 1 14:00:59 2007
@@ -15,6 +15,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/Builtins.h"
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/AST/Type.h"
#include "clang/Parse/DeclSpec.h"
Modified: cfe/trunk/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaType.cpp?rev=42494&r1=42493&r2=42494&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaType.cpp (original)
+++ cfe/trunk/Sema/SemaType.cpp Mon Oct 1 14:00:59 2007
@@ -14,6 +14,7 @@
#include "Sema.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclObjC.h"
#include "clang/Parse/DeclSpec.h"
#include "clang/Lex/IdentifierTable.h"
#include "clang/Basic/LangOptions.h"
Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=42494&r1=42493&r2=42494&view=diff
==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Mon Oct 1 14:00:59 2007
@@ -17,6 +17,7 @@
355CF6840C90A8D400A08AA3 /* DeadStores.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 355CF6830C90A8D400A08AA3 /* DeadStores.cpp */; };
356EF9B50C8F7DDF006650F5 /* LiveVariables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 356EF9B40C8F7DDF006650F5 /* LiveVariables.cpp */; };
35CFFE000CA1CBCB00E6F2BE /* StmtViz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 35CFFDFF0CA1CBCB00E6F2BE /* StmtViz.cpp */; };
+ 84AF36A10CB17A3B00C820A5 /* DeclObjC.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84AF36A00CB17A3B00C820A5 /* DeclObjC.h */; };
84D9A8880C1A57E100AC7ABC /* AttributeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84D9A8870C1A57E100AC7ABC /* AttributeList.cpp */; };
84D9A88C0C1A581300AC7ABC /* AttributeList.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D9A88B0C1A581300AC7ABC /* AttributeList.h */; };
DE01DA490B12ADA300AC22CE /* PPCallbacks.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE01DA480B12ADA300AC22CE /* PPCallbacks.h */; };
@@ -202,6 +203,7 @@
DEF2E95F0C5FBD74000C4259 /* InternalsManual.html in CopyFiles */,
DEC63B1C0C7B940600DBF169 /* CFG.h in CopyFiles */,
DEF7D9F70C9C8B1A0001F598 /* Rewriter.h in CopyFiles */,
+ 84AF36A10CB17A3B00C820A5 /* DeclObjC.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 1;
};
@@ -231,6 +233,7 @@
35CFFE010CA1CBDD00E6F2BE /* StmtGraphTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StmtGraphTraits.h; path = clang/AST/StmtGraphTraits.h; sourceTree = "<group>"; };
35D1DDD10CA9C6D50096E967 /* DataflowSolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DataflowSolver.h; path = clang/Analysis/FlowSensitive/DataflowSolver.h; sourceTree = "<group>"; };
35D1DDD20CA9C6D50096E967 /* DataflowValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DataflowValues.h; path = clang/Analysis/FlowSensitive/DataflowValues.h; sourceTree = "<group>"; };
+ 84AF36A00CB17A3B00C820A5 /* DeclObjC.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = DeclObjC.h; path = clang/AST/DeclObjC.h; sourceTree = "<group>"; };
84D9A8870C1A57E100AC7ABC /* AttributeList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = AttributeList.cpp; path = Parse/AttributeList.cpp; sourceTree = "<group>"; };
84D9A88B0C1A581300AC7ABC /* AttributeList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AttributeList.h; path = clang/Parse/AttributeList.h; sourceTree = "<group>"; };
8DD76F6C0486A84900D96B5E /* clang */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = clang; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -570,6 +573,7 @@
DEC8D98B0A9433BC00353FCA /* AST */ = {
isa = PBXGroup;
children = (
+ 84AF36A00CB17A3B00C820A5 /* DeclObjC.h */,
35BFBD2B0C9EDE1E006CB644 /* ASTConsumer.h */,
DEC8D9A30A94346E00353FCA /* AST.h */,
DE75ED280B044DC90020CF81 /* ASTContext.h */,
@@ -733,7 +737,6 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
- compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
projectDirPath = "";
Modified: cfe/trunk/include/clang/AST/AST.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/AST.h?rev=42494&r1=42493&r2=42494&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/AST.h (original)
+++ cfe/trunk/include/clang/AST/AST.h Mon Oct 1 14:00:59 2007
@@ -17,6 +17,7 @@
// This header exports all AST interfaces.
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclObjC.h"
#include "clang/AST/Expr.h"
#include "clang/AST/Type.h"
#include "clang/AST/StmtVisitor.h"
Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=42494&r1=42493&r2=42494&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Mon Oct 1 14:00:59 2007
@@ -26,7 +26,8 @@
namespace clang {
class TargetInfo;
-
+ class ObjcImplementationDecl;
+
/// ASTContext - This class holds long-lived AST nodes (such as types and
/// decls) that can be referred to throughout the semantic analysis of a file.
class ASTContext {
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=42494&r1=42493&r2=42494&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Mon Oct 1 14:00:59 2007
@@ -24,10 +24,6 @@
class Stmt;
class FunctionDecl;
class AttributeList;
-class ObjcIvarDecl;
-class ObjcMethodDecl;
-class ObjcProtocolDecl;
-class ObjcCategoryDecl;
/// Decl - This represents one declaration (or definition), e.g. a variable,
/// typedef, function, struct, etc.
@@ -550,402 +546,5 @@
static bool classof(const RecordDecl *D) { return true; }
};
-class ObjcInterfaceDecl : public TypeDecl {
-
- /// Class's super class.
- ObjcInterfaceDecl *SuperClass;
-
- /// Protocols referenced in interface header declaration
- ObjcProtocolDecl **IntfRefProtocols; // Null if no referenced protocols
- int NumIntfRefProtocols; // -1 if no referenced protocols
-
- /// Ivars/NumIvars - This is a new[]'d array of pointers to Decls.
- ObjcIvarDecl **Ivars; // Null if class has no ivars
- int NumIvars; // -1 if class has no ivars
-
- /// instance methods
- ObjcMethodDecl **InsMethods; // Null if class has no instance methods
- int NumInsMethods; // -1 if class has no instance methods
-
- /// class methods
- ObjcMethodDecl **ClsMethods; // Null if class has no class methods
- int NumClsMethods; // -1 if class has no class methods
-
- /// List of categories defined for this class.
- ObjcCategoryDecl *ListCategories;
-
- bool isForwardDecl; // declared with @class.
-public:
- ObjcInterfaceDecl(SourceLocation L, unsigned numRefProtos,
- IdentifierInfo *Id, bool FD = false)
- : TypeDecl(ObjcInterface, L, Id, 0),
- SuperClass(0),
- IntfRefProtocols(0), NumIntfRefProtocols(-1),
- Ivars(0), NumIvars(-1),
- InsMethods(0), NumInsMethods(-1), ClsMethods(0), NumClsMethods(-1),
- ListCategories(0),
- isForwardDecl(FD) {
- AllocIntfRefProtocols(numRefProtos);
- }
-
- void AllocIntfRefProtocols(unsigned numRefProtos) {
- if (numRefProtos) {
- IntfRefProtocols = new ObjcProtocolDecl*[numRefProtos];
- memset(IntfRefProtocols, '\0',
- numRefProtos*sizeof(ObjcProtocolDecl*));
- NumIntfRefProtocols = numRefProtos;
- }
- }
-
- ObjcProtocolDecl **getIntfRefProtocols() const { return IntfRefProtocols; }
- int getNumIntfRefProtocols() const { return NumIntfRefProtocols; }
-
- ObjcIvarDecl **getIntfDeclIvars() const { return Ivars; }
- int getIntfDeclNumIvars() const { return NumIvars; }
-
- ObjcMethodDecl** getInsMethods() const { return InsMethods; }
- int getNumInsMethods() const { return NumInsMethods; }
-
- ObjcMethodDecl** getClsMethods() const { return ClsMethods; }
- int getNumClsMethods() const { return NumClsMethods; }
-
- void ObjcAddInstanceVariablesToClass(ObjcIvarDecl **ivars,
- unsigned numIvars);
-
- void ObjcAddMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers,
- ObjcMethodDecl **clsMethods, unsigned numClsMembers);
-
- bool getIsForwardDecl() const { return isForwardDecl; }
- void setIsForwardDecl(bool val) { isForwardDecl = val; }
-
- void setIntfRefProtocols(int idx, ObjcProtocolDecl *OID) {
- assert((idx < NumIntfRefProtocols) && "index out of range");
- IntfRefProtocols[idx] = OID;
- }
-
- ObjcInterfaceDecl *getSuperClass() const { return SuperClass; }
- void setSuperClass(ObjcInterfaceDecl * superCls) { SuperClass = superCls; }
-
- ObjcCategoryDecl* getListCategories() const { return ListCategories; }
- void setListCategories(ObjcCategoryDecl *category) {
- ListCategories = category;
- }
-
- static bool classof(const Decl *D) {
- return D->getKind() == ObjcInterface;
- }
- static bool classof(const ObjcInterfaceDecl *D) { return true; }
-};
-
-class ObjcIvarDecl : public FieldDecl {
-public:
- ObjcIvarDecl(SourceLocation L, IdentifierInfo *Id, QualType T)
- : FieldDecl(ObjcIvar, L, Id, T) {}
-
- enum AccessControl {
- None, Private, Protected, Public, Package
- };
- void setAccessControl(AccessControl ac) { DeclAccess = ac; }
- AccessControl getAccessControl() const { return DeclAccess; }
-
- // Implement isa/cast/dyncast/etc.
- static bool classof(const Decl *D) { return D->getKind() == ObjcIvar; }
- static bool classof(const ObjcIvarDecl *D) { return true; }
-private:
- AccessControl DeclAccess : 3;
-};
-
-class ObjcClassDecl : public TypeDecl {
- ObjcInterfaceDecl **ForwardDecls; // Null if not defined.
- int NumForwardDecls; // -1 if not defined.
-public:
- ObjcClassDecl(SourceLocation L, unsigned nElts)
- : TypeDecl(ObjcClass, L, 0, 0) {
- if (nElts) {
- ForwardDecls = new ObjcInterfaceDecl*[nElts];
- memset(ForwardDecls, '\0', nElts*sizeof(ObjcInterfaceDecl*));
- }
- NumForwardDecls = nElts;
- }
- void setInterfaceDecl(int idx, ObjcInterfaceDecl *OID) {
- assert((idx < NumForwardDecls) && "index out of range");
- ForwardDecls[idx] = OID;
- }
- static bool classof(const Decl *D) {
- return D->getKind() == ObjcClass;
- }
- static bool classof(const ObjcClassDecl *D) { return true; }
-};
-
-/// ObjcMethodDecl - An instance of this class is created to represent an instance
-/// or class method declaration.
-class ObjcMethodDecl : public Decl {
-public:
- enum ImplementationControl { None, Required, Optional };
-private:
- /// Bitfields must be first fields in this class so they pack with those
- /// declared in class Decl.
- /// instance (true) or class (false) method.
- bool IsInstance : 1;
- /// @required/@optional
- ImplementationControl DeclImplementation : 2;
-
- // A unigue name for this method.
- Selector SelName;
-
- // Type of this method.
- QualType MethodDeclType;
- /// ParamInfo - new[]'d array of pointers to VarDecls for the formal
- /// parameters of this Method. This is null if there are no formals.
- ParmVarDecl **ParamInfo;
- int NumMethodParams; // -1 if no parameters
-
- /// List of attributes for this method declaration.
- AttributeList *MethodAttrs;
-
- /// Loc - location of this declaration.
- SourceLocation Loc;
-
-public:
- ObjcMethodDecl(SourceLocation L, Selector SelInfo, QualType T,
- ParmVarDecl **paramInfo = 0, int numParams=-1,
- AttributeList *M = 0, bool isInstance = true,
- ImplementationControl impControl = None,
- Decl *PrevDecl = 0)
- : Decl(ObjcMethod),
- IsInstance(isInstance), DeclImplementation(impControl),
- SelName(SelInfo), MethodDeclType(T),
- ParamInfo(paramInfo), NumMethodParams(numParams),
- MethodAttrs(M), Loc(L) {}
-#if 0
- ObjcMethodDecl(Kind DK, SourceLocation L, IdentifierInfo &SelId, QualType T,
- ParmVarDecl **paramInfo = 0, int numParams=-1,
- AttributeList *M = 0, bool isInstance = true,
- Decl *PrevDecl = 0)
- : Decl(DK), Selector(SelId), MethodDeclType(T),
- ParamInfo(paramInfo), NumMethodParams(numParams),
- MethodAttrs(M), IsInstance(isInstance) {}
-#endif
- virtual ~ObjcMethodDecl();
- bool isInstance() const { return IsInstance; }
- ImplementationControl getImplementationControl() const {
- return DeclImplementation;
- }
-
- Selector getSelector() const { return SelName; }
- QualType getMethodType() const { return MethodDeclType; }
- unsigned getNumMethodParams() const { return NumMethodParams; }
- ParmVarDecl *getMethodParamDecl(unsigned i) {
- assert(i < getNumMethodParams() && "Illegal param #");
- return ParamInfo[i];
- }
- void setMethodParams(ParmVarDecl **NewParamInfo, unsigned NumParams);
-
- AttributeList *getMethodAttrs() const {return MethodAttrs;}
- SourceLocation getLocation() const { return Loc; }
-
- // Implement isa/cast/dyncast/etc.
- static bool classof(const Decl *D) {
- return D->getKind() == ObjcMethod;
- }
- static bool classof(const ObjcMethodDecl *D) { return true; }
-};
-
-class ObjcProtocolDecl : public TypeDecl {
- /// referenced protocols
- ObjcProtocolDecl **ReferencedProtocols; // Null if none
- int NumReferencedProtocols; // -1 if none
-
- /// protocol instance methods
- ObjcMethodDecl **ProtoInsMethods; // Null if not defined
- int NumProtoInsMethods; // -1 if not defined
-
- /// protocol class methods
- ObjcMethodDecl **ProtoClsMethods; // Null if not defined
- int NumProtoClsMethods; // -1 if not defined
-
- bool isForwardProtoDecl; // declared with @protocol.
-public:
- ObjcProtocolDecl(SourceLocation L, unsigned numRefProtos,
- IdentifierInfo *Id, bool FD = false)
- : TypeDecl(ObjcProtocol, L, Id, 0),
- ReferencedProtocols(0), NumReferencedProtocols(-1),
- ProtoInsMethods(0), NumProtoInsMethods(-1),
- ProtoClsMethods(0), NumProtoClsMethods(-1),
- isForwardProtoDecl(FD) {
- AllocReferencedProtocols(numRefProtos);
- }
- void AllocReferencedProtocols(unsigned numRefProtos) {
- if (numRefProtos) {
- ReferencedProtocols = new ObjcProtocolDecl*[numRefProtos];
- memset(ReferencedProtocols, '\0',
- numRefProtos*sizeof(ObjcProtocolDecl*));
- NumReferencedProtocols = numRefProtos;
- }
- }
- void ObjcAddProtoMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers,
- ObjcMethodDecl **clsMethods, unsigned numClsMembers);
-
- void setReferencedProtocols(int idx, ObjcProtocolDecl *OID) {
- assert((idx < NumReferencedProtocols) && "index out of range");
- ReferencedProtocols[idx] = OID;
- }
-
- ObjcProtocolDecl** getReferencedProtocols() const {
- return ReferencedProtocols;
- }
- int getNumReferencedProtocols() const { return NumReferencedProtocols; }
-
- ObjcMethodDecl** getInsMethods() const { return ProtoInsMethods; }
- int getNumInsMethods() const { return NumProtoInsMethods; }
-
- ObjcMethodDecl** getClsMethods() const { return ProtoClsMethods; }
- int getNumClsMethods() const { return NumProtoClsMethods; }
-
- bool getIsForwardProtoDecl() const { return isForwardProtoDecl; }
- void setIsForwardProtoDecl(bool val) { isForwardProtoDecl = val; }
-
- static bool classof(const Decl *D) {
- return D->getKind() == ObjcProtocol;
- }
- static bool classof(const ObjcProtocolDecl *D) { return true; }
-};
-
-class ObjcForwardProtocolDecl : public TypeDecl {
- ObjcProtocolDecl **ForwardProtocolDecls; // Null if not defined.
- int NumForwardProtocolDecls; // -1 if not defined.
- public:
- ObjcForwardProtocolDecl(SourceLocation L, unsigned nElts)
- : TypeDecl(ObjcForwardProtocol, L, 0, 0) {
- if (nElts) {
- ForwardProtocolDecls = new ObjcProtocolDecl*[nElts];
- memset(ForwardProtocolDecls, '\0', nElts*sizeof(ObjcProtocolDecl*));
- NumForwardProtocolDecls = nElts;
- }
- }
- void setForwardProtocolDecl(int idx, ObjcProtocolDecl *OID) {
- assert((idx < NumForwardProtocolDecls) && "index out of range");
- ForwardProtocolDecls[idx] = OID;
- }
- static bool classof(const Decl *D) {
- return D->getKind() == ObjcForwardProtocol;
- }
- static bool classof(const ObjcForwardProtocolDecl *D) { return true; }
-};
-
-class ObjcCategoryDecl : public ScopedDecl {
- /// Interface belonging to this category
- ObjcInterfaceDecl *ClassInterface;
-
- /// Category name
- IdentifierInfo *ObjcCatName;
-
- /// referenced protocols in this category
- ObjcProtocolDecl **CatReferencedProtocols; // Null if none
- int NumCatReferencedProtocols; // -1 if none
-
- /// category instance methods
- ObjcMethodDecl **CatInsMethods; // Null if not defined
- int NumCatInsMethods; // -1 if not defined
-
- /// category class methods
- ObjcMethodDecl **CatClsMethods; // Null if not defined
- int NumCatClsMethods; // -1 if not defined
-
- /// Next category belonging to this class
- ObjcCategoryDecl *NextClassCategory;
-
-public:
- ObjcCategoryDecl(SourceLocation L, unsigned numRefProtocol,
- IdentifierInfo *Id)
- : ScopedDecl(ObjcCategory, L, Id, 0),
- ClassInterface(0), ObjcCatName(0),
- CatReferencedProtocols(0), NumCatReferencedProtocols(-1),
- CatInsMethods(0), NumCatInsMethods(-1),
- CatClsMethods(0), NumCatClsMethods(-1),
- NextClassCategory(0) {
- if (numRefProtocol) {
- CatReferencedProtocols = new ObjcProtocolDecl*[numRefProtocol];
- memset(CatReferencedProtocols, '\0',
- numRefProtocol*sizeof(ObjcProtocolDecl*));
- NumCatReferencedProtocols = numRefProtocol;
- }
- }
-
- ObjcInterfaceDecl *getClassInterface() const { return ClassInterface; }
- void setClassInterface(ObjcInterfaceDecl *IDecl) { ClassInterface = IDecl; }
-
- void setCatReferencedProtocols(int idx, ObjcProtocolDecl *OID) {
- assert((idx < NumCatReferencedProtocols) && "index out of range");
- CatReferencedProtocols[idx] = OID;
- }
-
- void ObjcAddCatMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers,
- ObjcMethodDecl **clsMethods, unsigned numClsMembers);
-
- IdentifierInfo *getCatName() const { return ObjcCatName; }
- void setCatName(IdentifierInfo *catName) { ObjcCatName = catName; }
-
- ObjcCategoryDecl *getNextClassCategory() const { return NextClassCategory; }
- void insertNextClassCategory() {
- NextClassCategory = ClassInterface->getListCategories();
- ClassInterface->setListCategories(this);
- }
-
- static bool classof(const Decl *D) {
- return D->getKind() == ObjcCategory;
- }
- static bool classof(const ObjcCategoryDecl *D) { return true; }
-};
-
-class ObjcImplementationDecl : public TypeDecl {
-
- /// Implementation Class's super class.
- ObjcInterfaceDecl *SuperClass;
-
- /// Optional Ivars/NumIvars - This is a new[]'d array of pointers to Decls.
- ObjcIvarDecl **Ivars; // Null if not specified
- int NumIvars; // -1 if not defined.
-
- /// implemented instance methods
- ObjcMethodDecl **InsMethods; // Null if not defined
- int NumInsMethods; // -1 if not defined
-
- /// implemented class methods
- ObjcMethodDecl **ClsMethods; // Null if not defined
- int NumClsMethods; // -1 if not defined
-
- public:
- ObjcImplementationDecl(SourceLocation L, IdentifierInfo *Id,
- ObjcInterfaceDecl* superDecl)
- : TypeDecl(ObjcImplementation, L, Id, 0),
- SuperClass(superDecl),
- Ivars(0), NumIvars(-1),
- InsMethods(0), NumInsMethods(-1), ClsMethods(0), NumClsMethods(-1) {}
-
- void ObjcAddInstanceVariablesToClassImpl(ObjcIvarDecl **ivars,
- unsigned numIvars);
-
- void ObjcAddImplMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers,
- ObjcMethodDecl **clsMethods, unsigned numClsMembers);
-
- ObjcInterfaceDecl *getImplSuperClass() const { return SuperClass; }
-
- void setImplSuperClass(ObjcInterfaceDecl * superCls)
- { SuperClass = superCls; }
-
- ObjcMethodDecl **getInsMethods() const { return InsMethods; }
- int getNumInsMethods() const { return NumInsMethods; }
-
- ObjcMethodDecl **getClsMethods() const { return ClsMethods; }
- int getNumClsMethods() const { return NumClsMethods; }
-
- static bool classof(const Decl *D) {
- return D->getKind() == ObjcImplementation;
- }
- static bool classof(const ObjcImplementationDecl *D) { return true; }
-};
-
-
} // end namespace clang
#endif
Added: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=42494&view=auto
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (added)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Mon Oct 1 14:00:59 2007
@@ -0,0 +1,428 @@
+//===--- DeclObjC.h - Classes for representing declarations -----*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by Steve Naroff and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the DeclObjC interface and subclasses.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_AST_DECLOBJC_H
+#define LLVM_CLANG_AST_DECLOBJC_H
+
+#include "clang/AST/Decl.h"
+
+namespace clang {
+class Expr;
+class Stmt;
+class FunctionDecl;
+class AttributeList;
+class ObjcIvarDecl;
+class ObjcMethodDecl;
+class ObjcProtocolDecl;
+class ObjcCategoryDecl;
+
+class ObjcInterfaceDecl : public TypeDecl {
+
+ /// Class's super class.
+ ObjcInterfaceDecl *SuperClass;
+
+ /// Protocols referenced in interface header declaration
+ ObjcProtocolDecl **IntfRefProtocols; // Null if none
+ int NumIntfRefProtocols; // -1 if none
+
+ /// Ivars/NumIvars - This is a new[]'d array of pointers to Decls.
+ ObjcIvarDecl **Ivars; // Null if not defined.
+ int NumIvars; // -1 if not defined.
+
+ /// instance methods
+ ObjcMethodDecl **InsMethods; // Null if not defined
+ int NumInsMethods; // -1 if not defined
+
+ /// class methods
+ ObjcMethodDecl **ClsMethods; // Null if not defined
+ int NumClsMethods; // -1 if not defined
+
+ /// List of categories defined for this class.
+ ObjcCategoryDecl *ListCategories;
+
+ bool isForwardDecl; // declared with @class.
+public:
+ ObjcInterfaceDecl(SourceLocation L, unsigned numRefProtos,
+ IdentifierInfo *Id, bool FD = false)
+ : TypeDecl(ObjcInterface, L, Id, 0),
+ SuperClass(0),
+ IntfRefProtocols(0), NumIntfRefProtocols(-1),
+ Ivars(0), NumIvars(-1),
+ InsMethods(0), NumInsMethods(-1), ClsMethods(0), NumClsMethods(-1),
+ ListCategories(0),
+ isForwardDecl(FD) {
+ AllocIntfRefProtocols(numRefProtos);
+ }
+
+ void AllocIntfRefProtocols(unsigned numRefProtos) {
+ if (numRefProtos) {
+ IntfRefProtocols = new ObjcProtocolDecl*[numRefProtos];
+ memset(IntfRefProtocols, '\0',
+ numRefProtos*sizeof(ObjcProtocolDecl*));
+ NumIntfRefProtocols = numRefProtos;
+ }
+ }
+
+ ObjcProtocolDecl **getIntfRefProtocols() const { return IntfRefProtocols; }
+ int getNumIntfRefProtocols() const { return NumIntfRefProtocols; }
+
+ ObjcIvarDecl **getIntfDeclIvars() const { return Ivars; }
+ int getIntfDeclNumIvars() const { return NumIvars; }
+
+ ObjcMethodDecl** getInsMethods() const { return InsMethods; }
+ int getNumInsMethods() const { return NumInsMethods; }
+
+ ObjcMethodDecl** getClsMethods() const { return ClsMethods; }
+ int getNumClsMethods() const { return NumClsMethods; }
+
+ void ObjcAddInstanceVariablesToClass(ObjcIvarDecl **ivars,
+ unsigned numIvars);
+
+ void ObjcAddMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers,
+ ObjcMethodDecl **clsMethods, unsigned numClsMembers);
+
+ bool getIsForwardDecl() const { return isForwardDecl; }
+ void setIsForwardDecl(bool val) { isForwardDecl = val; }
+
+ void setIntfRefProtocols(int idx, ObjcProtocolDecl *OID) {
+ assert((idx < NumIntfRefProtocols) && "index out of range");
+ IntfRefProtocols[idx] = OID;
+ }
+
+ ObjcInterfaceDecl *getSuperClass() const { return SuperClass; }
+ void setSuperClass(ObjcInterfaceDecl * superCls) { SuperClass = superCls; }
+
+ ObjcCategoryDecl* getListCategories() const { return ListCategories; }
+ void setListCategories(ObjcCategoryDecl *category) {
+ ListCategories = category;
+ }
+
+ static bool classof(const Decl *D) {
+ return D->getKind() == ObjcInterface;
+ }
+ static bool classof(const ObjcInterfaceDecl *D) { return true; }
+};
+
+class ObjcIvarDecl : public FieldDecl {
+public:
+ ObjcIvarDecl(SourceLocation L, IdentifierInfo *Id, QualType T)
+ : FieldDecl(ObjcIvar, L, Id, T) {}
+
+ enum AccessControl {
+ None, Private, Protected, Public, Package
+ };
+ void setAccessControl(AccessControl ac) { DeclAccess = ac; }
+ AccessControl getAccessControl() const { return DeclAccess; }
+
+ // Implement isa/cast/dyncast/etc.
+ static bool classof(const Decl *D) { return D->getKind() == ObjcIvar; }
+ static bool classof(const ObjcIvarDecl *D) { return true; }
+private:
+ AccessControl DeclAccess : 3;
+};
+
+class ObjcClassDecl : public TypeDecl {
+ ObjcInterfaceDecl **ForwardDecls; // Null if not defined.
+ int NumForwardDecls; // -1 if not defined.
+public:
+ ObjcClassDecl(SourceLocation L, unsigned nElts)
+ : TypeDecl(ObjcClass, L, 0, 0) {
+ if (nElts) {
+ ForwardDecls = new ObjcInterfaceDecl*[nElts];
+ memset(ForwardDecls, '\0', nElts*sizeof(ObjcInterfaceDecl*));
+ }
+ NumForwardDecls = nElts;
+ }
+ void setInterfaceDecl(int idx, ObjcInterfaceDecl *OID) {
+ assert((idx < NumForwardDecls) && "index out of range");
+ ForwardDecls[idx] = OID;
+ }
+ static bool classof(const Decl *D) {
+ return D->getKind() == ObjcClass;
+ }
+ static bool classof(const ObjcClassDecl *D) { return true; }
+};
+
+/// ObjcMethodDecl - An instance of this class is created to represent an instance
+/// or class method declaration.
+class ObjcMethodDecl : public Decl {
+public:
+ enum ImplementationControl { None, Required, Optional };
+private:
+ /// Bitfields must be first fields in this class so they pack with those
+ /// declared in class Decl.
+ /// instance (true) or class (false) method.
+ bool IsInstance : 1;
+ /// @required/@optional
+ ImplementationControl DeclImplementation : 2;
+
+ // A unigue name for this method.
+ Selector SelName;
+
+ // Type of this method.
+ QualType MethodDeclType;
+ /// ParamInfo - new[]'d array of pointers to VarDecls for the formal
+ /// parameters of this Method. This is null if there are no formals.
+ ParmVarDecl **ParamInfo;
+ int NumMethodParams; // -1 if no parameters
+
+ /// List of attributes for this method declaration.
+ AttributeList *MethodAttrs;
+
+ /// Loc - location of this declaration.
+ SourceLocation Loc;
+
+public:
+ ObjcMethodDecl(SourceLocation L, Selector SelInfo, QualType T,
+ ParmVarDecl **paramInfo = 0, int numParams=-1,
+ AttributeList *M = 0, bool isInstance = true,
+ ImplementationControl impControl = None,
+ Decl *PrevDecl = 0)
+ : Decl(ObjcMethod),
+ IsInstance(isInstance), DeclImplementation(impControl),
+ SelName(SelInfo), MethodDeclType(T),
+ ParamInfo(paramInfo), NumMethodParams(numParams),
+ MethodAttrs(M), Loc(L) {}
+#if 0
+ ObjcMethodDecl(Kind DK, SourceLocation L, IdentifierInfo &SelId, QualType T,
+ ParmVarDecl **paramInfo = 0, int numParams=-1,
+ AttributeList *M = 0, bool isInstance = true,
+ Decl *PrevDecl = 0)
+ : Decl(DK), Selector(SelId), MethodDeclType(T),
+ ParamInfo(paramInfo), NumMethodParams(numParams),
+ MethodAttrs(M), IsInstance(isInstance) {}
+#endif
+ virtual ~ObjcMethodDecl();
+ Selector getSelector() const { return SelName; }
+ QualType getMethodType() const { return MethodDeclType; }
+ unsigned getNumMethodParams() const { return NumMethodParams; }
+ ParmVarDecl *getMethodParamDecl(unsigned i) {
+ assert(i < getNumMethodParams() && "Illegal param #");
+ return ParamInfo[i];
+ }
+ void setMethodParams(ParmVarDecl **NewParamInfo, unsigned NumParams);
+
+ AttributeList *getMethodAttrs() const {return MethodAttrs;}
+ SourceLocation getLocation() const { return Loc; }
+ bool isInstance() const { return IsInstance; }
+ // Related to protocols declared in @protocol
+ void setDeclImplementation(ImplementationControl ic)
+ { DeclImplementation = ic; }
+ ImplementationControl getImplementationControl() const
+ { return DeclImplementation; }
+
+ // Implement isa/cast/dyncast/etc.
+ static bool classof(const Decl *D) {
+ return D->getKind() == ObjcMethod;
+ }
+ static bool classof(const ObjcMethodDecl *D) { return true; }
+};
+
+class ObjcProtocolDecl : public TypeDecl {
+ /// referenced protocols
+ ObjcProtocolDecl **ReferencedProtocols; // Null if none
+ int NumReferencedProtocols; // -1 if none
+
+ /// protocol instance methods
+ ObjcMethodDecl **ProtoInsMethods; // Null if not defined
+ int NumProtoInsMethods; // -1 if not defined
+
+ /// protocol class methods
+ ObjcMethodDecl **ProtoClsMethods; // Null if not defined
+ int NumProtoClsMethods; // -1 if not defined
+
+ bool isForwardProtoDecl; // declared with @protocol.
+public:
+ ObjcProtocolDecl(SourceLocation L, unsigned numRefProtos,
+ IdentifierInfo *Id, bool FD = false)
+ : TypeDecl(ObjcProtocol, L, Id, 0),
+ ReferencedProtocols(0), NumReferencedProtocols(-1),
+ ProtoInsMethods(0), NumProtoInsMethods(-1),
+ ProtoClsMethods(0), NumProtoClsMethods(-1),
+ isForwardProtoDecl(FD) {
+ AllocReferencedProtocols(numRefProtos);
+ }
+ void AllocReferencedProtocols(unsigned numRefProtos) {
+ if (numRefProtos) {
+ ReferencedProtocols = new ObjcProtocolDecl*[numRefProtos];
+ memset(ReferencedProtocols, '\0',
+ numRefProtos*sizeof(ObjcProtocolDecl*));
+ NumReferencedProtocols = numRefProtos;
+ }
+ }
+ void ObjcAddProtoMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers,
+ ObjcMethodDecl **clsMethods, unsigned numClsMembers);
+
+ void setReferencedProtocols(int idx, ObjcProtocolDecl *OID) {
+ assert((idx < NumReferencedProtocols) && "index out of range");
+ ReferencedProtocols[idx] = OID;
+ }
+
+ ObjcProtocolDecl** getReferencedProtocols() const {
+ return ReferencedProtocols;
+ }
+ int getNumReferencedProtocols() const { return NumReferencedProtocols; }
+
+ ObjcMethodDecl** getInsMethods() const { return ProtoInsMethods; }
+ int getNumInsMethods() const { return NumProtoInsMethods; }
+
+ ObjcMethodDecl** getClsMethods() const { return ProtoClsMethods; }
+ int getNumClsMethods() const { return NumProtoClsMethods; }
+
+ bool getIsForwardProtoDecl() const { return isForwardProtoDecl; }
+ void setIsForwardProtoDecl(bool val) { isForwardProtoDecl = val; }
+
+ static bool classof(const Decl *D) {
+ return D->getKind() == ObjcProtocol;
+ }
+ static bool classof(const ObjcProtocolDecl *D) { return true; }
+};
+
+class ObjcForwardProtocolDecl : public TypeDecl {
+ ObjcProtocolDecl **ForwardProtocolDecls; // Null if not defined.
+ int NumForwardProtocolDecls; // -1 if not defined.
+ public:
+ ObjcForwardProtocolDecl(SourceLocation L, unsigned nElts)
+ : TypeDecl(ObjcForwardProtocol, L, 0, 0) {
+ if (nElts) {
+ ForwardProtocolDecls = new ObjcProtocolDecl*[nElts];
+ memset(ForwardProtocolDecls, '\0', nElts*sizeof(ObjcProtocolDecl*));
+ NumForwardProtocolDecls = nElts;
+ }
+ }
+ void setForwardProtocolDecl(int idx, ObjcProtocolDecl *OID) {
+ assert((idx < NumForwardProtocolDecls) && "index out of range");
+ ForwardProtocolDecls[idx] = OID;
+ }
+ static bool classof(const Decl *D) {
+ return D->getKind() == ObjcForwardProtocol;
+ }
+ static bool classof(const ObjcForwardProtocolDecl *D) { return true; }
+};
+
+class ObjcCategoryDecl : public ScopedDecl {
+ /// Interface belonging to this category
+ ObjcInterfaceDecl *ClassInterface;
+
+ /// Category name
+ IdentifierInfo *ObjcCatName;
+
+ /// referenced protocols in this category
+ ObjcProtocolDecl **CatReferencedProtocols; // Null if none
+ int NumCatReferencedProtocols; // -1 if none
+
+ /// category instance methods
+ ObjcMethodDecl **CatInsMethods; // Null if not defined
+ int NumCatInsMethods; // -1 if not defined
+
+ /// category class methods
+ ObjcMethodDecl **CatClsMethods; // Null if not defined
+ int NumCatClsMethods; // -1 if not defined
+
+ /// Next category belonging to this class
+ ObjcCategoryDecl *NextClassCategory;
+
+public:
+ ObjcCategoryDecl(SourceLocation L, unsigned numRefProtocol,
+ IdentifierInfo *Id)
+ : ScopedDecl(ObjcCategory, L, Id, 0),
+ ClassInterface(0), ObjcCatName(0),
+ CatReferencedProtocols(0), NumCatReferencedProtocols(-1),
+ CatInsMethods(0), NumCatInsMethods(-1),
+ CatClsMethods(0), NumCatClsMethods(-1),
+ NextClassCategory(0) {
+ if (numRefProtocol) {
+ CatReferencedProtocols = new ObjcProtocolDecl*[numRefProtocol];
+ memset(CatReferencedProtocols, '\0',
+ numRefProtocol*sizeof(ObjcProtocolDecl*));
+ NumCatReferencedProtocols = numRefProtocol;
+ }
+ }
+
+ ObjcInterfaceDecl *getClassInterface() const { return ClassInterface; }
+ void setClassInterface(ObjcInterfaceDecl *IDecl) { ClassInterface = IDecl; }
+
+ void setCatReferencedProtocols(int idx, ObjcProtocolDecl *OID) {
+ assert((idx < NumCatReferencedProtocols) && "index out of range");
+ CatReferencedProtocols[idx] = OID;
+ }
+
+ void ObjcAddCatMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers,
+ ObjcMethodDecl **clsMethods, unsigned numClsMembers);
+
+ IdentifierInfo *getCatName() const { return ObjcCatName; }
+ void setCatName(IdentifierInfo *catName) { ObjcCatName = catName; }
+
+ ObjcCategoryDecl *getNextClassCategory() const { return NextClassCategory; }
+ void insertNextClassCategory() {
+ NextClassCategory = ClassInterface->getListCategories();
+ ClassInterface->setListCategories(this);
+ }
+
+ static bool classof(const Decl *D) {
+ return D->getKind() == ObjcCategory;
+ }
+ static bool classof(const ObjcCategoryDecl *D) { return true; }
+};
+
+class ObjcImplementationDecl : public TypeDecl {
+
+ /// Implementation Class's super class.
+ ObjcInterfaceDecl *SuperClass;
+
+ /// Optional Ivars/NumIvars - This is a new[]'d array of pointers to Decls.
+ ObjcIvarDecl **Ivars; // Null if not specified
+ int NumIvars; // -1 if not defined.
+
+ /// implemented instance methods
+ ObjcMethodDecl **InsMethods; // Null if not defined
+ int NumInsMethods; // -1 if not defined
+
+ /// implemented class methods
+ ObjcMethodDecl **ClsMethods; // Null if not defined
+ int NumClsMethods; // -1 if not defined
+
+ public:
+ ObjcImplementationDecl(SourceLocation L, IdentifierInfo *Id,
+ ObjcInterfaceDecl* superDecl)
+ : TypeDecl(ObjcImplementation, L, Id, 0),
+ SuperClass(superDecl),
+ Ivars(0), NumIvars(-1),
+ InsMethods(0), NumInsMethods(-1), ClsMethods(0), NumClsMethods(-1) {}
+
+ void ObjcAddInstanceVariablesToClassImpl(ObjcIvarDecl **ivars,
+ unsigned numIvars);
+
+ void ObjcAddImplMethods(ObjcMethodDecl **insMethods, unsigned numInsMembers,
+ ObjcMethodDecl **clsMethods, unsigned numClsMembers);
+
+ ObjcInterfaceDecl *getImplSuperClass() const { return SuperClass; }
+
+ void setImplSuperClass(ObjcInterfaceDecl * superCls)
+ { SuperClass = superCls; }
+
+ ObjcMethodDecl **getInsMethods() const { return InsMethods; }
+ int getNumInsMethods() const { return NumInsMethods; }
+
+ ObjcMethodDecl **getClsMethods() const { return ClsMethods; }
+ int getNumClsMethods() const { return NumClsMethods; }
+
+ static bool classof(const Decl *D) {
+ return D->getKind() == ObjcImplementation;
+ }
+ static bool classof(const ObjcImplementationDecl *D) { return true; }
+};
+
+
+} // end namespace clang
+#endif
Modified: cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h?rev=42494&r1=42493&r2=42494&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h (original)
+++ cfe/trunk/include/clang/Analysis/Visitors/CFGRecStmtDeclVisitor.h Mon Oct 1 14:00:59 2007
@@ -19,6 +19,7 @@
#include "clang/Analysis/Visitors/CFGRecStmtVisitor.h"
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclObjC.h"
#define DISPATCH_CASE(CASE,CLASS) \
case Decl::CASE: \
More information about the cfe-commits
mailing list