aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/IdentifierTable.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-07 01:47:10 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-07 01:47:10 +0000
commitd42ffbd22fc7eb61321f6a88173ee424991f01c6 (patch)
tree199f47fdbdda8f073c9453d389f46c40885730ad /include/clang/Basic/IdentifierTable.h
parentccb9bac3adb35a2dc78c1737e7b2dc6537a16393 (diff)
Revert my last couple patches until I can get them to not make the tests fail.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/IdentifierTable.h')
-rw-r--r--include/clang/Basic/IdentifierTable.h48
1 files changed, 21 insertions, 27 deletions
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h
index 93651d3d91..32818a9137 100644
--- a/include/clang/Basic/IdentifierTable.h
+++ b/include/clang/Basic/IdentifierTable.h
@@ -267,27 +267,24 @@ public:
HashTable.GetOrCreateValue(NameStart, NameEnd);
IdentifierInfo *II = Entry.getValue();
- if (II) return *II;
- // No entry; if we have an external lookup, look there first.
- if (ExternalLookup) {
- II = ExternalLookup->get(NameStart, NameEnd);
- if (II) {
- // Cache in the StringMap for subsequent lookups.
- Entry.setValue(II);
- return *II;
+ if (!II) {
+ while (1) {
+ if (ExternalLookup) {
+ II = ExternalLookup->get(NameStart, NameEnd);
+ if (II) break;
+ }
+
+ void *Mem = getAllocator().Allocate<IdentifierInfo>();
+ II = new (Mem) IdentifierInfo();
+ break;
}
- }
-
- // Lookups failed, make a new IdentifierInfo.
- void *Mem = getAllocator().Allocate<IdentifierInfo>();
- II = new (Mem) IdentifierInfo();
- Entry.setValue(II);
- // Make sure getName() knows how to find the IdentifierInfo
- // contents.
- II->Entry = &Entry;
+ Entry.setValue(II);
+ II->Entry = &Entry;
+ }
+ assert(II->Entry != 0);
return *II;
}
@@ -337,8 +334,6 @@ private:
/// selectors that take no arguments and selectors that take 1 argument, which
/// accounts for 78% of all selectors in Cocoa.h.
class Selector {
- friend class DiagnosticInfo;
-
enum IdentifierInfoFlag {
// MultiKeywordSelector = 0.
ZeroArg = 0x1,
@@ -358,6 +353,13 @@ class Selector {
assert((InfoPtr & ArgFlags) == 0 &&"Insufficiently aligned IdentifierInfo");
}
Selector(uintptr_t V) : InfoPtr(V) {}
+public:
+ friend class SelectorTable; // only the SelectorTable can create these
+ friend class DeclarationName; // and the AST's DeclarationName.
+
+ /// The default ctor should only be used when creating data structures that
+ /// will contain selectors.
+ Selector() : InfoPtr(0) {}
IdentifierInfo *getAsIdentifierInfo() const {
if (getIdentifierInfoFlag())
@@ -367,14 +369,6 @@ class Selector {
unsigned getIdentifierInfoFlag() const {
return InfoPtr & ArgFlags;
}
-public:
- friend class SelectorTable; // only the SelectorTable can create these
- friend class DeclarationName; // and the AST's DeclarationName.
-
- /// The default ctor should only be used when creating data structures that
- /// will contain selectors.
- Selector() : InfoPtr(0) {}
-
/// operator==/!= - Indicate whether the specified selectors are identical.
bool operator==(Selector RHS) const {
return InfoPtr == RHS.InfoPtr;