Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1 | //===--- MinimalAction.cpp - Implement the MinimalAction class ------------===// |
| 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 | // |
| 10 | // This file implements the MinimalAction interface. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "clang/Parse/Parser.h" |
| 15 | #include "clang/Parse/DeclSpec.h" |
| 16 | #include "clang/Parse/Scope.h" |
Chris Lattner | ace6507 | 2009-05-01 16:33:20 +0000 | [diff] [blame] | 17 | #include "clang/Basic/TargetInfo.h" |
Chris Lattner | e1ae1e9 | 2009-01-18 09:39:41 +0000 | [diff] [blame] | 18 | #include "llvm/Support/Allocator.h" |
| 19 | #include "llvm/Support/RecyclingAllocator.h" |
Chris Lattner | 21ff9c9 | 2009-03-05 01:25:28 +0000 | [diff] [blame] | 20 | #include "llvm/Support/raw_ostream.h" |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 21 | using namespace clang; |
| 22 | |
Sebastian Redl | f53597f | 2009-03-15 17:47:39 +0000 | [diff] [blame] | 23 | /// Out-of-line virtual destructor to provide home for ActionBase class. |
Chris Lattner | 0102c30 | 2009-03-05 07:24:28 +0000 | [diff] [blame] | 24 | ActionBase::~ActionBase() {} |
| 25 | |
| 26 | /// Out-of-line virtual destructor to provide home for Action class. |
| 27 | Action::~Action() {} |
| 28 | |
Douglas Gregor | 1dbca6e | 2010-04-14 02:22:16 +0000 | [diff] [blame^] | 29 | Action::ObjCMessageKind Action::getObjCMessageKind(Scope *S, |
| 30 | IdentifierInfo *&Name, |
| 31 | SourceLocation NameLoc, |
| 32 | bool IsSuper, |
| 33 | bool HasTrailingDot) { |
| 34 | if (IsSuper && !HasTrailingDot && S->isInObjcMethodScope()) |
| 35 | return ObjCSuperMessage; |
| 36 | |
| 37 | if (getTypeName(*Name, NameLoc, S)) |
| 38 | return ObjCClassMessage; |
| 39 | |
| 40 | return ObjCInstanceMessage; |
| 41 | } |
| 42 | |
Chris Lattner | 0102c30 | 2009-03-05 07:24:28 +0000 | [diff] [blame] | 43 | // Defined out-of-line here because of dependecy on AttributeList |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 44 | Action::DeclPtrTy Action::ActOnUsingDirective(Scope *CurScope, |
| 45 | SourceLocation UsingLoc, |
| 46 | SourceLocation NamespcLoc, |
Jeffrey Yasskin | 9ab1454 | 2010-04-08 16:38:48 +0000 | [diff] [blame] | 47 | CXXScopeSpec &SS, |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 48 | SourceLocation IdentLoc, |
| 49 | IdentifierInfo *NamespcName, |
| 50 | AttributeList *AttrList) { |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 51 | |
Chris Lattner | 0102c30 | 2009-03-05 07:24:28 +0000 | [diff] [blame] | 52 | // FIXME: Parser seems to assume that Action::ActOn* takes ownership over |
| 53 | // passed AttributeList, however other actions don't free it, is it |
| 54 | // temporary state or bug? |
| 55 | delete AttrList; |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 56 | return DeclPtrTy(); |
Chris Lattner | 0102c30 | 2009-03-05 07:24:28 +0000 | [diff] [blame] | 57 | } |
| 58 | |
Douglas Gregor | 12c118a | 2009-11-04 16:30:06 +0000 | [diff] [blame] | 59 | // Defined out-of-line here because of dependency on AttributeList |
Douglas Gregor | 9cfbe48 | 2009-06-20 00:51:54 +0000 | [diff] [blame] | 60 | Action::DeclPtrTy Action::ActOnUsingDeclaration(Scope *CurScope, |
Anders Carlsson | 595adc1 | 2009-08-29 19:54:19 +0000 | [diff] [blame] | 61 | AccessSpecifier AS, |
John McCall | 60fa3cf | 2009-12-11 02:10:03 +0000 | [diff] [blame] | 62 | bool HasUsingKeyword, |
Anders Carlsson | 595adc1 | 2009-08-29 19:54:19 +0000 | [diff] [blame] | 63 | SourceLocation UsingLoc, |
Jeffrey Yasskin | 9ab1454 | 2010-04-08 16:38:48 +0000 | [diff] [blame] | 64 | CXXScopeSpec &SS, |
Douglas Gregor | 12c118a | 2009-11-04 16:30:06 +0000 | [diff] [blame] | 65 | UnqualifiedId &Name, |
Anders Carlsson | 595adc1 | 2009-08-29 19:54:19 +0000 | [diff] [blame] | 66 | AttributeList *AttrList, |
John McCall | 7ba107a | 2009-11-18 02:36:19 +0000 | [diff] [blame] | 67 | bool IsTypeName, |
| 68 | SourceLocation TypenameLoc) { |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 69 | |
Douglas Gregor | 9cfbe48 | 2009-06-20 00:51:54 +0000 | [diff] [blame] | 70 | // FIXME: Parser seems to assume that Action::ActOn* takes ownership over |
| 71 | // passed AttributeList, however other actions don't free it, is it |
| 72 | // temporary state or bug? |
| 73 | delete AttrList; |
| 74 | return DeclPtrTy(); |
| 75 | } |
| 76 | |
Chris Lattner | 0102c30 | 2009-03-05 07:24:28 +0000 | [diff] [blame] | 77 | |
Chris Lattner | 49f28ca | 2009-03-05 08:00:35 +0000 | [diff] [blame] | 78 | void PrettyStackTraceActionsDecl::print(llvm::raw_ostream &OS) const { |
Chris Lattner | 21ff9c9 | 2009-03-05 01:25:28 +0000 | [diff] [blame] | 79 | if (Loc.isValid()) { |
| 80 | Loc.print(OS, SM); |
| 81 | OS << ": "; |
| 82 | } |
| 83 | OS << Message; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 84 | |
Chris Lattner | 21ff9c9 | 2009-03-05 01:25:28 +0000 | [diff] [blame] | 85 | std::string Name = Actions.getDeclName(TheDecl); |
| 86 | if (!Name.empty()) |
| 87 | OS << " '" << Name << '\''; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 88 | |
Chris Lattner | 21ff9c9 | 2009-03-05 01:25:28 +0000 | [diff] [blame] | 89 | OS << '\n'; |
| 90 | } |
| 91 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 92 | /// TypeNameInfo - A link exists here for each scope that an identifier is |
| 93 | /// defined. |
Chris Lattner | e1ae1e9 | 2009-01-18 09:39:41 +0000 | [diff] [blame] | 94 | namespace { |
| 95 | struct TypeNameInfo { |
| 96 | TypeNameInfo *Prev; |
| 97 | bool isTypeName; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 98 | |
Chris Lattner | e1ae1e9 | 2009-01-18 09:39:41 +0000 | [diff] [blame] | 99 | TypeNameInfo(bool istypename, TypeNameInfo *prev) { |
| 100 | isTypeName = istypename; |
| 101 | Prev = prev; |
| 102 | } |
| 103 | }; |
| 104 | |
| 105 | struct TypeNameInfoTable { |
| 106 | llvm::RecyclingAllocator<llvm::BumpPtrAllocator, TypeNameInfo> Allocator; |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 107 | |
Chris Lattner | e1ae1e9 | 2009-01-18 09:39:41 +0000 | [diff] [blame] | 108 | void AddEntry(bool isTypename, IdentifierInfo *II) { |
| 109 | TypeNameInfo *TI = Allocator.Allocate<TypeNameInfo>(); |
Chris Lattner | f26d510 | 2009-03-24 17:05:27 +0000 | [diff] [blame] | 110 | new (TI) TypeNameInfo(isTypename, II->getFETokenInfo<TypeNameInfo>()); |
Chris Lattner | e1ae1e9 | 2009-01-18 09:39:41 +0000 | [diff] [blame] | 111 | II->setFETokenInfo(TI); |
| 112 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 113 | |
Chris Lattner | e1ae1e9 | 2009-01-18 09:39:41 +0000 | [diff] [blame] | 114 | void DeleteEntry(TypeNameInfo *Entry) { |
| 115 | Entry->~TypeNameInfo(); |
| 116 | Allocator.Deallocate(Entry); |
| 117 | } |
| 118 | }; |
| 119 | } |
| 120 | |
| 121 | static TypeNameInfoTable *getTable(void *TP) { |
| 122 | return static_cast<TypeNameInfoTable*>(TP); |
| 123 | } |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 124 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 125 | MinimalAction::MinimalAction(Preprocessor &pp) |
Chris Lattner | e1ae1e9 | 2009-01-18 09:39:41 +0000 | [diff] [blame] | 126 | : Idents(pp.getIdentifierTable()), PP(pp) { |
| 127 | TypeNameInfoTablePtr = new TypeNameInfoTable(); |
| 128 | } |
| 129 | |
| 130 | MinimalAction::~MinimalAction() { |
| 131 | delete getTable(TypeNameInfoTablePtr); |
| 132 | } |
Daniel Dunbar | e10b0f2 | 2008-10-31 08:56:51 +0000 | [diff] [blame] | 133 | |
| 134 | void MinimalAction::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) { |
Steve Naroff | 8ee529b | 2007-10-31 18:42:27 +0000 | [diff] [blame] | 135 | TUScope = S; |
Chris Lattner | e1ae1e9 | 2009-01-18 09:39:41 +0000 | [diff] [blame] | 136 | |
| 137 | TypeNameInfoTable &TNIT = *getTable(TypeNameInfoTablePtr); |
Chris Lattner | ace6507 | 2009-05-01 16:33:20 +0000 | [diff] [blame] | 138 | |
| 139 | if (PP.getTargetInfo().getPointerWidth(0) >= 64) { |
| 140 | // Install [u]int128_t for 64-bit targets. |
| 141 | TNIT.AddEntry(true, &Idents.get("__int128_t")); |
| 142 | TNIT.AddEntry(true, &Idents.get("__uint128_t")); |
| 143 | } |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 144 | |
Chris Lattner | ace6507 | 2009-05-01 16:33:20 +0000 | [diff] [blame] | 145 | if (PP.getLangOptions().ObjC1) { |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 146 | // Recognize the ObjC built-in type identifiers as types. |
Chris Lattner | ace6507 | 2009-05-01 16:33:20 +0000 | [diff] [blame] | 147 | TNIT.AddEntry(true, &Idents.get("id")); |
| 148 | TNIT.AddEntry(true, &Idents.get("SEL")); |
| 149 | TNIT.AddEntry(true, &Idents.get("Class")); |
| 150 | TNIT.AddEntry(true, &Idents.get("Protocol")); |
| 151 | } |
Steve Naroff | 8ee529b | 2007-10-31 18:42:27 +0000 | [diff] [blame] | 152 | } |
| 153 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 154 | /// isTypeName - This looks at the IdentifierInfo::FETokenInfo field to |
| 155 | /// determine whether the name is a type name (objc class name or typedef) or |
| 156 | /// not in this scope. |
Argyrios Kyrtzidis | eb83ecd | 2008-11-08 16:45:02 +0000 | [diff] [blame] | 157 | /// |
| 158 | /// FIXME: Use the passed CXXScopeSpec for accurate C++ type checking. |
Argyrios Kyrtzidis | 39caa08 | 2008-08-01 10:35:27 +0000 | [diff] [blame] | 159 | Action::TypeTy * |
Douglas Gregor | b696ea3 | 2009-02-04 17:00:24 +0000 | [diff] [blame] | 160 | MinimalAction::getTypeName(IdentifierInfo &II, SourceLocation Loc, |
Jeffrey Yasskin | 9ab1454 | 2010-04-08 16:38:48 +0000 | [diff] [blame] | 161 | Scope *S, CXXScopeSpec *SS, |
Douglas Gregor | f6e6fc8 | 2009-11-20 22:03:38 +0000 | [diff] [blame] | 162 | bool isClassName, TypeTy *ObjectType) { |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 163 | if (TypeNameInfo *TI = II.getFETokenInfo<TypeNameInfo>()) |
| 164 | if (TI->isTypeName) |
| 165 | return TI; |
| 166 | return 0; |
| 167 | } |
| 168 | |
Douglas Gregor | b48fe38 | 2008-10-31 09:07:45 +0000 | [diff] [blame] | 169 | /// isCurrentClassName - Always returns false, because MinimalAction |
| 170 | /// does not support C++ classes with constructors. |
Argyrios Kyrtzidis | eb83ecd | 2008-11-08 16:45:02 +0000 | [diff] [blame] | 171 | bool MinimalAction::isCurrentClassName(const IdentifierInfo &, Scope *, |
| 172 | const CXXScopeSpec *) { |
Douglas Gregor | b48fe38 | 2008-10-31 09:07:45 +0000 | [diff] [blame] | 173 | return false; |
| 174 | } |
| 175 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 176 | TemplateNameKind |
Douglas Gregor | 2dd078a | 2009-09-02 22:59:36 +0000 | [diff] [blame] | 177 | MinimalAction::isTemplateName(Scope *S, |
Jeffrey Yasskin | 9ab1454 | 2010-04-08 16:38:48 +0000 | [diff] [blame] | 178 | CXXScopeSpec &SS, |
Douglas Gregor | 014e88d | 2009-11-03 23:16:33 +0000 | [diff] [blame] | 179 | UnqualifiedId &Name, |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 180 | TypeTy *ObjectType, |
Douglas Gregor | 495c35d | 2009-08-25 22:51:20 +0000 | [diff] [blame] | 181 | bool EnteringScope, |
| 182 | TemplateTy &TemplateDecl) { |
Douglas Gregor | 55f6b14 | 2009-02-09 18:46:07 +0000 | [diff] [blame] | 183 | return TNK_Non_template; |
Douglas Gregor | d6fb7ef | 2008-12-18 19:37:40 +0000 | [diff] [blame] | 184 | } |
| 185 | |
Steve Naroff | 08d92e4 | 2007-09-15 18:49:24 +0000 | [diff] [blame] | 186 | /// ActOnDeclarator - If this is a typedef declarator, we modify the |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 187 | /// IdentifierInfo::FETokenInfo field to keep track of this fact, until S is |
| 188 | /// popped. |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 189 | Action::DeclPtrTy |
Chris Lattner | 682bf92 | 2009-03-29 16:50:03 +0000 | [diff] [blame] | 190 | MinimalAction::ActOnDeclarator(Scope *S, Declarator &D) { |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 191 | IdentifierInfo *II = D.getIdentifier(); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 192 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 193 | // If there is no identifier associated with this declarator, bail out. |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 194 | if (II == 0) return DeclPtrTy(); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 195 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 196 | TypeNameInfo *weCurrentlyHaveTypeInfo = II->getFETokenInfo<TypeNameInfo>(); |
| 197 | bool isTypeName = |
| 198 | D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_typedef; |
| 199 | |
| 200 | // this check avoids creating TypeNameInfo objects for the common case. |
Ted Kremenek | a34ea07 | 2008-08-04 22:51:42 +0000 | [diff] [blame] | 201 | // It does need to handle the uncommon case of shadowing a typedef name with a |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 202 | // non-typedef name. e.g. { typedef int a; a xx; { int a; } } |
| 203 | if (weCurrentlyHaveTypeInfo || isTypeName) { |
Chris Lattner | e1ae1e9 | 2009-01-18 09:39:41 +0000 | [diff] [blame] | 204 | // Allocate and add the 'TypeNameInfo' "decl". |
| 205 | getTable(TypeNameInfoTablePtr)->AddEntry(isTypeName, II); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 206 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 207 | // Remember that this needs to be removed when the scope is popped. |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 208 | S->AddDecl(DeclPtrTy::make(II)); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 209 | } |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 210 | return DeclPtrTy(); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 211 | } |
| 212 | |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 213 | Action::DeclPtrTy |
Chris Lattner | cfb0ef5 | 2008-07-21 07:13:18 +0000 | [diff] [blame] | 214 | MinimalAction::ActOnStartClassInterface(SourceLocation AtInterfaceLoc, |
Chris Lattner | 06036d3 | 2008-07-26 04:13:19 +0000 | [diff] [blame] | 215 | IdentifierInfo *ClassName, |
| 216 | SourceLocation ClassLoc, |
| 217 | IdentifierInfo *SuperName, |
| 218 | SourceLocation SuperLoc, |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 219 | const DeclPtrTy *ProtoRefs, |
Chris Lattner | 06036d3 | 2008-07-26 04:13:19 +0000 | [diff] [blame] | 220 | unsigned NumProtocols, |
Douglas Gregor | 18df52b | 2010-01-16 15:02:53 +0000 | [diff] [blame] | 221 | const SourceLocation *ProtoLocs, |
Chris Lattner | 06036d3 | 2008-07-26 04:13:19 +0000 | [diff] [blame] | 222 | SourceLocation EndProtoLoc, |
| 223 | AttributeList *AttrList) { |
Chris Lattner | e1ae1e9 | 2009-01-18 09:39:41 +0000 | [diff] [blame] | 224 | // Allocate and add the 'TypeNameInfo' "decl". |
| 225 | getTable(TypeNameInfoTablePtr)->AddEntry(true, ClassName); |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 226 | return DeclPtrTy(); |
Steve Naroff | 3536b44 | 2007-09-06 21:24:23 +0000 | [diff] [blame] | 227 | } |
| 228 | |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 229 | /// ActOnForwardClassDeclaration - |
| 230 | /// Scope will always be top level file scope. |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 231 | Action::DeclPtrTy |
Steve Naroff | e440eb8 | 2007-10-10 17:32:04 +0000 | [diff] [blame] | 232 | MinimalAction::ActOnForwardClassDeclaration(SourceLocation AtClassLoc, |
Ted Kremenek | c09cba6 | 2009-11-17 23:12:20 +0000 | [diff] [blame] | 233 | IdentifierInfo **IdentList, |
| 234 | SourceLocation *IdentLocs, |
| 235 | unsigned NumElts) { |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 236 | for (unsigned i = 0; i != NumElts; ++i) { |
Chris Lattner | e1ae1e9 | 2009-01-18 09:39:41 +0000 | [diff] [blame] | 237 | // Allocate and add the 'TypeNameInfo' "decl". |
| 238 | getTable(TypeNameInfoTablePtr)->AddEntry(true, IdentList[i]); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 239 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 240 | // Remember that this needs to be removed when the scope is popped. |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 241 | TUScope->AddDecl(DeclPtrTy::make(IdentList[i])); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 242 | } |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 243 | return DeclPtrTy(); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 244 | } |
| 245 | |
Ted Kremenek | a34ea07 | 2008-08-04 22:51:42 +0000 | [diff] [blame] | 246 | /// ActOnPopScope - When a scope is popped, if any typedefs are now |
| 247 | /// out-of-scope, they are removed from the IdentifierInfo::FETokenInfo field. |
Steve Naroff | 640db42 | 2007-10-10 17:45:44 +0000 | [diff] [blame] | 248 | void MinimalAction::ActOnPopScope(SourceLocation Loc, Scope *S) { |
Chris Lattner | e1ae1e9 | 2009-01-18 09:39:41 +0000 | [diff] [blame] | 249 | TypeNameInfoTable &Table = *getTable(TypeNameInfoTablePtr); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 250 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 251 | for (Scope::decl_iterator I = S->decl_begin(), E = S->decl_end(); |
| 252 | I != E; ++I) { |
Chris Lattner | b28317a | 2009-03-28 19:18:32 +0000 | [diff] [blame] | 253 | IdentifierInfo &II = *(*I).getAs<IdentifierInfo>(); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 254 | TypeNameInfo *TI = II.getFETokenInfo<TypeNameInfo>(); |
| 255 | assert(TI && "This decl didn't get pushed??"); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 256 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 257 | if (TI) { |
| 258 | TypeNameInfo *Next = TI->Prev; |
Chris Lattner | e1ae1e9 | 2009-01-18 09:39:41 +0000 | [diff] [blame] | 259 | Table.DeleteEntry(TI); |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 260 | |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 261 | II.setFETokenInfo(Next); |
| 262 | } |
| 263 | } |
| 264 | } |