aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/IdentifierTable.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-11-18 14:39:36 +0000
committerDouglas Gregor <dgregor@apple.com>2008-11-18 14:39:36 +0000
commite94ca9e4371c022329270436b3dd77adc4ddfa8f (patch)
tree88577be07029db31b21b7b0c8e3dbcf593dff4a4 /lib/Basic/IdentifierTable.cpp
parentdb0e15ae3e2b5e180541eec35e2bce54359ca7d8 (diff)
Extend DeclarationName to support C++ overloaded operators, e.g.,
operator+, directly, using the same mechanism as all other special names. Removed the "special" identifiers for the overloaded operators from the identifier table and IdentifierInfo data structure. IdentifierInfo is back to representing only real identifiers. Added a new Action, ActOnOperatorFunctionIdExpr, that builds an expression from an parsed operator-function-id (e.g., "operator +"). ActOnIdentifierExpr used to do this job, but operator-function-ids are no longer represented by IdentifierInfo's. Extended Declarator to store overloaded operator names. Sema::GetNameForDeclarator now knows how to turn the operator name into a DeclarationName for the overloaded operator. Except for (perhaps) consolidating the functionality of ActOnIdentifier, ActOnOperatorFunctionIdExpr, and ActOnConversionFunctionExpr into a common routine that builds an appropriate DeclRefExpr by looking up a DeclarationName, all of the work on normalizing declaration names should be complete with this commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59526 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/IdentifierTable.cpp')
-rw-r--r--lib/Basic/IdentifierTable.cpp22
1 files changed, 0 insertions, 22 deletions
diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp
index 38bdb7e630..1bef76688c 100644
--- a/lib/Basic/IdentifierTable.cpp
+++ b/lib/Basic/IdentifierTable.cpp
@@ -28,7 +28,6 @@ using namespace clang;
IdentifierInfo::IdentifierInfo() {
TokenID = tok::identifier;
ObjCOrBuiltinID = 0;
- OperatorID = 0;
HasMacro = false;
IsExtension = false;
IsPoisoned = false;
@@ -47,7 +46,6 @@ IdentifierTable::IdentifierTable(const LangOptions &LangOpts)
// Populate the identifier table with info about keywords for the current
// language.
AddKeywords(LangOpts);
- AddOverloadedOperators();
}
// This cstor is intended to be used only for serialization.
@@ -163,26 +161,6 @@ void IdentifierTable::AddKeywords(const LangOptions &LangOpts) {
#include "clang/Basic/TokenKinds.def"
}
-/// addOperatorPrefix - Add the prefix "operator" (possible with a
-/// space after it) to the given operator symbol, and return the
-/// result.
-static std::string addOperatorPrefix(const char* Symbol) {
- std::string result = "operator";
- if (Symbol[0] >= 'a' && Symbol[0] <= 'z')
- result += ' ';
- result += Symbol;
- return result;
-}
-
-/// AddOverloadedOperators - Register the name of all C++ overloadable
-/// operators ("operator+", "operator[]", etc.)
-void IdentifierTable::AddOverloadedOperators() {
-#define OVERLOADED_OPERATOR(Name,Spelling,Token, Unary, Binary, MemberOnly) \
- OverloadedOperators[OO_##Name] = &get(addOperatorPrefix(Spelling)); \
- OverloadedOperators[OO_##Name]->setOverloadedOperatorID(OO_##Name);
-#include "clang/Basic/OperatorKinds.def"
-}
-
tok::PPKeywordKind IdentifierInfo::getPPKeywordID() const {
// We use a perfect hash function here involving the length of the keyword,
// the first and third character. For preprocessor ID's there are no