diff options
Diffstat (limited to 'clang/include/clang/Basic/IdentifierTable.h')
-rw-r--r-- | clang/include/clang/Basic/IdentifierTable.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/clang/include/clang/Basic/IdentifierTable.h b/clang/include/clang/Basic/IdentifierTable.h index 204a0f0cc0a5..f2379c7ddfbd 100644 --- a/clang/include/clang/Basic/IdentifierTable.h +++ b/clang/include/clang/Basic/IdentifierTable.h @@ -40,6 +40,14 @@ class LangOptions; class MultiKeywordSelector; class SourceLocation; +enum class ReservedIdentifierStatus { + NotReserved = 0, + StartsWithUnderscoreAtGlobalScope, + StartsWithDoubleUnderscore, + StartsWithUnderscoreFollowedByCapitalLetter, + ContainsDoubleUnderscore, +}; + /// A simple pair of identifier info and location. using IdentifierLocPair = std::pair<IdentifierInfo *, SourceLocation>; @@ -48,7 +56,7 @@ using IdentifierLocPair = std::pair<IdentifierInfo *, SourceLocation>; /// of a pointer to one of these classes. enum { IdentifierInfoAlignment = 8 }; -static constexpr int ObjCOrBuiltinIDBits = 15; +static constexpr int ObjCOrBuiltinIDBits = 16; /// One of these records is kept for each identifier that /// is lexed. This contains information about whether the token was \#define'd, @@ -385,14 +393,7 @@ public: /// Determine whether \p this is a name reserved for the implementation (C99 /// 7.1.3, C++ [lib.global.names]). - bool isReservedName(bool doubleUnderscoreOnly = false) const { - if (getLength() < 2) - return false; - const char *Name = getNameStart(); - return Name[0] == '_' && - (Name[1] == '_' || - (Name[1] >= 'A' && Name[1] <= 'Z' && !doubleUnderscoreOnly)); - } + ReservedIdentifierStatus isReserved(const LangOptions &LangOpts) const; /// Provide less than operator for lexicographical sorting. bool operator<(const IdentifierInfo &RHS) const { |