diff options
Diffstat (limited to 'include/clang/Basic')
-rw-r--r-- | include/clang/Basic/IdentifierTable.h | 27 | ||||
-rw-r--r-- | include/clang/Basic/TokenKinds.def | 1 |
2 files changed, 24 insertions, 4 deletions
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index a5eea3281f..c41e6da1a0 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -69,7 +69,9 @@ class IdentifierInfo { bool OutOfDate : 1; // True if there may be additional // information about this identifier // stored externally. - // 2 bits left in 32-bit word. + bool IsImport : 1; // True if this is the 'import' contextual + // keyword. + // 1 bit left in 32-bit word. void *FETokenInfo; // Managed by the language front-end. llvm::StringMapEntry<IdentifierInfo*> *Entry; @@ -283,6 +285,18 @@ public: RecomputeNeedsHandleIdentifier(); } + /// \brief Determine whether this is the contextual keyword 'import'. + bool isImport() const { return IsImport; } + + /// \brief Set whether this identifier is the contextual keyword 'import'. + void setImport(bool I) { + IsImport = I; + if (I) + NeedsHandleIdentifier = true; + else + RecomputeNeedsHandleIdentifier(); + } + private: /// RecomputeNeedsHandleIdentifier - The Preprocessor::HandleIdentifier does /// several special (but rare) things to identifiers of various sorts. For @@ -295,8 +309,7 @@ private: NeedsHandleIdentifier = (isPoisoned() | hasMacroDefinition() | isCPlusPlusOperatorKeyword() | isExtensionToken() | isCXX11CompatKeyword() || isOutOfDate() || - (getTokenID() == tok::kw___import_module__) || - (getObjCKeywordID() == tok::objc_import)); + isImport()); } }; @@ -447,6 +460,10 @@ public: // contents. II->Entry = &Entry; + // If this is the 'import' contextual keyword, mark it as such. + if (Name.equals("import")) + II->setImport(true); + return *II; } @@ -478,6 +495,10 @@ public: // Make sure getName() knows how to find the IdentifierInfo // contents. II->Entry = &Entry; + + // If this is the 'import' contextual keyword, mark it as such. + if (Name.equals("import")) + II->setImport(true); } return *II; diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def index 277ed84ed6..7841c201b8 100644 --- a/include/clang/Basic/TokenKinds.def +++ b/include/clang/Basic/TokenKinds.def @@ -405,7 +405,6 @@ KEYWORD(__array_extent , KEYCXX) // Apple Extension. KEYWORD(__private_extern__ , KEYALL) -KEYWORD(__import_module__ , KEYALL) KEYWORD(__module_private__ , KEYALL) // Microsoft Extension. |