aboutsummaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/Basic/IdentifierTable.h27
-rw-r--r--include/clang/Basic/TokenKinds.def1
-rw-r--r--include/clang/Lex/Preprocessor.h4
-rw-r--r--include/clang/Sema/Sema.h5
4 files changed, 28 insertions, 9 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.
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index 53d5f400b3..8c7b0bce3f 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -162,8 +162,8 @@ class Preprocessor : public llvm::RefCountedBase<Preprocessor> {
/// for preprocessing.
SourceLocation CodeCompletionFileLoc;
- /// \brief The source location of the __import_module__ or 'import' keyword we
- /// just lexed, if any.
+ /// \brief The source location of the 'import' contextual keyword we just
+ /// lexed, if any.
SourceLocation ModuleImportLoc;
/// \brief The module import path that we're currently processing.
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 2b7c6a78e7..086bf23dab 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -1120,10 +1120,9 @@ public:
/// \brief The parser has processed a module import declaration.
///
- /// \param AtLoc The location of the '@' symbol, if present.
+ /// \param AtLoc The location of the '@' symbol, if any.
///
- /// \param ImportLoc The location of the '__import_module__' or 'import'
- /// keyword.
+ /// \param ImportLoc The location of the 'import' keyword.
///
/// \param Path The module access path.
DeclResult ActOnModuleImport(SourceLocation AtLoc, SourceLocation ImportLoc,