diff options
Diffstat (limited to 'lib/Basic/IdentifierTable.cpp')
-rw-r--r-- | lib/Basic/IdentifierTable.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp index 8f0387e99e..e17f48ad3b 100644 --- a/lib/Basic/IdentifierTable.cpp +++ b/lib/Basic/IdentifierTable.cpp @@ -28,6 +28,7 @@ using namespace clang; IdentifierInfo::IdentifierInfo() { TokenID = tok::identifier; ObjCOrBuiltinID = 0; + OperatorID = 0; HasMacro = false; IsExtension = false; IsPoisoned = false; @@ -46,6 +47,7 @@ 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. @@ -160,6 +162,15 @@ void IdentifierTable::AddKeywords(const LangOptions &LangOpts) { #include "clang/Basic/TokenKinds.def" } +/// AddOverloadedOperators - Register the name of all C++ overloadable +/// operators ("operator+", "operator[]", etc.) +void IdentifierTable::AddOverloadedOperators() { +#define OVERLOADED_OPERATOR(Name,Spelling,Token) \ + OverloadedOperators[OO_##Name] = &get(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 |