From: Douglas Gregor Date: Tue, 3 Jan 2012 18:04:46 +0000 (+0000) Subject: Introduce a non-uglified syntax for module imports in Objective-C: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5948ae1021122164b22f74353bb7fe325a64f616;p=clang Introduce a non-uglified syntax for module imports in Objective-C: @import identifier [. identifier]* ; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147452 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index c39456d96e..3cc94ed079 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -3058,7 +3058,7 @@ public: /// /// An import declaration imports the named module (or submodule). For example: /// \code -/// __import_module__ std.vector; +/// @import std.vector; /// \endcode /// /// Import declarations can also be implicitly generated from #include/#import @@ -3080,10 +3080,10 @@ class ImportDecl : public Decl { friend class ASTDeclReader; friend class ASTContext; - ImportDecl(DeclContext *DC, SourceLocation ImportLoc, Module *Imported, + ImportDecl(DeclContext *DC, SourceLocation StartLoc, Module *Imported, ArrayRef IdentifierLocs); - ImportDecl(DeclContext *DC, SourceLocation ImportLoc, Module *Imported, + ImportDecl(DeclContext *DC, SourceLocation StartLoc, Module *Imported, SourceLocation EndLoc); ImportDecl(EmptyShell Empty) : Decl(Import, Empty), NextLocalImport() { } @@ -3091,13 +3091,13 @@ class ImportDecl : public Decl { public: /// \brief Create a new module import declaration. static ImportDecl *Create(ASTContext &C, DeclContext *DC, - SourceLocation ImportLoc, Module *Imported, + SourceLocation StartLoc, Module *Imported, ArrayRef IdentifierLocs); /// \brief Create a new module import declaration for an implicitly-generated /// import. static ImportDecl *CreateImplicit(ASTContext &C, DeclContext *DC, - SourceLocation ImportLoc, Module *Imported, + SourceLocation StartLoc, Module *Imported, SourceLocation EndLoc); /// \brief Create a new module import declaration. diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index c609cc4457..90d4721603 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -689,7 +689,7 @@ def err_seh___finally_block : Error< let CategoryName = "Modules Issue" in { def err_module_expected_ident : Error< - "expected a module name after '__import_module__'">; + "expected a module name after module import">; def err_module_expected_semi : Error< "expected a semicolon name after module name">; } diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index d7d0ded020..a5eea3281f 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -295,7 +295,8 @@ private: NeedsHandleIdentifier = (isPoisoned() | hasMacroDefinition() | isCPlusPlusOperatorKeyword() | isExtensionToken() | isCXX11CompatKeyword() || isOutOfDate() || - (getTokenID() == tok::kw___import_module__)); + (getTokenID() == tok::kw___import_module__) || + (getObjCKeywordID() == tok::objc_import)); } }; diff --git a/include/clang/Basic/TokenKinds.def b/include/clang/Basic/TokenKinds.def index bb905a4ae8..103e0c93d3 100644 --- a/include/clang/Basic/TokenKinds.def +++ b/include/clang/Basic/TokenKinds.def @@ -548,6 +548,7 @@ OBJC2_AT_KEYWORD(required) OBJC2_AT_KEYWORD(optional) OBJC2_AT_KEYWORD(synthesize) OBJC2_AT_KEYWORD(dynamic) +OBJC2_AT_KEYWORD(import) // TODO: What to do about context-sensitive keywords like: // bycopy/byref/in/inout/oneway/out? diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index 1716ba3b9e..e8f9d6be08 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -162,8 +162,8 @@ class Preprocessor : public llvm::RefCountedBase { /// for preprocessing. SourceLocation CodeCompletionFileLoc; - /// \brief The source location of the __import_module__ keyword we just - /// lexed, if any. + /// \brief The source location of the __import_module__ or 'import' keyword we + /// just lexed, if any. SourceLocation ModuleImportLoc; /// \brief The module import path that we're currently processing. diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 7b6042ecf7..fca56a8eb8 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -2127,7 +2127,7 @@ private: //===--------------------------------------------------------------------===// // Modules - DeclGroupPtrTy ParseModuleImport(); + DeclGroupPtrTy ParseModuleImport(SourceLocation AtLoc); //===--------------------------------------------------------------------===// // GNU G++: Type Traits [Type-Traits.html in the GCC manual] diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 947e3fb374..2b7c6a78e7 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -1120,10 +1120,14 @@ public: /// \brief The parser has processed a module import declaration. /// - /// \param ImportLoc The location of the '__import_module__' keyword. + /// \param AtLoc The location of the '@' symbol, if present. + /// + /// \param ImportLoc The location of the '__import_module__' or 'import' + /// keyword. /// /// \param Path The module access path. - DeclResult ActOnModuleImport(SourceLocation ImportLoc, ModuleIdPath Path); + DeclResult ActOnModuleImport(SourceLocation AtLoc, SourceLocation ImportLoc, + ModuleIdPath Path); /// \brief Retrieve a suitable printing policy. PrintingPolicy getPrintingPolicy() const; diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index c1ed43709e..31a9b3b292 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -2755,10 +2755,10 @@ static unsigned getNumModuleIdentifiers(Module *Mod) { return Result; } -ImportDecl::ImportDecl(DeclContext *DC, SourceLocation ImportLoc, +ImportDecl::ImportDecl(DeclContext *DC, SourceLocation StartLoc, Module *Imported, ArrayRef IdentifierLocs) - : Decl(Import, DC, ImportLoc), ImportedAndComplete(Imported, true), + : Decl(Import, DC, StartLoc), ImportedAndComplete(Imported, true), NextLocalImport() { assert(getNumModuleIdentifiers(Imported) == IdentifierLocs.size()); @@ -2767,28 +2767,28 @@ ImportDecl::ImportDecl(DeclContext *DC, SourceLocation ImportLoc, IdentifierLocs.size() * sizeof(SourceLocation)); } -ImportDecl::ImportDecl(DeclContext *DC, SourceLocation ImportLoc, +ImportDecl::ImportDecl(DeclContext *DC, SourceLocation StartLoc, Module *Imported, SourceLocation EndLoc) - : Decl(Import, DC, ImportLoc), ImportedAndComplete(Imported, false), + : Decl(Import, DC, StartLoc), ImportedAndComplete(Imported, false), NextLocalImport() { *reinterpret_cast(this + 1) = EndLoc; } ImportDecl *ImportDecl::Create(ASTContext &C, DeclContext *DC, - SourceLocation ImportLoc, Module *Imported, + SourceLocation StartLoc, Module *Imported, ArrayRef IdentifierLocs) { void *Mem = C.Allocate(sizeof(ImportDecl) + IdentifierLocs.size() * sizeof(SourceLocation)); - return new (Mem) ImportDecl(DC, ImportLoc, Imported, IdentifierLocs); + return new (Mem) ImportDecl(DC, StartLoc, Imported, IdentifierLocs); } ImportDecl *ImportDecl::CreateImplicit(ASTContext &C, DeclContext *DC, - SourceLocation ImportLoc, + SourceLocation StartLoc, Module *Imported, SourceLocation EndLoc) { void *Mem = C.Allocate(sizeof(ImportDecl) + sizeof(SourceLocation)); - ImportDecl *Import = new (Mem) ImportDecl(DC, ImportLoc, Imported, EndLoc); + ImportDecl *Import = new (Mem) ImportDecl(DC, StartLoc, Imported, EndLoc); Import->setImplicit(); return Import; } diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index 73dac3b73e..33ddd5af41 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -647,7 +647,7 @@ void DeclPrinter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) { } void DeclPrinter::VisitImportDecl(ImportDecl *D) { - Out << "__import_module__ " << D->getImportedModule()->getFullModuleName() + Out << "@import " << D->getImportedModule()->getFullModuleName() << ";\n"; } diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 08d8b920d1..8722be93d3 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -548,9 +548,10 @@ void Preprocessor::HandleIdentifier(Token &Identifier) { if (II.isExtensionToken() && !DisableMacroExpansion) Diag(Identifier, diag::ext_token_used); - // If this is the '__import_module__' keyword, note that the next token - // indicates a module name. - if (II.getTokenID() == tok::kw___import_module__ && + // 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) { ModuleImportLoc = Identifier.getLocation(); ModuleImportPath.clear(); @@ -559,7 +560,8 @@ void Preprocessor::HandleIdentifier(Token &Identifier) { } } -/// \brief Lex a token following the __import_module__ keyword. +/// \brief Lex a token following the __import_module__ or 'import' keyword. +/// void Preprocessor::LexAfterModuleImport(Token &Result) { // Figure out what kind of lexer we actually have. if (CurLexer) @@ -578,8 +580,12 @@ void Preprocessor::LexAfterModuleImport(Token &Result) { // // __import_module__ identifier (. identifier)* // + // or + // + // import identifier (. identifier)* + // // indicates a module import directive. We already saw the __import_module__ - // keyword, so now we're looking for the identifiers. + // or 'import' 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. diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 8260d188a3..a2994a3312 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -66,6 +66,8 @@ Parser::DeclGroupPtrTy Parser::ParseObjCAtDirectives() { case tok::objc_dynamic: SingleDecl = ParseObjCPropertyDynamic(AtLoc); break; + case tok::objc_import: + return ParseModuleImport(AtLoc); default: Diag(AtLoc, diag::err_unexpected_at); SkipUntil(tok::semi); diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 6914b8e018..b96ff388db 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -668,7 +668,7 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs, return DeclGroupPtrTy(); case tok::kw___import_module__: - return ParseModuleImport(); + return ParseModuleImport(SourceLocation()); default: dont_know: @@ -1569,8 +1569,9 @@ void Parser::ParseMicrosoftIfExistsExternalDeclaration() { Braces.consumeClose(); } -Parser::DeclGroupPtrTy Parser::ParseModuleImport() { - assert(Tok.is(tok::kw___import_module__) && +Parser::DeclGroupPtrTy Parser::ParseModuleImport(SourceLocation AtLoc) { + assert((Tok.is(tok::kw___import_module__) || + Tok.isObjCAtKeyword(tok::objc_import)) && "Improper start to module import"); SourceLocation ImportLoc = ConsumeToken(); @@ -1596,7 +1597,7 @@ Parser::DeclGroupPtrTy Parser::ParseModuleImport() { break; } while (true); - DeclResult Import = Actions.ActOnModuleImport(ImportLoc, Path); + DeclResult Import = Actions.ActOnModuleImport(AtLoc, ImportLoc, Path); ExpectAndConsumeSemi(diag::err_module_expected_semi); if (Import.isInvalid()) return DeclGroupPtrTy(); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index a1ccf946d6..9583ab6327 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -9896,7 +9896,9 @@ Decl *Sema::ActOnFileScopeAsmDecl(Expr *expr, return New; } -DeclResult Sema::ActOnModuleImport(SourceLocation ImportLoc, ModuleIdPath Path) { +DeclResult Sema::ActOnModuleImport(SourceLocation AtLoc, + SourceLocation ImportLoc, + ModuleIdPath Path) { Module *Mod = PP.getModuleLoader().loadModule(ImportLoc, Path, Module::AllVisible, /*IsIncludeDirective=*/false); @@ -9917,8 +9919,8 @@ DeclResult Sema::ActOnModuleImport(SourceLocation ImportLoc, ModuleIdPath Path) ImportDecl *Import = ImportDecl::Create(Context, Context.getTranslationUnitDecl(), - ImportLoc, Mod, - IdentifierLocs); + AtLoc.isValid()? AtLoc : ImportLoc, + Mod, IdentifierLocs); Context.getTranslationUnitDecl()->addDecl(Import); return Import; } diff --git a/test/Modules/Inputs/category_bottom.h b/test/Modules/Inputs/category_bottom.h index 20f7813de6..ab4c01c314 100644 --- a/test/Modules/Inputs/category_bottom.h +++ b/test/Modules/Inputs/category_bottom.h @@ -1,10 +1,10 @@ -__import_module__ category_left; +@import category_left; @interface Foo(Bottom) -(void)bottom; @end -__import_module__ category_right; +@import category_right; @interface LeftFoo(Bottom) -(void)bottom; diff --git a/test/Modules/Inputs/category_left.h b/test/Modules/Inputs/category_left.h index d388a032ec..05e2a1b96c 100644 --- a/test/Modules/Inputs/category_left.h +++ b/test/Modules/Inputs/category_left.h @@ -1,4 +1,4 @@ -__import_module__ category_top; +@import category_top; @interface Foo(Left) -(void)left; diff --git a/test/Modules/Inputs/category_right.h b/test/Modules/Inputs/category_right.h index a1a1377653..48d4f6cd0a 100644 --- a/test/Modules/Inputs/category_right.h +++ b/test/Modules/Inputs/category_right.h @@ -1,4 +1,4 @@ -__import_module__ category_top; +@import category_top; @interface Foo(Right1) -(void)right1; diff --git a/test/Modules/Inputs/redecl-merge-bottom.h b/test/Modules/Inputs/redecl-merge-bottom.h index 26a1ba5ab1..a054cd2059 100644 --- a/test/Modules/Inputs/redecl-merge-bottom.h +++ b/test/Modules/Inputs/redecl-merge-bottom.h @@ -1,11 +1,11 @@ -__import_module__ redecl_merge_left; +@import redecl_merge_left; @class C4; @class C4; @protocol P4; @protocol P4; @protocol P4; -__import_module__ redecl_merge_right; +@import redecl_merge_right; @class B; diff --git a/test/Modules/Inputs/redecl-merge-left-left.h b/test/Modules/Inputs/redecl-merge-left-left.h index 0d7fd6a514..612608159b 100644 --- a/test/Modules/Inputs/redecl-merge-left-left.h +++ b/test/Modules/Inputs/redecl-merge-left-left.h @@ -1,4 +1,4 @@ -__import_module__ redecl_merge_left; +@import redecl_merge_left; @class C4; void accept_a_C4(C4*); diff --git a/test/Modules/Inputs/redecl-merge-left.h b/test/Modules/Inputs/redecl-merge-left.h index 4ea1e70e8e..82146f7ed5 100644 --- a/test/Modules/Inputs/redecl-merge-left.h +++ b/test/Modules/Inputs/redecl-merge-left.h @@ -1,4 +1,4 @@ -__import_module__ redecl_merge_top; +@import redecl_merge_top; @class A; diff --git a/test/Modules/Inputs/redecl-merge-right.h b/test/Modules/Inputs/redecl-merge-right.h index 82051d46f9..b6dfe2f53c 100644 --- a/test/Modules/Inputs/redecl-merge-right.h +++ b/test/Modules/Inputs/redecl-merge-right.h @@ -1,4 +1,4 @@ -__import_module__ redecl_merge_top; +@import redecl_merge_top; @interface Super @end @@ -55,5 +55,5 @@ public: #endif int ONE; -__import_module__ redecl_merge_top.Explicit; +@import redecl_merge_top.Explicit; const int one = ONE; diff --git a/test/Modules/decldef.mm b/test/Modules/decldef.mm index 07499b31f7..59361fb5f2 100644 --- a/test/Modules/decldef.mm +++ b/test/Modules/decldef.mm @@ -10,10 +10,10 @@ // in other file: expected-note{{previous definition is here}} -__import_module__ decldef; +@import decldef; A *a1; // expected-error{{unknown type name 'A'}} B *b1; // expected-error{{unknown type name 'B'}} -__import_module__ decldef.Decl; +@import decldef.Decl; A *a2; B *b; diff --git a/test/Modules/header-import.m b/test/Modules/header-import.m index 9996dc75c8..610a20f549 100644 --- a/test/Modules/header-import.m +++ b/test/Modules/header-import.m @@ -2,6 +2,6 @@ // RUN: %clang_cc1 -fmodule-cache-path %t -F %S/Inputs -I %S/Inputs -verify %s #import "point.h" -__import_module__ Module; +@import Module; #import "point.h" diff --git a/test/Modules/inferred-submodules.m b/test/Modules/inferred-submodules.m index 5fe83d2a58..aeb4aa467c 100644 --- a/test/Modules/inferred-submodules.m +++ b/test/Modules/inferred-submodules.m @@ -1,13 +1,13 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -x objective-c -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify -__import_module__ Module.Sub; +@import Module.Sub; void test_Module_Sub() { int *ip = Module_Sub; } -__import_module__ Module.Buried.Treasure; +@import Module.Buried.Treasure; void dig() { unsigned *up = Buried_Treasure; diff --git a/test/Modules/lookup.m b/test/Modules/lookup.m index 29713fd769..6de7a115cd 100644 --- a/test/Modules/lookup.m +++ b/test/Modules/lookup.m @@ -1,8 +1,8 @@ // lookup_left.h: expected-note{{using}} // lookup_right.h: expected-note{{also found}} -__import_module__ lookup_left_objc; -__import_module__ lookup_right_objc; +@import lookup_left_objc; +@import lookup_right_objc; void test(id x) { [x method]; // expected-warning{{multiple methods named 'method' found}} diff --git a/test/Modules/objc-categories.m b/test/Modules/objc-categories.m index 70a6bf8dd1..f571523eb5 100644 --- a/test/Modules/objc-categories.m +++ b/test/Modules/objc-categories.m @@ -5,7 +5,7 @@ // RUN: %clang_cc1 -fmodule-cache-path %t -x objective-c -fmodule-name=category_bottom -emit-module %S/Inputs/module.map // RUN: %clang_cc1 -fmodule-cache-path %t %s -verify -__import_module__ category_bottom; +@import category_bottom; // in category_left.h: expected-note {{previous definition}} diff --git a/test/Modules/on-demand-build-warnings.m b/test/Modules/on-demand-build-warnings.m index aa122dbd85..1918689afb 100644 --- a/test/Modules/on-demand-build-warnings.m +++ b/test/Modules/on-demand-build-warnings.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fno-objc-infer-related-result-type -Wmodule-build -fmodule-cache-path %t -F %S/Inputs -verify %s -__import_module__ Module; // expected-warning{{building module 'Module' from source}} +@import Module; // expected-warning{{building module 'Module' from source}} diff --git a/test/Modules/on-demand-build.m b/test/Modules/on-demand-build.m index 644519b972..fbd91b1405 100644 --- a/test/Modules/on-demand-build.m +++ b/test/Modules/on-demand-build.m @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -x objective-c++ -fmodule-cache-path %t -F %S/Inputs -verify %s // RUN: %clang_cc1 -fno-objc-infer-related-result-type -Werror -Wno-error=incomplete-umbrella -fmodule-cache-path %t -F %S/Inputs -verify %s #define FOO -__import_module__ Module; +@import Module; @interface OtherClass @end diff --git a/test/Modules/on-demand-macros.m b/test/Modules/on-demand-macros.m index 96abb2331f..2b267f15a0 100644 --- a/test/Modules/on-demand-macros.m +++ b/test/Modules/on-demand-macros.m @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fmodule-cache-path %t -F %S/Inputs -DFOO_RETURNS_INT_PTR -verify %s // RUN: %clang_cc1 -fmodule-cache-path %t -F %S/Inputs -verify %s -__import_module__ CmdLine; +@import CmdLine; void test() { #ifdef FOO_RETURNS_INT_PTR diff --git a/test/Modules/redecl-merge.m b/test/Modules/redecl-merge.m index ab264d1c5b..dfbc25fe9e 100644 --- a/test/Modules/redecl-merge.m +++ b/test/Modules/redecl-merge.m @@ -4,12 +4,12 @@ @class C2; @class C3; @class C3; -__import_module__ redecl_merge_left; +@import redecl_merge_left; @protocol P4; @class C3; @class C3; -__import_module__ redecl_merge_right; +@import redecl_merge_right; @implementation A - (Super*)init { return self; } @@ -62,14 +62,14 @@ void test_C3(C3 *c3) { } C4 *global_C4; -__import_module__ redecl_merge_left_left; +@import redecl_merge_left_left; void test_C4a(C4 *c4) { global_C4 = c4 = get_a_C4(); accept_a_C4(c4); } -__import_module__ redecl_merge_bottom; +@import redecl_merge_bottom; void test_C4b() { if (&refers_to_C4) { diff --git a/test/Modules/redeclarations.m b/test/Modules/redeclarations.m index c00ca11f50..bb85f05dfd 100644 --- a/test/Modules/redeclarations.m +++ b/test/Modules/redeclarations.m @@ -1,5 +1,5 @@ -__import_module__ redeclarations_left; -__import_module__ redeclarations_right; +@import redeclarations_left; +@import redeclarations_right; @interface MyObject : NSObject @end diff --git a/test/Modules/requires.m b/test/Modules/requires.m index d08db64740..70d6160b0f 100644 --- a/test/Modules/requires.m +++ b/test/Modules/requires.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify -__import_module__ DependsOnModule.CXX; // expected-error{{module 'DependsOnModule.CXX' requires feature 'cplusplus'}} +@import DependsOnModule.CXX; // expected-error{{module 'DependsOnModule.CXX' requires feature 'cplusplus'}} diff --git a/test/Modules/subframeworks.m b/test/Modules/subframeworks.m index 13c8bc07ab..82c4a4bbf2 100644 --- a/test/Modules/subframeworks.m +++ b/test/Modules/subframeworks.m @@ -2,13 +2,13 @@ // RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify // RUN: %clang_cc1 -x objective-c++ -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify -__import_module__ DependsOnModule; +@import DependsOnModule; void testSubFramework() { float *sf1 = sub_framework; // expected-error{{use of undeclared identifier 'sub_framework'}} } -__import_module__ DependsOnModule.SubFramework; +@import DependsOnModule.SubFramework; void testSubFrameworkAgain() { float *sf2 = sub_framework; @@ -16,7 +16,7 @@ void testSubFrameworkAgain() { } #ifdef __cplusplus -__import_module__ DependsOnModule.CXX; +@import DependsOnModule.CXX; CXXOnly cxxonly; #endif diff --git a/test/Modules/submodules.m b/test/Modules/submodules.m index bbcd18c642..908a4785e8 100644 --- a/test/Modules/submodules.m +++ b/test/Modules/submodules.m @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -Wauto-import -fmodule-cache-path %t -fmodules -F %S/Inputs %s -verify // Note: transitively imports Module.Sub2. -__import_module__ Module.Sub; +@import Module.Sub; int getValue() { return *Module_Sub + *Module_Sub2;