]> granicus.if.org Git - clang/commitdiff
Introduce a non-uglified syntax for module imports in Objective-C:
authorDouglas Gregor <dgregor@apple.com>
Tue, 3 Jan 2012 18:04:46 +0000 (18:04 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 3 Jan 2012 18:04:46 +0000 (18:04 +0000)
  @import identifier [. identifier]* ;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147452 91177308-0d34-0410-b5e6-96231b3b80d8

33 files changed:
include/clang/AST/Decl.h
include/clang/Basic/DiagnosticParseKinds.td
include/clang/Basic/IdentifierTable.h
include/clang/Basic/TokenKinds.def
include/clang/Lex/Preprocessor.h
include/clang/Parse/Parser.h
include/clang/Sema/Sema.h
lib/AST/Decl.cpp
lib/AST/DeclPrinter.cpp
lib/Lex/Preprocessor.cpp
lib/Parse/ParseObjc.cpp
lib/Parse/Parser.cpp
lib/Sema/SemaDecl.cpp
test/Modules/Inputs/category_bottom.h
test/Modules/Inputs/category_left.h
test/Modules/Inputs/category_right.h
test/Modules/Inputs/redecl-merge-bottom.h
test/Modules/Inputs/redecl-merge-left-left.h
test/Modules/Inputs/redecl-merge-left.h
test/Modules/Inputs/redecl-merge-right.h
test/Modules/decldef.mm
test/Modules/header-import.m
test/Modules/inferred-submodules.m
test/Modules/lookup.m
test/Modules/objc-categories.m
test/Modules/on-demand-build-warnings.m
test/Modules/on-demand-build.m
test/Modules/on-demand-macros.m
test/Modules/redecl-merge.m
test/Modules/redeclarations.m
test/Modules/requires.m
test/Modules/subframeworks.m
test/Modules/submodules.m

index c39456d96eb7ca1f87e7e9744f30bde42f68eb76..3cc94ed07989ca3629c3a54a385068a955713089 100644 (file)
@@ -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<SourceLocation> 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<SourceLocation> 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.
index c609cc4457617cc8b7853b643c0d98457ec3af0c..90d4721603fcf139d7639c21dc280ccd7f2dbb5f 100644 (file)
@@ -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">;
 }
index d7d0ded0200a0cc1db44775f76d6bbde98b1b20c..a5eea3281f179d463c5b581b31d1b28d0e4e734b 100644 (file)
@@ -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));
   }
 };
 
index bb905a4ae8517a1ffa62ed9bc4cd8823449d668b..103e0c93d3f11b9c1fc12a4fc987af7252179421 100644 (file)
@@ -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?
index 1716ba3b9ecf425e1b7953d908f7442dcab8ce42..e8f9d6be080d788fe95fae034a888f9eca0064e2 100644 (file)
@@ -162,8 +162,8 @@ class Preprocessor : public llvm::RefCountedBase<Preprocessor> {
   /// 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.
index 7b6042ecf7744853bc28b02560c14e6dc541929a..fca56a8eb8d1cc6eb342b728f7233f332d20d546 100644 (file)
@@ -2127,7 +2127,7 @@ private:
 
   //===--------------------------------------------------------------------===//
   // Modules
-  DeclGroupPtrTy ParseModuleImport();
+  DeclGroupPtrTy ParseModuleImport(SourceLocation AtLoc);
 
   //===--------------------------------------------------------------------===//
   // GNU G++: Type Traits [Type-Traits.html in the GCC manual]
index 947e3fb37431ead597f55ff13767659f916bcdfc..2b7c6a78e7fae3a0104458fc6087d792860b14f9 100644 (file)
@@ -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;
index c1ed43709e222f29a0bb95eadd98ceaf6448779e..31a9b3b2929f50f4fd72d7cd08862b911fc02c0f 100644 (file)
@@ -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<SourceLocation> 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<SourceLocation *>(this + 1) = EndLoc;
 }
 
 ImportDecl *ImportDecl::Create(ASTContext &C, DeclContext *DC, 
-                               SourceLocation ImportLoc, Module *Imported,
+                               SourceLocation StartLoc, Module *Imported,
                                ArrayRef<SourceLocation> 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;
 }
index 73dac3b73e3d065ac08b0c5047bb1476a738226d..33ddd5af41fa3ddfd794698098ee125928931125 100644 (file)
@@ -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";
 }
 
