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/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index c1ed437..31a9b3b 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -2755,10 +2755,10 @@
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 @@
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;
}
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp
index 73dac3b..33ddd5a 100644
--- a/lib/AST/DeclPrinter.cpp
+++ b/lib/AST/DeclPrinter.cpp
@@ -647,7 +647,7 @@
}
void DeclPrinter::VisitImportDecl(ImportDecl *D) {
- Out << "__import_module__ " << D->getImportedModule()->getFullModuleName()
+ Out << "@import " << D->getImportedModule()->getFullModuleName()
<< ";\n";
}