aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/IdentifierTable.h
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-03 19:32:59 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-03 19:32:59 +0000
commitc13a34b690d2dc2a03c2fea75a0a1438636c19ce (patch)
tree20cdb1b697928adbdefe4435eff3f584e4df85df /include/clang/Basic/IdentifierTable.h
parentf84d560fc73c9177af9081a0edf6726e43ec3a63 (diff)
Eliminate the uglified keyword __import_module__ for importing
modules. This leaves us without an explicit syntax for importing modules in C/C++, because such a syntax needs to be discussed first. In Objective-C/Objective-C++, the @import syntax is used to import modules. Note that, under -fmodules, C/C++ programs can import modules via the #include mechanism when a module map is in place for that header. This allows us to work with modules in C/C++ without committing to a syntax. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147467 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/IdentifierTable.h')
-rw-r--r--include/clang/Basic/IdentifierTable.h27
1 files changed, 24 insertions, 3 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;