blob: 8b74b20032a98ad275dff4c574d225780ebe6258 [file] [log] [blame]
Reid Spencer5f016e22007-07-11 17:01:13 +00001//===--- IdentifierTable.cpp - Hash table for identifier lookup -----------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner0bc735f2007-12-29 19:59:25 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Reid Spencer5f016e22007-07-11 17:01:13 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the IdentifierInfo, IdentifierVisitor, and
11// IdentifierTable interfaces.
12//
13//===----------------------------------------------------------------------===//
14
Chris Lattnerc7229c32007-10-07 08:58:51 +000015#include "clang/Basic/IdentifierTable.h"
Reid Spencer5f016e22007-07-11 17:01:13 +000016#include "clang/Basic/LangOptions.h"
Steve Naroff29238a02007-10-05 18:42:47 +000017#include "llvm/ADT/FoldingSet.h"
Chris Lattner85994262007-10-05 20:15:24 +000018#include "llvm/ADT/DenseMap.h"
Chris Lattner3daed522009-03-02 22:20:04 +000019#include <cstdio>
Ted Kremenekc637e6b2007-10-23 22:18:37 +000020
Reid Spencer5f016e22007-07-11 17:01:13 +000021using namespace clang;
22
23//===----------------------------------------------------------------------===//
24// IdentifierInfo Implementation
25//===----------------------------------------------------------------------===//
26
Ted Kremenekea9c26b2009-01-20 23:28:34 +000027IdentifierInfo::IdentifierInfo() {
Reid Spencer5f016e22007-07-11 17:01:13 +000028 TokenID = tok::identifier;
Douglas Gregor5142af32008-11-06 16:32:23 +000029 ObjCOrBuiltinID = 0;
Chris Lattner4365a7e2007-10-07 07:09:52 +000030 HasMacro = false;
Reid Spencer5f016e22007-07-11 17:01:13 +000031 IsExtension = false;
32 IsPoisoned = false;
Reid Spencer5f016e22007-07-11 17:01:13 +000033 IsCPPOperatorKeyword = false;
Chris Lattner6a170eb2009-01-21 07:43:11 +000034 NeedsHandleIdentifier = false;
Reid Spencer5f016e22007-07-11 17:01:13 +000035 FETokenInfo = 0;
Ted Kremenekea9c26b2009-01-20 23:28:34 +000036 Entry = 0;
Reid Spencer5f016e22007-07-11 17:01:13 +000037}
38
Reid Spencer5f016e22007-07-11 17:01:13 +000039//===----------------------------------------------------------------------===//
40// IdentifierTable Implementation
41//===----------------------------------------------------------------------===//
42
Ted Kremenek72b1b152009-01-15 18:47:46 +000043IdentifierInfoLookup::~IdentifierInfoLookup() {}
44
Douglas Gregor8c5a7602009-04-25 23:30:02 +000045ExternalIdentifierLookup::~ExternalIdentifierLookup() {}
46
Ted Kremenek72b1b152009-01-15 18:47:46 +000047IdentifierTable::IdentifierTable(const LangOptions &LangOpts,
48 IdentifierInfoLookup* externalLookup)
49 : HashTable(8192), // Start with space for 8K identifiers.
50 ExternalLookup(externalLookup) {
Reid Spencer5f016e22007-07-11 17:01:13 +000051
52 // Populate the identifier table with info about keywords for the current
53 // language.
54 AddKeywords(LangOpts);
55}
56
57//===----------------------------------------------------------------------===//
58// Language Keyword Implementation
59//===----------------------------------------------------------------------===//
60
61/// AddKeyword - This method is used to associate a token ID with specific
62/// identifiers because they are language keywords. This causes the lexer to
63/// automatically map matching identifiers to specialized token codes.
64///
Chris Lattnerd4b80f12007-07-16 04:18:29 +000065/// The C90/C99/CPP/CPP0x flags are set to 0 if the token should be
66/// enabled in the specified langauge, set to 1 if it is an extension
67/// in the specified language, and set to 2 if disabled in the
68/// specified language.
Reid Spencer5f016e22007-07-11 17:01:13 +000069static void AddKeyword(const char *Keyword, unsigned KWLen,
70 tok::TokenKind TokenCode,
Nate Begeman8aebcb72007-11-15 07:30:50 +000071 int C90, int C99, int CXX, int CXX0x, int BoolSupport,
Reid Spencer5f016e22007-07-11 17:01:13 +000072 const LangOptions &LangOpts, IdentifierTable &Table) {
Nate Begeman8aebcb72007-11-15 07:30:50 +000073 int Flags = 0;
74 if (BoolSupport != 0) {
Douglas Gregor7de3d792008-09-11 12:06:59 +000075 Flags = LangOpts.CPlusPlus? 0 : LangOpts.Boolean ? BoolSupport : 2;
Nate Begeman8aebcb72007-11-15 07:30:50 +000076 } else if (LangOpts.CPlusPlus) {
77 Flags = LangOpts.CPlusPlus0x ? CXX0x : CXX;
78 } else if (LangOpts.C99) {
79 Flags = C99;
80 } else {
81 Flags = C90;
82 }
Reid Spencer5f016e22007-07-11 17:01:13 +000083
84 // Don't add this keyword if disabled in this language or if an extension
85 // and extensions are disabled.
86 if (Flags + LangOpts.NoExtensions >= 2) return;
87
88 IdentifierInfo &Info = Table.get(Keyword, Keyword+KWLen);
89 Info.setTokenID(TokenCode);
90 Info.setIsExtensionToken(Flags == 1);
91}
92
93static void AddAlias(const char *Keyword, unsigned KWLen,
Chris Lattner49581f42008-02-19 06:46:10 +000094 tok::TokenKind AliaseeID,
Reid Spencer5f016e22007-07-11 17:01:13 +000095 const char *AliaseeKeyword, unsigned AliaseeKWLen,
96 const LangOptions &LangOpts, IdentifierTable &Table) {
97 IdentifierInfo &AliasInfo = Table.get(Keyword, Keyword+KWLen);
98 IdentifierInfo &AliaseeInfo = Table.get(AliaseeKeyword,
99 AliaseeKeyword+AliaseeKWLen);
Chris Lattner49581f42008-02-19 06:46:10 +0000100 AliasInfo.setTokenID(AliaseeID);
Reid Spencer5f016e22007-07-11 17:01:13 +0000101 AliasInfo.setIsExtensionToken(AliaseeInfo.isExtensionToken());
102}
103
Reid Spencer5f016e22007-07-11 17:01:13 +0000104/// AddCXXOperatorKeyword - Register a C++ operator keyword alternative
105/// representations.
106static void AddCXXOperatorKeyword(const char *Keyword, unsigned KWLen,
107 tok::TokenKind TokenCode,
108 IdentifierTable &Table) {
109 IdentifierInfo &Info = Table.get(Keyword, Keyword + KWLen);
110 Info.setTokenID(TokenCode);
Ted Kremenekc637e6b2007-10-23 22:18:37 +0000111 Info.setIsCPlusPlusOperatorKeyword();
Reid Spencer5f016e22007-07-11 17:01:13 +0000112}
113
114/// AddObjCKeyword - Register an Objective-C @keyword like "class" "selector" or
115/// "property".
116static void AddObjCKeyword(tok::ObjCKeywordKind ObjCID,
117 const char *Name, unsigned NameLen,
118 IdentifierTable &Table) {
119 Table.get(Name, Name+NameLen).setObjCKeywordID(ObjCID);
120}
121
122/// AddKeywords - Add all keywords to the symbol table.
123///
124void IdentifierTable::AddKeywords(const LangOptions &LangOpts) {
125 enum {
126 C90Shift = 0,
127 EXTC90 = 1 << C90Shift,
128 NOTC90 = 2 << C90Shift,
129 C99Shift = 2,
130 EXTC99 = 1 << C99Shift,
131 NOTC99 = 2 << C99Shift,
132 CPPShift = 4,
133 EXTCPP = 1 << CPPShift,
134 NOTCPP = 2 << CPPShift,
Chris Lattnerd4b80f12007-07-16 04:18:29 +0000135 CPP0xShift = 6,
136 EXTCPP0x = 1 << CPP0xShift,
137 NOTCPP0x = 2 << CPP0xShift,
Nate Begeman8aebcb72007-11-15 07:30:50 +0000138 BoolShift = 8,
139 BOOLSUPPORT = 1 << BoolShift,
Reid Spencer5f016e22007-07-11 17:01:13 +0000140 Mask = 3
141 };
142
143 // Add keywords and tokens for the current language.
144#define KEYWORD(NAME, FLAGS) \
145 AddKeyword(#NAME, strlen(#NAME), tok::kw_ ## NAME, \
146 ((FLAGS) >> C90Shift) & Mask, \
147 ((FLAGS) >> C99Shift) & Mask, \
Chris Lattnerd4b80f12007-07-16 04:18:29 +0000148 ((FLAGS) >> CPPShift) & Mask, \
Nate Begeman8aebcb72007-11-15 07:30:50 +0000149 ((FLAGS) >> CPP0xShift) & Mask, \
150 ((FLAGS) >> BoolShift) & Mask, LangOpts, *this);
Reid Spencer5f016e22007-07-11 17:01:13 +0000151#define ALIAS(NAME, TOK) \
Chris Lattner49581f42008-02-19 06:46:10 +0000152 AddAlias(NAME, strlen(NAME), tok::kw_ ## TOK, #TOK, strlen(#TOK), \
153 LangOpts, *this);
Reid Spencer5f016e22007-07-11 17:01:13 +0000154#define CXX_KEYWORD_OPERATOR(NAME, ALIAS) \
155 if (LangOpts.CXXOperatorNames) \
156 AddCXXOperatorKeyword(#NAME, strlen(#NAME), tok::ALIAS, *this);
157#define OBJC1_AT_KEYWORD(NAME) \
158 if (LangOpts.ObjC1) \
159 AddObjCKeyword(tok::objc_##NAME, #NAME, strlen(#NAME), *this);
160#define OBJC2_AT_KEYWORD(NAME) \
161 if (LangOpts.ObjC2) \
162 AddObjCKeyword(tok::objc_##NAME, #NAME, strlen(#NAME), *this);
163#include "clang/Basic/TokenKinds.def"
164}
165
Chris Lattner387b98d2007-10-07 07:52:34 +0000166tok::PPKeywordKind IdentifierInfo::getPPKeywordID() const {
167 // We use a perfect hash function here involving the length of the keyword,
168 // the first and third character. For preprocessor ID's there are no
169 // collisions (if there were, the switch below would complain about duplicate
170 // case values). Note that this depends on 'if' being null terminated.
171
172#define HASH(LEN, FIRST, THIRD) \
173 (LEN << 5) + (((FIRST-'a') + (THIRD-'a')) & 31)
174#define CASE(LEN, FIRST, THIRD, NAME) \
175 case HASH(LEN, FIRST, THIRD): \
176 return memcmp(Name, #NAME, LEN) ? tok::pp_not_keyword : tok::pp_ ## NAME
177
178 unsigned Len = getLength();
Chris Lattnera31f0302007-10-10 20:59:57 +0000179 if (Len < 2) return tok::pp_not_keyword;
Chris Lattner387b98d2007-10-07 07:52:34 +0000180 const char *Name = getName();
181 switch (HASH(Len, Name[0], Name[2])) {
182 default: return tok::pp_not_keyword;
183 CASE( 2, 'i', '\0', if);
184 CASE( 4, 'e', 'i', elif);
185 CASE( 4, 'e', 's', else);
186 CASE( 4, 'l', 'n', line);
187 CASE( 4, 's', 'c', sccs);
188 CASE( 5, 'e', 'd', endif);
189 CASE( 5, 'e', 'r', error);
190 CASE( 5, 'i', 'e', ident);
191 CASE( 5, 'i', 'd', ifdef);
192 CASE( 5, 'u', 'd', undef);
193
194 CASE( 6, 'a', 's', assert);
195 CASE( 6, 'd', 'f', define);
196 CASE( 6, 'i', 'n', ifndef);
197 CASE( 6, 'i', 'p', import);
198 CASE( 6, 'p', 'a', pragma);
199
200 CASE( 7, 'd', 'f', defined);
201 CASE( 7, 'i', 'c', include);
202 CASE( 7, 'w', 'r', warning);
203
204 CASE( 8, 'u', 'a', unassert);
205 CASE(12, 'i', 'c', include_next);
Chris Lattnerb8e240e2009-04-08 18:24:34 +0000206
207 CASE(16, '_', 'i', __include_macros);
Chris Lattner387b98d2007-10-07 07:52:34 +0000208#undef CASE
209#undef HASH
210 }
211}
Reid Spencer5f016e22007-07-11 17:01:13 +0000212
213//===----------------------------------------------------------------------===//
214// Stats Implementation
215//===----------------------------------------------------------------------===//
216
217/// PrintStats - Print statistics about how well the identifier table is doing
218/// at hashing identifiers.
219void IdentifierTable::PrintStats() const {
220 unsigned NumBuckets = HashTable.getNumBuckets();
221 unsigned NumIdentifiers = HashTable.getNumItems();
222 unsigned NumEmptyBuckets = NumBuckets-NumIdentifiers;
223 unsigned AverageIdentifierSize = 0;
224 unsigned MaxIdentifierLength = 0;
225
226 // TODO: Figure out maximum times an identifier had to probe for -stats.
Ted Kremenekea9c26b2009-01-20 23:28:34 +0000227 for (llvm::StringMap<IdentifierInfo*, llvm::BumpPtrAllocator>::const_iterator
Reid Spencer5f016e22007-07-11 17:01:13 +0000228 I = HashTable.begin(), E = HashTable.end(); I != E; ++I) {
229 unsigned IdLen = I->getKeyLength();
230 AverageIdentifierSize += IdLen;
231 if (MaxIdentifierLength < IdLen)
232 MaxIdentifierLength = IdLen;
233 }
234
235 fprintf(stderr, "\n*** Identifier Table Stats:\n");
236 fprintf(stderr, "# Identifiers: %d\n", NumIdentifiers);
237 fprintf(stderr, "# Empty Buckets: %d\n", NumEmptyBuckets);
238 fprintf(stderr, "Hash density (#identifiers per bucket): %f\n",
239 NumIdentifiers/(double)NumBuckets);
240 fprintf(stderr, "Ave identifier length: %f\n",
241 (AverageIdentifierSize/(double)NumIdentifiers));
242 fprintf(stderr, "Max identifier length: %d\n", MaxIdentifierLength);
243
244 // Compute statistics about the memory allocated for identifiers.
245 HashTable.getAllocator().PrintStats();
246}
Steve Naroff68d331a2007-09-27 14:38:14 +0000247
Steve Naroff29238a02007-10-05 18:42:47 +0000248//===----------------------------------------------------------------------===//
249// SelectorTable Implementation
250//===----------------------------------------------------------------------===//
251
Chris Lattner85994262007-10-05 20:15:24 +0000252unsigned llvm::DenseMapInfo<clang::Selector>::getHashValue(clang::Selector S) {
253 return DenseMapInfo<void*>::getHashValue(S.getAsOpaquePtr());
254}
255
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000256namespace clang {
Steve Naroff29238a02007-10-05 18:42:47 +0000257/// MultiKeywordSelector - One of these variable length records is kept for each
258/// selector containing more than one keyword. We use a folding set
259/// to unique aggregate names (keyword selectors in ObjC parlance). Access to
260/// this class is provided strictly through Selector.
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000261class MultiKeywordSelector
262 : public DeclarationNameExtra, public llvm::FoldingSetNode {
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000263 MultiKeywordSelector(unsigned nKeys) {
264 ExtraKindOrNumArgs = NUM_EXTRA_KINDS + nKeys;
265 }
Steve Naroff29238a02007-10-05 18:42:47 +0000266public:
Steve Naroff29238a02007-10-05 18:42:47 +0000267 // Constructor for keyword selectors.
268 MultiKeywordSelector(unsigned nKeys, IdentifierInfo **IIV) {
269 assert((nKeys > 1) && "not a multi-keyword selector");
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000270 ExtraKindOrNumArgs = NUM_EXTRA_KINDS + nKeys;
Ted Kremenekbdbb2852007-11-30 22:46:56 +0000271
Steve Naroff29238a02007-10-05 18:42:47 +0000272 // Fill in the trailing keyword array.
273 IdentifierInfo **KeyInfo = reinterpret_cast<IdentifierInfo **>(this+1);
274 for (unsigned i = 0; i != nKeys; ++i)
275 KeyInfo[i] = IIV[i];
Ted Kremenekbdbb2852007-11-30 22:46:56 +0000276 }
277
Chris Lattnerf836e3f2007-10-07 01:33:16 +0000278 // getName - Derive the full selector name and return it.
279 std::string getName() const;
280
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000281 unsigned getNumArgs() const { return ExtraKindOrNumArgs - NUM_EXTRA_KINDS; }
Steve Naroff29238a02007-10-05 18:42:47 +0000282
283 typedef IdentifierInfo *const *keyword_iterator;
284 keyword_iterator keyword_begin() const {
285 return reinterpret_cast<keyword_iterator>(this+1);
286 }
287 keyword_iterator keyword_end() const {
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000288 return keyword_begin()+getNumArgs();
Steve Naroff29238a02007-10-05 18:42:47 +0000289 }
Chris Lattnerf836e3f2007-10-07 01:33:16 +0000290 IdentifierInfo *getIdentifierInfoForSlot(unsigned i) const {
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000291 assert(i < getNumArgs() && "getIdentifierInfoForSlot(): illegal index");
Steve Naroff29238a02007-10-05 18:42:47 +0000292 return keyword_begin()[i];
293 }
294 static void Profile(llvm::FoldingSetNodeID &ID,
295 keyword_iterator ArgTys, unsigned NumArgs) {
296 ID.AddInteger(NumArgs);
Chris Lattnerf836e3f2007-10-07 01:33:16 +0000297 for (unsigned i = 0; i != NumArgs; ++i)
298 ID.AddPointer(ArgTys[i]);
Steve Naroff29238a02007-10-05 18:42:47 +0000299 }
300 void Profile(llvm::FoldingSetNodeID &ID) {
Douglas Gregor2e1cd422008-11-17 14:58:09 +0000301 Profile(ID, keyword_begin(), getNumArgs());
Steve Naroff29238a02007-10-05 18:42:47 +0000302 }
303};
Chris Lattner85994262007-10-05 20:15:24 +0000304} // end namespace clang.
Steve Naroff29238a02007-10-05 18:42:47 +0000305
306unsigned Selector::getNumArgs() const {
307 unsigned IIF = getIdentifierInfoFlag();
308 if (IIF == ZeroArg)
309 return 0;
310 if (IIF == OneArg)
311 return 1;
312 // We point to a MultiKeywordSelector (pointer doesn't contain any flags).
313 MultiKeywordSelector *SI = reinterpret_cast<MultiKeywordSelector *>(InfoPtr);
314 return SI->getNumArgs();
315}
316
Chris Lattnerf836e3f2007-10-07 01:33:16 +0000317IdentifierInfo *Selector::getIdentifierInfoForSlot(unsigned argIndex) const {
318 if (IdentifierInfo *II = getAsIdentifierInfo()) {
319 assert(argIndex == 0 && "illegal keyword index");
Steve Naroff29238a02007-10-05 18:42:47 +0000320 return II;
321 }
322 // We point to a MultiKeywordSelector (pointer doesn't contain any flags).
323 MultiKeywordSelector *SI = reinterpret_cast<MultiKeywordSelector *>(InfoPtr);
324 return SI->getIdentifierInfoForSlot(argIndex);
325}
326
Chris Lattnerf836e3f2007-10-07 01:33:16 +0000327std::string MultiKeywordSelector::getName() const {
328 std::string Result;
329 unsigned Length = 0;
330 for (keyword_iterator I = keyword_begin(), E = keyword_end(); I != E; ++I) {
331 if (*I)
332 Length += (*I)->getLength();
333 ++Length; // :
Steve Naroff29238a02007-10-05 18:42:47 +0000334 }
Chris Lattnerf836e3f2007-10-07 01:33:16 +0000335
336 Result.reserve(Length);
337
338 for (keyword_iterator I = keyword_begin(), E = keyword_end(); I != E; ++I) {
339 if (*I)
340 Result.insert(Result.end(), (*I)->getName(),
341 (*I)->getName()+(*I)->getLength());
342 Result.push_back(':');
343 }
344
345 return Result;
Steve Naroff29238a02007-10-05 18:42:47 +0000346}
347
Chris Lattner077bf5e2008-11-24 03:33:13 +0000348std::string Selector::getAsString() const {
Ted Kremenekf5ed3962009-03-06 23:36:28 +0000349 if (InfoPtr & ArgFlags) {
350 IdentifierInfo *II = getAsIdentifierInfo();
Chris Lattnerf836e3f2007-10-07 01:33:16 +0000351
Ted Kremenek150ec292009-03-07 01:22:02 +0000352 // If the number of arguments is 0 then II is guaranteed to not be null.
Ted Kremenekf5ed3962009-03-06 23:36:28 +0000353 if (getNumArgs() == 0)
Ted Kremenek150ec292009-03-07 01:22:02 +0000354 return II->getName();
Ted Kremenekf5ed3962009-03-06 23:36:28 +0000355
356 std::string Res = II ? II->getName() : "";
Chris Lattnerf836e3f2007-10-07 01:33:16 +0000357 Res += ":";
358 return Res;
Steve Naroff29238a02007-10-05 18:42:47 +0000359 }
Chris Lattnerf836e3f2007-10-07 01:33:16 +0000360
361 // We have a multiple keyword selector (no embedded flags).
362 return reinterpret_cast<MultiKeywordSelector *>(InfoPtr)->getName();
Steve Naroff29238a02007-10-05 18:42:47 +0000363}
364
365
Chris Lattner5f7d2282009-03-04 05:35:38 +0000366namespace {
367 struct SelectorTableImpl {
368 llvm::FoldingSet<MultiKeywordSelector> Table;
369 llvm::BumpPtrAllocator Allocator;
370 };
371} // end anonymous namespace.
372
373static SelectorTableImpl &getSelectorTableImpl(void *P) {
374 return *static_cast<SelectorTableImpl*>(P);
375}
376
377
Chris Lattnerff384912007-10-07 02:00:24 +0000378Selector SelectorTable::getSelector(unsigned nKeys, IdentifierInfo **IIV) {
379 if (nKeys < 2)
380 return Selector(IIV[0], nKeys);
Chris Lattnerf836e3f2007-10-07 01:33:16 +0000381
Chris Lattner5f7d2282009-03-04 05:35:38 +0000382 SelectorTableImpl &SelTabImpl = getSelectorTableImpl(Impl);
Steve Naroff29238a02007-10-05 18:42:47 +0000383
384 // Unique selector, to guarantee there is one per name.
385 llvm::FoldingSetNodeID ID;
386 MultiKeywordSelector::Profile(ID, IIV, nKeys);
387
388 void *InsertPos = 0;
Chris Lattner5f7d2282009-03-04 05:35:38 +0000389 if (MultiKeywordSelector *SI =
390 SelTabImpl.Table.FindNodeOrInsertPos(ID, InsertPos))
Steve Naroff29238a02007-10-05 18:42:47 +0000391 return Selector(SI);
Chris Lattnerf836e3f2007-10-07 01:33:16 +0000392
Steve Naroff29238a02007-10-05 18:42:47 +0000393 // MultiKeywordSelector objects are not allocated with new because they have a
394 // variable size array (for parameter types) at the end of them.
Chris Lattner5f7d2282009-03-04 05:35:38 +0000395 unsigned Size = sizeof(MultiKeywordSelector) + nKeys*sizeof(IdentifierInfo *);
396 MultiKeywordSelector *SI =
397 (MultiKeywordSelector*)SelTabImpl.Allocator.Allocate(Size,
398 llvm::alignof<MultiKeywordSelector>());
Steve Naroff29238a02007-10-05 18:42:47 +0000399 new (SI) MultiKeywordSelector(nKeys, IIV);
Chris Lattner5f7d2282009-03-04 05:35:38 +0000400 SelTabImpl.Table.InsertNode(SI, InsertPos);
Steve Naroff29238a02007-10-05 18:42:47 +0000401 return Selector(SI);
402}
403
Steve Naroff29238a02007-10-05 18:42:47 +0000404SelectorTable::SelectorTable() {
Chris Lattner5f7d2282009-03-04 05:35:38 +0000405 Impl = new SelectorTableImpl();
Steve Naroff29238a02007-10-05 18:42:47 +0000406}
407
408SelectorTable::~SelectorTable() {
Chris Lattner5f7d2282009-03-04 05:35:38 +0000409 delete &getSelectorTableImpl(Impl);
Steve Naroff29238a02007-10-05 18:42:47 +0000410}
411