Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1 | //===--- Decl.cpp - Declaration AST Node Implementation -------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 0bc735f | 2007-12-29 19:59:25 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Argyrios Kyrtzidis | e184bae | 2008-06-04 13:04:04 +0000 | [diff] [blame] | 10 | // This file implements the Decl subclasses. |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "clang/AST/Decl.h" |
Chris Lattner | 6c2b6eb | 2008-03-15 06:12:44 +0000 | [diff] [blame] | 15 | #include "clang/AST/ASTContext.h" |
Daniel Dunbar | e91593e | 2008-08-11 04:54:23 +0000 | [diff] [blame] | 16 | #include "clang/AST/Stmt.h" |
| 17 | #include "clang/Basic/IdentifierTable.h" |
Ted Kremenek | 27f8a28 | 2008-05-20 00:43:19 +0000 | [diff] [blame] | 18 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 19 | using namespace clang; |
| 20 | |
Chris Lattner | d3b9065 | 2008-03-15 05:43:15 +0000 | [diff] [blame] | 21 | //===----------------------------------------------------------------------===// |
Chris Lattner | 6c2b6eb | 2008-03-15 06:12:44 +0000 | [diff] [blame] | 22 | // Decl Allocation/Deallocation Method Implementations |
| 23 | //===----------------------------------------------------------------------===// |
Argyrios Kyrtzidis | 2d1c5d3 | 2008-04-27 13:50:30 +0000 | [diff] [blame] | 24 | |
Argyrios Kyrtzidis | ef17782 | 2008-04-17 14:40:12 +0000 | [diff] [blame] | 25 | TranslationUnitDecl *TranslationUnitDecl::Create(ASTContext &C) { |
| 26 | void *Mem = C.getAllocator().Allocate<TranslationUnitDecl>(); |
| 27 | return new (Mem) TranslationUnitDecl(); |
| 28 | } |
| 29 | |
Argyrios Kyrtzidis | 2d1c5d3 | 2008-04-27 13:50:30 +0000 | [diff] [blame] | 30 | NamespaceDecl *NamespaceDecl::Create(ASTContext &C, DeclContext *DC, |
| 31 | SourceLocation L, IdentifierInfo *Id) { |
| 32 | void *Mem = C.getAllocator().Allocate<NamespaceDecl>(); |
| 33 | return new (Mem) NamespaceDecl(DC, L, Id); |
| 34 | } |
| 35 | |
Ted Kremenek | d1ac17a | 2008-05-20 04:49:55 +0000 | [diff] [blame] | 36 | void NamespaceDecl::Destroy(ASTContext& C) { |
| 37 | // NamespaceDecl uses "NextDeclarator" to chain namespace declarations |
| 38 | // together. They are all top-level Decls. |
| 39 | |
Ted Kremenek | ebf27b1 | 2008-05-24 15:09:56 +0000 | [diff] [blame] | 40 | this->~NamespaceDecl(); |
Ted Kremenek | d1ac17a | 2008-05-20 04:49:55 +0000 | [diff] [blame] | 41 | C.getAllocator().Deallocate((void *)this); |
| 42 | } |
| 43 | |
| 44 | |
Chris Lattner | 4111024 | 2008-06-17 18:05:57 +0000 | [diff] [blame] | 45 | ImplicitParamDecl *ImplicitParamDecl::Create(ASTContext &C, DeclContext *DC, |
| 46 | SourceLocation L, IdentifierInfo *Id, QualType T, ScopedDecl *PrevDecl) { |
| 47 | void *Mem = C.getAllocator().Allocate<ImplicitParamDecl>(); |
| 48 | return new (Mem) ImplicitParamDecl(ImplicitParam, DC, L, Id, T, PrevDecl); |
| 49 | } |
| 50 | |
Chris Lattner | 9fdf9c6 | 2008-04-22 18:39:57 +0000 | [diff] [blame] | 51 | VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC, |
Steve Naroff | 248a753 | 2008-04-15 22:42:06 +0000 | [diff] [blame] | 52 | SourceLocation L, |
| 53 | IdentifierInfo *Id, QualType T, |
| 54 | StorageClass S, ScopedDecl *PrevDecl) { |
| 55 | void *Mem = C.getAllocator().Allocate<VarDecl>(); |
Chris Lattner | 9fdf9c6 | 2008-04-22 18:39:57 +0000 | [diff] [blame] | 56 | return new (Mem) VarDecl(Var, DC, L, Id, T, S, PrevDecl); |
Chris Lattner | 9e151e1 | 2008-03-15 21:10:16 +0000 | [diff] [blame] | 57 | } |
| 58 | |
Chris Lattner | 9fdf9c6 | 2008-04-22 18:39:57 +0000 | [diff] [blame] | 59 | ParmVarDecl *ParmVarDecl::Create(ASTContext &C, DeclContext *DC, |
Chris Lattner | 0ed844b | 2008-04-04 06:12:32 +0000 | [diff] [blame] | 60 | SourceLocation L, IdentifierInfo *Id, |
| 61 | QualType T, StorageClass S, |
Chris Lattner | 0442108 | 2008-04-08 04:40:51 +0000 | [diff] [blame] | 62 | Expr *DefArg, ScopedDecl *PrevDecl) { |
Chris Lattner | 9e151e1 | 2008-03-15 21:10:16 +0000 | [diff] [blame] | 63 | void *Mem = C.getAllocator().Allocate<ParmVarDecl>(); |
Chris Lattner | 9fdf9c6 | 2008-04-22 18:39:57 +0000 | [diff] [blame] | 64 | return new (Mem) ParmVarDecl(DC, L, Id, T, S, DefArg, PrevDecl); |
Chris Lattner | 9e151e1 | 2008-03-15 21:10:16 +0000 | [diff] [blame] | 65 | } |
| 66 | |
Chris Lattner | 9fdf9c6 | 2008-04-22 18:39:57 +0000 | [diff] [blame] | 67 | FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC, |
Chris Lattner | 0ed844b | 2008-04-04 06:12:32 +0000 | [diff] [blame] | 68 | SourceLocation L, |
Chris Lattner | a98e58d | 2008-03-15 21:24:04 +0000 | [diff] [blame] | 69 | IdentifierInfo *Id, QualType T, |
| 70 | StorageClass S, bool isInline, |
| 71 | ScopedDecl *PrevDecl) { |
| 72 | void *Mem = C.getAllocator().Allocate<FunctionDecl>(); |
Argyrios Kyrtzidis | d3bb44f | 2008-06-09 21:05:31 +0000 | [diff] [blame] | 73 | return new (Mem) FunctionDecl(Function, DC, L, Id, T, S, isInline, PrevDecl); |
Chris Lattner | a98e58d | 2008-03-15 21:24:04 +0000 | [diff] [blame] | 74 | } |
| 75 | |
Chris Lattner | b048c98 | 2008-04-06 04:47:34 +0000 | [diff] [blame] | 76 | FieldDecl *FieldDecl::Create(ASTContext &C, SourceLocation L, |
Chris Lattner | 8e25d86 | 2008-03-16 00:16:02 +0000 | [diff] [blame] | 77 | IdentifierInfo *Id, QualType T, Expr *BW) { |
| 78 | void *Mem = C.getAllocator().Allocate<FieldDecl>(); |
Chris Lattner | b048c98 | 2008-04-06 04:47:34 +0000 | [diff] [blame] | 79 | return new (Mem) FieldDecl(L, Id, T, BW); |
Chris Lattner | 8e25d86 | 2008-03-16 00:16:02 +0000 | [diff] [blame] | 80 | } |
| 81 | |
Chris Lattner | a98e58d | 2008-03-15 21:24:04 +0000 | [diff] [blame] | 82 | |
Chris Lattner | 0ed844b | 2008-04-04 06:12:32 +0000 | [diff] [blame] | 83 | EnumConstantDecl *EnumConstantDecl::Create(ASTContext &C, EnumDecl *CD, |
| 84 | SourceLocation L, |
Chris Lattner | c63e660 | 2008-03-15 21:32:50 +0000 | [diff] [blame] | 85 | IdentifierInfo *Id, QualType T, |
| 86 | Expr *E, const llvm::APSInt &V, |
| 87 | ScopedDecl *PrevDecl){ |
Chris Lattner | 6c2b6eb | 2008-03-15 06:12:44 +0000 | [diff] [blame] | 88 | void *Mem = C.getAllocator().Allocate<EnumConstantDecl>(); |
Chris Lattner | 0ed844b | 2008-04-04 06:12:32 +0000 | [diff] [blame] | 89 | return new (Mem) EnumConstantDecl(CD, L, Id, T, E, V, PrevDecl); |
Chris Lattner | 6c2b6eb | 2008-03-15 06:12:44 +0000 | [diff] [blame] | 90 | } |
| 91 | |
Ted Kremenek | d1ac17a | 2008-05-20 04:49:55 +0000 | [diff] [blame] | 92 | void EnumConstantDecl::Destroy(ASTContext& C) { |
| 93 | if (Init) Init->Destroy(C); |
| 94 | Decl::Destroy(C); |
| 95 | } |
| 96 | |
Chris Lattner | 9fdf9c6 | 2008-04-22 18:39:57 +0000 | [diff] [blame] | 97 | TypedefDecl *TypedefDecl::Create(ASTContext &C, DeclContext *DC, |
Chris Lattner | 0ed844b | 2008-04-04 06:12:32 +0000 | [diff] [blame] | 98 | SourceLocation L, |
Chris Lattner | c63e660 | 2008-03-15 21:32:50 +0000 | [diff] [blame] | 99 | IdentifierInfo *Id, QualType T, |
| 100 | ScopedDecl *PD) { |
Chris Lattner | 6c2b6eb | 2008-03-15 06:12:44 +0000 | [diff] [blame] | 101 | void *Mem = C.getAllocator().Allocate<TypedefDecl>(); |
Chris Lattner | 9fdf9c6 | 2008-04-22 18:39:57 +0000 | [diff] [blame] | 102 | return new (Mem) TypedefDecl(DC, L, Id, T, PD); |
Chris Lattner | 6c2b6eb | 2008-03-15 06:12:44 +0000 | [diff] [blame] | 103 | } |
| 104 | |
Chris Lattner | 9fdf9c6 | 2008-04-22 18:39:57 +0000 | [diff] [blame] | 105 | EnumDecl *EnumDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, |
Chris Lattner | 0ed844b | 2008-04-04 06:12:32 +0000 | [diff] [blame] | 106 | IdentifierInfo *Id, |
Chris Lattner | c63e660 | 2008-03-15 21:32:50 +0000 | [diff] [blame] | 107 | ScopedDecl *PrevDecl) { |
Chris Lattner | 6c2b6eb | 2008-03-15 06:12:44 +0000 | [diff] [blame] | 108 | void *Mem = C.getAllocator().Allocate<EnumDecl>(); |
Chris Lattner | 9fdf9c6 | 2008-04-22 18:39:57 +0000 | [diff] [blame] | 109 | return new (Mem) EnumDecl(DC, L, Id, PrevDecl); |
Chris Lattner | 6c2b6eb | 2008-03-15 06:12:44 +0000 | [diff] [blame] | 110 | } |
| 111 | |
Ted Kremenek | df91eca | 2008-09-02 20:13:32 +0000 | [diff] [blame^] | 112 | void EnumDecl::Destroy(ASTContext& C) { |
| 113 | if (getEnumConstantList()) getEnumConstantList()->Destroy(C); |
| 114 | Decl::Destroy(C); |
| 115 | } |
| 116 | |
| 117 | //==------------------------------------------------------------------------==// |
| 118 | // RecordDecl methods. |
| 119 | //==------------------------------------------------------------------------==// |
| 120 | |
| 121 | RecordDecl::RecordDecl(Kind DK, DeclContext *DC, SourceLocation L, |
| 122 | IdentifierInfo *Id, RecordDecl *PrevDecl) |
| 123 | : TagDecl(DK, DC, L, Id, 0), NextDecl(0) { |
| 124 | |
| 125 | HasFlexibleArrayMember = false; |
| 126 | assert(classof(static_cast<Decl*>(this)) && "Invalid Kind!"); |
| 127 | Members = 0; |
| 128 | NumMembers = -1; |
| 129 | |
| 130 | // Hook up the RecordDecl chain. |
| 131 | if (PrevDecl) { |
| 132 | RecordDecl* Tmp = PrevDecl->NextDecl; |
| 133 | // 'Tmp' might be non-NULL if it is the RecordDecl that provides the |
| 134 | // definition of the struct/union. By construction, the last RecordDecl |
| 135 | // in the chain is the 'defining' RecordDecl. |
| 136 | if (Tmp) { |
| 137 | assert (Tmp->NextDecl == 0); |
| 138 | assert (Tmp->Members && "Previous RecordDecl has a NextDecl that is " |
| 139 | "not the 'defining' RecordDecl"); |
| 140 | |
| 141 | NextDecl = Tmp; |
| 142 | } |
| 143 | |
| 144 | PrevDecl->NextDecl = this; |
| 145 | } |
| 146 | } |
| 147 | |
Argyrios Kyrtzidis | 39ba4ae | 2008-06-09 23:19:58 +0000 | [diff] [blame] | 148 | RecordDecl *RecordDecl::Create(ASTContext &C, TagKind TK, DeclContext *DC, |
Chris Lattner | 0ed844b | 2008-04-04 06:12:32 +0000 | [diff] [blame] | 149 | SourceLocation L, IdentifierInfo *Id, |
Ted Kremenek | df91eca | 2008-09-02 20:13:32 +0000 | [diff] [blame^] | 150 | RecordDecl *PrevDecl) { |
Chris Lattner | 6c2b6eb | 2008-03-15 06:12:44 +0000 | [diff] [blame] | 151 | void *Mem = C.getAllocator().Allocate<RecordDecl>(); |
Argyrios Kyrtzidis | 39ba4ae | 2008-06-09 23:19:58 +0000 | [diff] [blame] | 152 | Kind DK; |
| 153 | switch (TK) { |
Ted Kremenek | 9bcf44a | 2008-06-16 23:45:12 +0000 | [diff] [blame] | 154 | default: assert(0 && "Invalid TagKind!"); |
| 155 | case TK_enum: assert(0 && "Enum TagKind passed for Record!"); |
| 156 | case TK_struct: DK = Struct; break; |
| 157 | case TK_union: DK = Union; break; |
| 158 | case TK_class: DK = Class; break; |
Argyrios Kyrtzidis | 39ba4ae | 2008-06-09 23:19:58 +0000 | [diff] [blame] | 159 | } |
Chris Lattner | 9fdf9c6 | 2008-04-22 18:39:57 +0000 | [diff] [blame] | 160 | return new (Mem) RecordDecl(DK, DC, L, Id, PrevDecl); |
Chris Lattner | 6c2b6eb | 2008-03-15 06:12:44 +0000 | [diff] [blame] | 161 | } |
| 162 | |
Ted Kremenek | d1ac17a | 2008-05-20 04:49:55 +0000 | [diff] [blame] | 163 | |
Chris Lattner | 0ed844b | 2008-04-04 06:12:32 +0000 | [diff] [blame] | 164 | FileScopeAsmDecl *FileScopeAsmDecl::Create(ASTContext &C, |
| 165 | SourceLocation L, |
Chris Lattner | 8e25d86 | 2008-03-16 00:16:02 +0000 | [diff] [blame] | 166 | StringLiteral *Str) { |
| 167 | void *Mem = C.getAllocator().Allocate<FileScopeAsmDecl>(); |
| 168 | return new (Mem) FileScopeAsmDecl(L, Str); |
| 169 | } |
| 170 | |
Chris Lattner | 0ed844b | 2008-04-04 06:12:32 +0000 | [diff] [blame] | 171 | LinkageSpecDecl *LinkageSpecDecl::Create(ASTContext &C, |
| 172 | SourceLocation L, |
Chris Lattner | 8e25d86 | 2008-03-16 00:16:02 +0000 | [diff] [blame] | 173 | LanguageIDs Lang, Decl *D) { |
| 174 | void *Mem = C.getAllocator().Allocate<LinkageSpecDecl>(); |
| 175 | return new (Mem) LinkageSpecDecl(L, Lang, D); |
| 176 | } |
Chris Lattner | 6c2b6eb | 2008-03-15 06:12:44 +0000 | [diff] [blame] | 177 | |
| 178 | //===----------------------------------------------------------------------===// |
Chris Lattner | 8a93423 | 2008-03-31 00:36:02 +0000 | [diff] [blame] | 179 | // NamedDecl Implementation |
| 180 | //===----------------------------------------------------------------------===// |
| 181 | |
Chris Lattner | fd5de47 | 2007-10-06 22:53:46 +0000 | [diff] [blame] | 182 | const char *NamedDecl::getName() const { |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 183 | if (const IdentifierInfo *II = getIdentifier()) |
| 184 | return II->getName(); |
| 185 | return ""; |
| 186 | } |
| 187 | |
Chris Lattner | 8a93423 | 2008-03-31 00:36:02 +0000 | [diff] [blame] | 188 | //===----------------------------------------------------------------------===// |
Chris Lattner | 8a93423 | 2008-03-31 00:36:02 +0000 | [diff] [blame] | 189 | // FunctionDecl Implementation |
| 190 | //===----------------------------------------------------------------------===// |
| 191 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 192 | FunctionDecl::~FunctionDecl() { |
| 193 | delete[] ParamInfo; |
Douglas Gregor | f009795 | 2008-04-21 02:02:58 +0000 | [diff] [blame] | 194 | } |
| 195 | |
Ted Kremenek | 27f8a28 | 2008-05-20 00:43:19 +0000 | [diff] [blame] | 196 | void FunctionDecl::Destroy(ASTContext& C) { |
Ted Kremenek | b65cf41 | 2008-05-20 03:56:00 +0000 | [diff] [blame] | 197 | if (Body) |
| 198 | Body->Destroy(C); |
| 199 | |
| 200 | for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I) |
| 201 | (*I)->Destroy(C); |
| 202 | |
Ted Kremenek | 27f8a28 | 2008-05-20 00:43:19 +0000 | [diff] [blame] | 203 | Decl::Destroy(C); |
| 204 | } |
| 205 | |
| 206 | |
Douglas Gregor | f009795 | 2008-04-21 02:02:58 +0000 | [diff] [blame] | 207 | Stmt *FunctionDecl::getBody(const FunctionDecl *&Definition) const { |
| 208 | for (const FunctionDecl *FD = this; FD != 0; FD = FD->PreviousDeclaration) { |
| 209 | if (FD->Body) { |
| 210 | Definition = FD; |
| 211 | return FD->Body; |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | return 0; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 216 | } |
| 217 | |
| 218 | unsigned FunctionDecl::getNumParams() const { |
Chris Lattner | d8bdba5 | 2008-04-06 23:09:52 +0000 | [diff] [blame] | 219 | const FunctionType *FT = getType()->getAsFunctionType(); |
| 220 | if (isa<FunctionTypeNoProto>(FT)) |
Chris Lattner | d3b9065 | 2008-03-15 05:43:15 +0000 | [diff] [blame] | 221 | return 0; |
Chris Lattner | d8bdba5 | 2008-04-06 23:09:52 +0000 | [diff] [blame] | 222 | return cast<FunctionTypeProto>(FT)->getNumArgs(); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | void FunctionDecl::setParams(ParmVarDecl **NewParamInfo, unsigned NumParams) { |
| 226 | assert(ParamInfo == 0 && "Already has param info!"); |
| 227 | assert(NumParams == getNumParams() && "Parameter count mismatch!"); |
| 228 | |
| 229 | // Zero params -> null pointer. |
| 230 | if (NumParams) { |
| 231 | ParamInfo = new ParmVarDecl*[NumParams]; |
| 232 | memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams); |
| 233 | } |
| 234 | } |
| 235 | |
Chris Lattner | 8123a95 | 2008-04-10 02:22:51 +0000 | [diff] [blame] | 236 | /// getMinRequiredArguments - Returns the minimum number of arguments |
| 237 | /// needed to call this function. This may be fewer than the number of |
| 238 | /// function parameters, if some of the parameters have default |
Chris Lattner | 9e97955 | 2008-04-12 23:52:44 +0000 | [diff] [blame] | 239 | /// arguments (in C++). |
Chris Lattner | 8123a95 | 2008-04-10 02:22:51 +0000 | [diff] [blame] | 240 | unsigned FunctionDecl::getMinRequiredArguments() const { |
| 241 | unsigned NumRequiredArgs = getNumParams(); |
| 242 | while (NumRequiredArgs > 0 |
| 243 | && getParamDecl(NumRequiredArgs-1)->getDefaultArg()) |
| 244 | --NumRequiredArgs; |
| 245 | |
| 246 | return NumRequiredArgs; |
| 247 | } |
| 248 | |
Chris Lattner | 8a93423 | 2008-03-31 00:36:02 +0000 | [diff] [blame] | 249 | //===----------------------------------------------------------------------===// |
| 250 | // RecordDecl Implementation |
| 251 | //===----------------------------------------------------------------------===// |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 252 | |
Argyrios Kyrtzidis | 997b6c6 | 2008-08-08 14:08:55 +0000 | [diff] [blame] | 253 | RecordDecl::~RecordDecl() { |
| 254 | delete[] Members; |
| 255 | } |
| 256 | |
| 257 | void RecordDecl::Destroy(ASTContext& C) { |
| 258 | if (isDefinition()) |
| 259 | for (field_iterator I=field_begin(), E=field_end(); I!=E; ++I) |
| 260 | (*I)->Destroy(C); |
| 261 | |
| 262 | TagDecl::Destroy(C); |
| 263 | } |
| 264 | |
| 265 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 266 | /// defineBody - When created, RecordDecl's correspond to a forward declared |
| 267 | /// record. This method is used to mark the decl as being defined, with the |
| 268 | /// specified contents. |
| 269 | void RecordDecl::defineBody(FieldDecl **members, unsigned numMembers) { |
| 270 | assert(!isDefinition() && "Cannot redefine record!"); |
| 271 | setDefinition(true); |
| 272 | NumMembers = numMembers; |
| 273 | if (numMembers) { |
| 274 | Members = new FieldDecl*[numMembers]; |
| 275 | memcpy(Members, members, numMembers*sizeof(Decl*)); |
| 276 | } |
| 277 | } |
| 278 | |
Chris Lattner | 8a93423 | 2008-03-31 00:36:02 +0000 | [diff] [blame] | 279 | FieldDecl *RecordDecl::getMember(IdentifierInfo *II) { |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 280 | if (Members == 0 || NumMembers < 0) |
| 281 | return 0; |
Fariborz Jahanian | 3f5faf7 | 2007-10-04 00:45:27 +0000 | [diff] [blame] | 282 | |
Chris Lattner | 8a93423 | 2008-03-31 00:36:02 +0000 | [diff] [blame] | 283 | // Linear search. When C++ classes come along, will likely need to revisit. |
| 284 | for (int i = 0; i != NumMembers; ++i) |
| 285 | if (Members[i]->getIdentifier() == II) |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 286 | return Members[i]; |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 287 | return 0; |
Chris Lattner | 6fa5f09 | 2007-07-12 15:43:07 +0000 | [diff] [blame] | 288 | } |