diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-01-03 19:32:59 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-01-03 19:32:59 +0000 |
commit | da82e703d1d9e39fd5acdf18e06855e452c87984 (patch) | |
tree | c148834214171b1c8467de34396e2601d68d646a /clang/lib/Lex/Preprocessor.cpp | |
parent | c2f91c37e83a54c649582120827a25862a10f312 (diff) | |
download | llvm-da82e703d1d9e39fd5acdf18e06855e452c87984.zip llvm-da82e703d1d9e39fd5acdf18e06855e452c87984.tar.gz llvm-da82e703d1d9e39fd5acdf18e06855e452c87984.tar.bz2 |
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.
llvm-svn: 147467
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 8722be9..046b0df 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -548,11 +548,9 @@ void Preprocessor::HandleIdentifier(Token &Identifier) { if (II.isExtensionToken() && !DisableMacroExpansion) Diag(Identifier, diag::ext_token_used); - // If this is the '__import_module__' or 'import' keyword, note that the next - // token indicates a module name. - if ((II.getTokenID() == tok::kw___import_module__ || - II.getObjCKeywordID() == tok::objc_import) && - !InMacroArgs && !DisableMacroExpansion) { + // If this is the 'import' contextual keyword, note that the next token + // indicates a module name. + if (II.isImport() && !InMacroArgs && !DisableMacroExpansion) { ModuleImportLoc = Identifier.getLocation(); ModuleImportPath.clear(); ModuleImportExpectsIdentifier = true; @@ -560,7 +558,7 @@ void Preprocessor::HandleIdentifier(Token &Identifier) { } } -/// \brief Lex a token following the __import_module__ or 'import' keyword. +/// \brief Lex a token following the 'import' contextual keyword. /// void Preprocessor::LexAfterModuleImport(Token &Result) { // Figure out what kind of lexer we actually have. @@ -578,14 +576,10 @@ void Preprocessor::LexAfterModuleImport(Token &Result) { // The token sequence // - // __import_module__ identifier (. identifier)* - // - // or - // // import identifier (. identifier)* // - // indicates a module import directive. We already saw the __import_module__ - // or 'import' keyword, so now we're looking for the identifiers. + // indicates a module import directive. We already saw the 'import' + // contextual keyword, so now we're looking for the identifiers. if (ModuleImportExpectsIdentifier && Result.getKind() == tok::identifier) { // We expected to see an identifier here, and we did; continue handling // identifiers. |