summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/IdentifierTable.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-11-17 14:58:09 +0000
committerDouglas Gregor <dgregor@apple.com>2008-11-17 14:58:09 +0000
commit77324f385482d592ef54b286ffbb00f47b9259ac (patch)
tree7c60f2f71c6e87fbc3242d87e24cf4b23cd9d435 /clang/lib/Basic/IdentifierTable.cpp
parentd1f5e5d30458080f3591251d29bd6758f667a448 (diff)
downloadbcm5719-llvm-77324f385482d592ef54b286ffbb00f47b9259ac.tar.gz
bcm5719-llvm-77324f385482d592ef54b286ffbb00f47b9259ac.zip
Introduction the DeclarationName class, as a single, general method of
representing the names of declarations in the C family of languages. DeclarationName is used in NamedDecl to store the name of the declaration (naturally), and ObjCMethodDecl is now a NamedDecl. llvm-svn: 59441
Diffstat (limited to 'clang/lib/Basic/IdentifierTable.cpp')
-rw-r--r--clang/lib/Basic/IdentifierTable.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp
index 4d737c50bc0..b83266d1ff8 100644
--- a/clang/lib/Basic/IdentifierTable.cpp
+++ b/clang/lib/Basic/IdentifierTable.cpp
@@ -297,22 +297,22 @@ unsigned llvm::DenseMapInfo<clang::Selector>::getHashValue(clang::Selector S) {
return DenseMapInfo<void*>::getHashValue(S.getAsOpaquePtr());
}
-
+namespace clang {
/// MultiKeywordSelector - One of these variable length records is kept for each
/// selector containing more than one keyword. We use a folding set
/// to unique aggregate names (keyword selectors in ObjC parlance). Access to
/// this class is provided strictly through Selector.
-namespace clang {
-class MultiKeywordSelector : public llvm::FoldingSetNode {
+class MultiKeywordSelector
+ : public DeclarationNameExtra, public llvm::FoldingSetNode {
friend SelectorTable* SelectorTable::CreateAndRegister(llvm::Deserializer&);
- MultiKeywordSelector(unsigned nKeys) : NumArgs(nKeys) {}
+ MultiKeywordSelector(unsigned nKeys) {
+ ExtraKindOrNumArgs = NUM_EXTRA_KINDS + nKeys;
+ }
public:
- unsigned NumArgs;
-
// Constructor for keyword selectors.
MultiKeywordSelector(unsigned nKeys, IdentifierInfo **IIV) {
assert((nKeys > 1) && "not a multi-keyword selector");
- NumArgs = nKeys;
+ ExtraKindOrNumArgs = NUM_EXTRA_KINDS + nKeys;
// Fill in the trailing keyword array.
IdentifierInfo **KeyInfo = reinterpret_cast<IdentifierInfo **>(this+1);
@@ -323,17 +323,17 @@ public:
// getName - Derive the full selector name and return it.
std::string getName() const;
- unsigned getNumArgs() const { return NumArgs; }
+ unsigned getNumArgs() const { return ExtraKindOrNumArgs - NUM_EXTRA_KINDS; }
typedef IdentifierInfo *const *keyword_iterator;
keyword_iterator keyword_begin() const {
return reinterpret_cast<keyword_iterator>(this+1);
}
keyword_iterator keyword_end() const {
- return keyword_begin()+NumArgs;
+ return keyword_begin()+getNumArgs();
}
IdentifierInfo *getIdentifierInfoForSlot(unsigned i) const {
- assert(i < NumArgs && "getIdentifierInfoForSlot(): illegal index");
+ assert(i < getNumArgs() && "getIdentifierInfoForSlot(): illegal index");
return keyword_begin()[i];
}
static void Profile(llvm::FoldingSetNodeID &ID,
@@ -343,7 +343,7 @@ public:
ID.AddPointer(ArgTys[i]);
}
void Profile(llvm::FoldingSetNodeID &ID) {
- Profile(ID, keyword_begin(), NumArgs);
+ Profile(ID, keyword_begin(), getNumArgs());
}
};
} // end namespace clang.
OpenPOWER on IntegriCloud