diff options
Diffstat (limited to 'include/clang/Basic/IdentifierTable.h')
-rw-r--r-- | include/clang/Basic/IdentifierTable.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index 1785e04..d672314 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -62,7 +62,7 @@ class IdentifierInfo { // partially) from an AST file. bool ChangedAfterLoad : 1; // True if identifier has changed from the // definition loaded from an AST file. - bool RevertedTokenID : 1; // True if RevertTokenIDToIdentifier was + bool RevertedTokenID : 1; // True if revertTokenIDToIdentifier was // called. bool OutOfDate : 1; // True if there may be additional // information about this identifier @@ -152,7 +152,7 @@ public: /// tokens. tok::TokenKind getTokenID() const { return (tok::TokenKind)TokenID; } - /// \brief True if RevertTokenIDToIdentifier() was called. + /// \brief True if revertTokenIDToIdentifier() was called. bool hasRevertedTokenIDToIdentifier() const { return RevertedTokenID; } /// \brief Revert TokenID to tok::identifier; used for GNU libstdc++ 4.2 @@ -161,11 +161,16 @@ public: /// TokenID is normally read-only but there are 2 instances where we revert it /// to tok::identifier for libstdc++ 4.2. Keep track of when this happens /// using this method so we can inform serialization about it. - void RevertTokenIDToIdentifier() { + void revertTokenIDToIdentifier() { assert(TokenID != tok::identifier && "Already at tok::identifier"); TokenID = tok::identifier; RevertedTokenID = true; } + void revertIdentifierToTokenID(tok::TokenKind TK) { + assert(TokenID == tok::identifier && "Should be at tok::identifier"); + TokenID = TK; + RevertedTokenID = false; + } /// \brief Return the preprocessor keyword ID for this identifier. /// @@ -183,6 +188,18 @@ public: } void setObjCKeywordID(tok::ObjCKeywordKind ID) { ObjCOrBuiltinID = ID; } + /// \brief True if setNotBuiltin() was called. + bool hasRevertedBuiltin() const { + return ObjCOrBuiltinID == tok::NUM_OBJC_KEYWORDS; + } + + /// \brief Revert the identifier to a non-builtin identifier. We do this if + /// the name of a known builtin library function is used to declare that + /// function, but an unexpected type is specified. + void revertBuiltin() { + setBuiltinID(0); + } + /// \brief Return a value indicating whether this is a builtin function. /// /// 0 is not-built-in. 1 is builtin-for-some-nonprimary-target. |