summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-08-18 21:59:42 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-08-18 21:59:42 +0000
commit49cc1ccb00df06cc915e0ec5014d04082506f752 (patch)
treec6324f49ad7a51cd6f59da8d64ab2a9c2d291abc /clang/lib/Lex/Preprocessor.cpp
parent4071b1bac37e806848a2e0c52c9747fc843491f5 (diff)
downloadbcm5719-llvm-49cc1ccb00df06cc915e0ec5014d04082506f752.tar.gz
bcm5719-llvm-49cc1ccb00df06cc915e0ec5014d04082506f752.zip
C++ Modules TS: Add parsing support for module import declaration.
llvm-svn: 279163
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 73039373824..096a6107a95 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -712,9 +712,12 @@ bool Preprocessor::HandleIdentifier(Token &Identifier) {
// Note that we do not treat 'import' as a contextual
// keyword when we're in a caching lexer, because caching lexers only get
// used in contexts where import declarations are disallowed.
- if (LastTokenWasAt && II.isModulesImport() && !InMacroArgs &&
- !DisableMacroExpansion &&
- (getLangOpts().Modules || getLangOpts().DebuggerSupport) &&
+ //
+ // Likewise if this is the C++ Modules TS import keyword.
+ if (((LastTokenWasAt && II.isModulesImport()) ||
+ Identifier.is(tok::kw_import)) &&
+ !InMacroArgs && !DisableMacroExpansion &&
+ (getLangOpts().Modules || getLangOpts().DebuggerSupport) &&
CurLexerKind != CLK_CachingLexer) {
ModuleImportLoc = Identifier.getLocation();
ModuleImportPath.clear();
@@ -782,7 +785,8 @@ void Preprocessor::LexAfterModuleImport(Token &Result) {
}
// If we're expecting a '.' or a ';', and we got a '.', then wait until we
- // see the next identifier.
+ // see the next identifier. (We can also see a '[[' that begins an
+ // attribute-specifier-seq here under the C++ Modules TS.)
if (!ModuleImportExpectsIdentifier && Result.getKind() == tok::period) {
ModuleImportExpectsIdentifier = true;
CurLexerKind = CLK_LexAfterModuleImport;
OpenPOWER on IntegriCloud