index 08d8b920d1778c3ac829748e4c5afe150a2ad96c..8722be93d35b2a7aaafb278ef1277286946f28fa 100644 (file)
@@ -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.
index 8260d188a341b23583ab8ac2dc2f4e8d7f83ef07..a2994a3312c08d26a13b387f15330221ac635f42 100644 (file)
@@ -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);
index 6914b8e018a8de1f03e8f5d29e7bcd11d87564b8..b96ff388dbccec28243c82e2b7c3b4a840acf173 100644 (file)
@@ -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();
index a1ccf946d6a87faf2ae8415504f65cbad351ed3e..9583ab6327f0a6ef998b7dbfb96785626c54c9ff 100644 (file)
@@ -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;
 }
index 20f7813de60f645637f39f0054e21d3c6631c4c0..ab4c01c3149cdca6dfd65e01139138d061388b8d 100644 (file)
@@ -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;
index d388a032ec0484f5253f9a161d131c2f1584ef83..05e2a1b96c525b37895925a70bd27a308d2667fb 100644 (file)
@@ -1,4 +1,4 @@
-__import_module__ category_top;
+@import category_top;
 
 @interface Foo(Left)
 -(void)left;
index a1a1377653e8347dbf62fa5a3b29ef08adc4e434..48d4f6cd0a8161aff22035e98bddb01cceaaea20 100644 (file)
@@ -1,4 +1,4 @@
-__import_module__ category_top;
+@import category_top;
 
 @interface Foo(Right1)
 -(void)right1;
index 26a1ba5ab176e668f857974e27dd851f77de4bbe..a054cd20596ac453f344bed2614bdb6ca8657f1f 100644 (file)
@@ -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;
 
index 0d7fd6a5145128971f21aff451dde9ec1967bd6f..612608159b2bf6e40c2d0f6e56ce31a11db6f249 100644 (file)
@@ -1,4 +1,4 @@
-__import_module__ redecl_merge_left;
+@import redecl_merge_left;
 
 @class C4;
 void accept_a_C4(C4*);
index 4ea1e70e8e64eab780cac8f51c2de71212d0993e..82146f7ed5036f6f572b96c137541725f4e290f6 100644 (file)
@@ -1,4 +1,4 @@
-__import_module__ redecl_merge_top;
+@import redecl_merge_top;
 
 @class A;
 
index 82051d46f935b0907b433ea757c644f1bd8595e5..b6dfe2f53c94fe6a7faa6769c7c50066c76f3476 100644 (file)
@@ -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;
index 07499b31f7e13adea31b31b5d11dd5fc7a9aeaa2..59361fb5f24efcf2505580e1dac00dbd8e57008d 100644 (file)
 
 // 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;
index 9996dc75c8b749674fac69470a80f507a12e14b0..610a20f5493ab3be761cce33b8575464b8fb79b2 100644 (file)
@@ -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"
 
index 5fe83d2a584b28bfb999d91d0926184b48aa03b0..aeb4aa467c22e9c03afbaac0a1b95dee06370a09 100644 (file)
@@ -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;
index 29713fd769ea7d5640e1cea0fc23b1bd09dfef0c..6de7a115cd3cd06d2900fa4c4a39c0b72dd26985 100644 (file)
@@ -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}}
index 70a6bf8dd1d3e9ebaf90e1e34ea3f770fa8cde25..f571523eb5174733dfd9ef32030acdaf9c5a5560 100644 (file)
@@ -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}}
index aa122dbd85590d59722da41d63d3e257149b272e..1918689afba7d17d8d5542a542187a149335fb9d 100644 (file)
@@ -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}}
 
index 644519b9728bd495b01f129f2603ff6b7a51685f..fbd91b1405c095690bd378db0e89b41c6a351e5b 100644 (file)
@@ -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
 
index 96abb2331f100d9bccdb011068fbb9c2c53e7c0d..2b267f15a0e0cbedef3ffd3b2b2829a363db0012 100644 (file)
@@ -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
index ab264d1c5b0dc4c4b5ffaf5857a70ec3fded429b..dfbc25fe9e7bfbb6f47c7b5cfb71eb0760b10ea3 100644 (file)
@@ -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) {
index c00ca11f508f4f6bc80a83abfc0603490424faa2..bb85f05dfd6432d4b4f9ba1ecb134b639ceb6113 100644 (file)
@@ -1,5 +1,5 @@
-__import_module__ redeclarations_left;
-__import_module__ redeclarations_right;
+@import redeclarations_left;
+@import redeclarations_right;
 
 @interface MyObject : NSObject
 @end
index d08db647400ce3cddc3217da7b0c08274c827504..70d6160b0f3cfffcb9520f6fc028f3c82563d2b0 100644 (file)
@@ -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'}}
 
index 13c8bc07ab9ac29147f226698eacd72461df5bd8..82c4a4bbf2757b424f4b73a5f0189ee456032805 100644 (file)
@@ -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
index bbcd18c6420824abdc8a9920711c0cc234e220b8..908a4785e8e4063a6fe1e5770f179bc21be0d74d 100644 (file)
@@ -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;