[cfe-commits] r147467 - in /cfe/trunk: include/clang/Basic/ include/clang/Lex/ include/clang/Sema/ lib/Basic/ lib/Lex/ lib/Parse/ test/Modules/ test/Modules/Inputs/ test/Modules/Inputs/MutuallyRecursive1.framework/Headers/ test/Modules/Inputs/Mut
Matt Beaumont-Gay
matthewbg at google.com
Tue Jan 3 16:48:52 PST 2012
Hi Doug,
At this revision, clang rejects code which uses 'import' as a local
variable name:
$ cat ~/test.cc
void f() {
int import;
}
$ ./bin/clang -fsyntax-only ~/test.cc
/home/matthewbg/test.cc:2:7: fatal error: module 'import' not found
int import;
^~~~~~
1 error generated.
-Matt
On Tue, Jan 3, 2012 at 11:33, Douglas Gregor <dgregor at apple.com> wrote:
> Author: dgregor
> Date: Tue Jan 3 13:32:59 2012
> New Revision: 147467
>
> URL: http://llvm.org/viewvc/llvm-project?rev=147467&view=rev
> Log:
> 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.
>
>
> Modified:
> cfe/trunk/include/clang/Basic/IdentifierTable.h
> cfe/trunk/include/clang/Basic/TokenKinds.def
> cfe/trunk/include/clang/Lex/Preprocessor.h
> cfe/trunk/include/clang/Sema/Sema.h
> cfe/trunk/lib/Basic/IdentifierTable.cpp
> cfe/trunk/lib/Lex/PPDirectives.cpp
> cfe/trunk/lib/Lex/Preprocessor.cpp
> cfe/trunk/lib/Parse/Parser.cpp
> cfe/trunk/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h
> cfe/trunk/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h
> cfe/trunk/test/Modules/Inputs/diamond.h
> cfe/trunk/test/Modules/Inputs/diamond_bottom.h
> cfe/trunk/test/Modules/Inputs/diamond_left.h
> cfe/trunk/test/Modules/Inputs/diamond_right.h
> cfe/trunk/test/Modules/Inputs/wildcard-submodule-exports/C_one.h
> cfe/trunk/test/Modules/Inputs/wildcard-submodule-exports/C_two.h
> cfe/trunk/test/Modules/cycles.c
> cfe/trunk/test/Modules/diamond-pch.c
> cfe/trunk/test/Modules/diamond.c
> cfe/trunk/test/Modules/irgen.c
> cfe/trunk/test/Modules/load_failure.c
> cfe/trunk/test/Modules/lookup.cpp
> cfe/trunk/test/Modules/macros.c
> cfe/trunk/test/Modules/module-private.cpp
> cfe/trunk/test/Modules/normal-module-map.cpp
> cfe/trunk/test/Modules/submodules-preprocess.cpp
> cfe/trunk/test/Modules/submodules.cpp
> cfe/trunk/test/Modules/wildcard-submodule-exports.cpp
>
> Modified: cfe/trunk/include/clang/Basic/IdentifierTable.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/IdentifierTable.h?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/IdentifierTable.h (original)
> +++ cfe/trunk/include/clang/Basic/IdentifierTable.h Tue Jan 3 13:32:59 2012
> @@ -69,7 +69,9 @@
> bool OutOfDate : 1; // True if there may be additional
> // information about this identifier
> // stored externally.
> - // 2 bits left in 32-bit word.
> + bool IsImport : 1; // True if this is the 'import' contextual
> + // keyword.
> + // 1 bit left in 32-bit word.
>
> void *FETokenInfo; // Managed by the language front-end.
> llvm::StringMapEntry<IdentifierInfo*> *Entry;
> @@ -283,6 +285,18 @@
> RecomputeNeedsHandleIdentifier();
> }
>
> + /// \brief Determine whether this is the contextual keyword 'import'.
> + bool isImport() const { return IsImport; }
> +
> + /// \brief Set whether this identifier is the contextual keyword 'import'.
> + void setImport(bool I) {
> + IsImport = I;
> + if (I)
> + NeedsHandleIdentifier = true;
> + else
> + RecomputeNeedsHandleIdentifier();
> + }
> +
> private:
> /// RecomputeNeedsHandleIdentifier - The Preprocessor::HandleIdentifier does
> /// several special (but rare) things to identifiers of various sorts. For
> @@ -295,8 +309,7 @@
> NeedsHandleIdentifier =
> (isPoisoned() | hasMacroDefinition() | isCPlusPlusOperatorKeyword() |
> isExtensionToken() | isCXX11CompatKeyword() || isOutOfDate() ||
> - (getTokenID() == tok::kw___import_module__) ||
> - (getObjCKeywordID() == tok::objc_import));
> + isImport());
> }
> };
>
> @@ -447,6 +460,10 @@
> // contents.
> II->Entry = &Entry;
>
> + // If this is the 'import' contextual keyword, mark it as such.
> + if (Name.equals("import"))
> + II->setImport(true);
> +
> return *II;
> }
>
> @@ -478,6 +495,10 @@
> // Make sure getName() knows how to find the IdentifierInfo
> // contents.
> II->Entry = &Entry;
> +
> + // If this is the 'import' contextual keyword, mark it as such.
> + if (Name.equals("import"))
> + II->setImport(true);
> }
>
> return *II;
>
> Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
> +++ cfe/trunk/include/clang/Basic/TokenKinds.def Tue Jan 3 13:32:59 2012
> @@ -405,7 +405,6 @@
>
> // Apple Extension.
> KEYWORD(__private_extern__ , KEYALL)
> -KEYWORD(__import_module__ , KEYALL)
> KEYWORD(__module_private__ , KEYALL)
>
> // Microsoft Extension.
>
> Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
> +++ cfe/trunk/include/clang/Lex/Preprocessor.h Tue Jan 3 13:32:59 2012
> @@ -162,8 +162,8 @@
> /// for preprocessing.
> SourceLocation CodeCompletionFileLoc;
>
> - /// \brief The source location of the __import_module__ or 'import' keyword we
> - /// just lexed, if any.
> + /// \brief The source location of the 'import' contextual keyword we just
> + /// lexed, if any.
> SourceLocation ModuleImportLoc;
>
> /// \brief The module import path that we're currently processing.
>
> Modified: cfe/trunk/include/clang/Sema/Sema.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Sema/Sema.h (original)
> +++ cfe/trunk/include/clang/Sema/Sema.h Tue Jan 3 13:32:59 2012
> @@ -1120,10 +1120,9 @@
>
> /// \brief The parser has processed a module import declaration.
> ///
> - /// \param AtLoc The location of the '@' symbol, if present.
> + /// \param AtLoc The location of the '@' symbol, if any.
> ///
> - /// \param ImportLoc The location of the '__import_module__' or 'import'
> - /// keyword.
> + /// \param ImportLoc The location of the 'import' keyword.
> ///
> /// \param Path The module access path.
> DeclResult ActOnModuleImport(SourceLocation AtLoc, SourceLocation ImportLoc,
>
> Modified: cfe/trunk/lib/Basic/IdentifierTable.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/IdentifierTable.cpp?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Basic/IdentifierTable.cpp (original)
> +++ cfe/trunk/lib/Basic/IdentifierTable.cpp Tue Jan 3 13:32:59 2012
> @@ -40,6 +40,7 @@
> ChangedAfterLoad = false;
> RevertedTokenID = false;
> OutOfDate = false;
> + IsImport = false;
> FETokenInfo = 0;
> Entry = 0;
> }
>
> Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
> +++ cfe/trunk/lib/Lex/PPDirectives.cpp Tue Jan 3 13:32:59 2012
> @@ -1378,15 +1378,16 @@
> bool BuildingImportedModule
> = Path[0].first->getName() == getLangOptions().CurrentModule;
>
> - if (!BuildingImportedModule) {
> + if (!BuildingImportedModule && getLangOptions().ObjC2) {
> // If we're not building the imported module, warn that we're going
> // to automatically turn this inclusion directive into a module import.
> + // We only do this in Objective-C, where we have a module-import syntax.
> CharSourceRange ReplaceRange(SourceRange(HashLoc, CharEnd),
> /*IsTokenRange=*/false);
> Diag(HashLoc, diag::warn_auto_module_import)
> << IncludeKind << PathString
> << FixItHint::CreateReplacement(ReplaceRange,
> - "__import_module__ " + PathString.str().str() + ";");
> + "@import " + PathString.str().str() + ";");
> }
>
> // Load the module.
>
> Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
> +++ cfe/trunk/lib/Lex/Preprocessor.cpp Tue Jan 3 13:32:59 2012
> @@ -548,11 +548,9 @@
> 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 @@
> }
> }
>
> -/// \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 @@
>
> // 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.
>
> Modified: cfe/trunk/lib/Parse/Parser.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Parse/Parser.cpp (original)
> +++ cfe/trunk/lib/Parse/Parser.cpp Tue Jan 3 13:32:59 2012
> @@ -666,9 +666,6 @@
> case tok::kw___if_not_exists:
> ParseMicrosoftIfExistsExternalDeclaration();
> return DeclGroupPtrTy();
> -
> - case tok::kw___import_module__:
> - return ParseModuleImport(SourceLocation());
>
> default:
> dont_know:
> @@ -1570,8 +1567,7 @@
> }
>
> Parser::DeclGroupPtrTy Parser::ParseModuleImport(SourceLocation AtLoc) {
> - assert((Tok.is(tok::kw___import_module__) ||
> - Tok.isObjCAtKeyword(tok::objc_import)) &&
> + assert(Tok.isObjCAtKeyword(tok::objc_import) &&
> "Improper start to module import");
> SourceLocation ImportLoc = ConsumeToken();
>
>
> Modified: cfe/trunk/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h (original)
> +++ cfe/trunk/test/Modules/Inputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h Tue Jan 3 13:32:59 2012
> @@ -1,3 +1,3 @@
>
> -__import_module__ MutuallyRecursive2;
> + at import MutuallyRecursive2;
>
>
> Modified: cfe/trunk/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h (original)
> +++ cfe/trunk/test/Modules/Inputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h Tue Jan 3 13:32:59 2012
> @@ -1,6 +1,6 @@
>
>
> -__import_module__ MutuallyRecursive1;
> + at import MutuallyRecursive1;
>
>
>
>
> Modified: cfe/trunk/test/Modules/Inputs/diamond.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/diamond.h?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/diamond.h (original)
> +++ cfe/trunk/test/Modules/Inputs/diamond.h Tue Jan 3 13:32:59 2012
> @@ -1 +1 @@
> -__import_module__ diamond_bottom;
> + at import diamond_bottom;
>
> Modified: cfe/trunk/test/Modules/Inputs/diamond_bottom.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/diamond_bottom.h?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/diamond_bottom.h (original)
> +++ cfe/trunk/test/Modules/Inputs/diamond_bottom.h Tue Jan 3 13:32:59 2012
> @@ -1,4 +1,4 @@
> -__import_module__ diamond_left;
> -__import_module__ diamond_right;
> + at import diamond_left;
> + at import diamond_right;
>
> char bottom(char *x);
>
> Modified: cfe/trunk/test/Modules/Inputs/diamond_left.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/diamond_left.h?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/diamond_left.h (original)
> +++ cfe/trunk/test/Modules/Inputs/diamond_left.h Tue Jan 3 13:32:59 2012
> @@ -1,4 +1,4 @@
> -__import_module__ diamond_top;
> + at import diamond_top;
>
> float left(float *);
>
>
> Modified: cfe/trunk/test/Modules/Inputs/diamond_right.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/diamond_right.h?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/diamond_right.h (original)
> +++ cfe/trunk/test/Modules/Inputs/diamond_right.h Tue Jan 3 13:32:59 2012
> @@ -1,4 +1,4 @@
> -__import_module__ diamond_top;
> + at import diamond_top;
>
> double right(double *);
>
>
> Modified: cfe/trunk/test/Modules/Inputs/wildcard-submodule-exports/C_one.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/wildcard-submodule-exports/C_one.h?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/wildcard-submodule-exports/C_one.h (original)
> +++ cfe/trunk/test/Modules/Inputs/wildcard-submodule-exports/C_one.h Tue Jan 3 13:32:59 2012
> @@ -1,4 +1,4 @@
> -__import_module__ A.One;
> -__import_module__ B.One;
> + at import A.One;
> + at import B.One;
>
> long *C1;
>
> Modified: cfe/trunk/test/Modules/Inputs/wildcard-submodule-exports/C_two.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/wildcard-submodule-exports/C_two.h?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/Inputs/wildcard-submodule-exports/C_two.h (original)
> +++ cfe/trunk/test/Modules/Inputs/wildcard-submodule-exports/C_two.h Tue Jan 3 13:32:59 2012
> @@ -1,4 +1,4 @@
> -__import_module__ A.Two;
> -__import_module__ B.Two;
> + at import A.Two;
> + at import B.Two;
>
> unsigned long *C2;
>
> Modified: cfe/trunk/test/Modules/cycles.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/cycles.c?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/cycles.c (original)
> +++ cfe/trunk/test/Modules/cycles.c Tue Jan 3 13:32:59 2012
> @@ -1,12 +1,12 @@
> // RUN: rm -rf %t
> -// RUN: %clang_cc1 -fmodule-cache-path %t -F %S/Inputs %s 2>&1 | FileCheck %s
> -
> -__import_module__ MutuallyRecursive1;
> +// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -F %S/Inputs %s 2>&1 | FileCheck %s
> +// FIXME: When we have a syntax for modules in C, use that.
> + at import MutuallyRecursive1;
>
> // FIXME: Lots of redundant diagnostics here, because the preprocessor
> // can't currently tell the parser not to try to load the module again.
>
> -// CHECK: MutuallyRecursive2.h:3:19: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1
> -// CHECK: MutuallyRecursive1.h:2:19: fatal error: could not build module 'MutuallyRecursive2'
> -// CHECK: cycles.c:4:19: fatal error: could not build module 'MutuallyRecursive1'
> +// CHECK: MutuallyRecursive2.h:3:9: fatal error: cyclic dependency in module 'MutuallyRecursive1': MutuallyRecursive1 -> MutuallyRecursive2 -> MutuallyRecursive1
> +// CHECK: MutuallyRecursive1.h:2:9: fatal error: could not build module 'MutuallyRecursive2'
> +// CHECK: cycles.c:4:9: fatal error: could not build module 'MutuallyRecursive1'
>
>
> Modified: cfe/trunk/test/Modules/diamond-pch.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/diamond-pch.c?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/diamond-pch.c (original)
> +++ cfe/trunk/test/Modules/diamond-pch.c Tue Jan 3 13:32:59 2012
> @@ -19,9 +19,10 @@
> }
>
> // RUN: rm -rf %t
> -// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_top %S/Inputs/module.map
> -// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_left %S/Inputs/module.map
> -// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_right %S/Inputs/module.map
> -// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_bottom %S/Inputs/module.map
> -// RUN: %clang_cc1 -emit-pch -fmodule-cache-path %t -o %t.pch %S/Inputs/diamond.h
> -// RUN: %clang_cc1 -fmodule-cache-path %t -include-pch %t.pch %s -verify
> +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_top %S/Inputs/module.map
> +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_left %S/Inputs/module.map
> +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_right %S/Inputs/module.map
> +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_bottom %S/Inputs/module.map
> +// RUN: %clang_cc1 -fmodules -x objective-c -emit-pch -fmodule-cache-path %t -o %t.pch %S/Inputs/diamond.h
> +// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -include-pch %t.pch %s -verify
> +// FIXME: When we have a syntax for modules in C, use that.
>
> Modified: cfe/trunk/test/Modules/diamond.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/diamond.c?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/diamond.c (original)
> +++ cfe/trunk/test/Modules/diamond.c Tue Jan 3 13:32:59 2012
> @@ -3,7 +3,7 @@
>
> // in diamond-bottom.h: expected-note{{passing argument to parameter 'x' here}}
>
> -__import_module__ diamond_bottom;
> + at import diamond_bottom;
>
> void test_diamond(int i, float f, double d, char c) {
> top(&i);
> @@ -21,8 +21,9 @@
> }
>
> // RUN: rm -rf %t
> -// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_top %S/Inputs/module.map
> -// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_left %S/Inputs/module.map
> -// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_right %S/Inputs/module.map
> -// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=diamond_bottom %S/Inputs/module.map
> -// RUN: %clang_cc1 -fmodule-cache-path %t %s -verify
> +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_top %S/Inputs/module.map
> +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_left %S/Inputs/module.map
> +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_right %S/Inputs/module.map
> +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=diamond_bottom %S/Inputs/module.map
> +// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t %s -verify
> +// FIXME: When we have a syntax for modules in C, use that.
>
> Modified: cfe/trunk/test/Modules/irgen.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/irgen.c?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/irgen.c (original)
> +++ cfe/trunk/test/Modules/irgen.c Tue Jan 3 13:32:59 2012
> @@ -1,8 +1,9 @@
> // RUN: rm -rf %t
> -// RUN: %clang_cc1 -fmodule-cache-path %t -emit-module -fmodule-name=irgen -triple x86_64-apple-darwin10 %S/Inputs/module.map
> -// RUN: %clang_cc1 -fmodule-cache-path %t -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
> +// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -emit-module -fmodule-name=irgen -triple x86_64-apple-darwin10 %S/Inputs/module.map
> +// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
> +// FIXME: When we have a syntax for modules in C, use that.
>
> -__import_module__ irgen;
> + at import irgen;
>
> // CHECK: define void @triple_value
> void triple_value(int *px) {
>
> Modified: cfe/trunk/test/Modules/load_failure.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/load_failure.c?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/load_failure.c (original)
> +++ cfe/trunk/test/Modules/load_failure.c Tue Jan 3 13:32:59 2012
> @@ -1,20 +1,21 @@
> #ifdef NONEXISTENT
> -__import_module__ load_nonexistent;
> + at import load_nonexistent;
> #endif
>
> #ifdef FAILURE
> -__import_module__ load_failure;
> + at import load_failure;
> #endif
>
> // RUN: rm -rf %t
> -// RUN: %clang_cc1 -x c++ -fmodule-cache-path %t -fdisable-module-hash -emit-module -fmodule-name=load_failure %S/Inputs/module.map
> -// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s
> -// CHECK-NONEXISTENT: load_failure.c:2:19: fatal error: module 'load_nonexistent' not found
> +// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -fdisable-module-hash -emit-module -fmodule-name=load_failure %S/Inputs/module.map
> +// RUN: %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -fdisable-module-hash %s -DNONEXISTENT 2>&1 | FileCheck -check-prefix=CHECK-NONEXISTENT %s
> +// CHECK-NONEXISTENT: load_failure.c:2:9: fatal error: module 'load_nonexistent' not found
>
> -// RUN: not %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash %s -DFAILURE 2> %t.out
> +// RUN: not %clang_cc1 -fmodules -x objective-c -fmodule-cache-path %t -fdisable-module-hash %s -DFAILURE 2> %t.out
> // RUN: FileCheck -check-prefix=CHECK-FAILURE %s < %t.out
>
> // FIXME: Clean up diagnostic text below and give it a location
> // CHECK-FAILURE: error: C99 was disabled in PCH file but is currently enabled
> +// FIXME: When we have a syntax for modules in C, use that.
>
>
>
> Modified: cfe/trunk/test/Modules/lookup.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/lookup.cpp?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/lookup.cpp (original)
> +++ cfe/trunk/test/Modules/lookup.cpp Tue Jan 3 13:32:59 2012
> @@ -1,7 +1,8 @@
>
> -#define import __import_module__
> +#define import @import
> import lookup_left_cxx;
> -#define IMPORT(X) __import_module__ X
> +#undef import
> +#define IMPORT(X) @import X
> IMPORT(lookup_right_cxx);
>
> void test(int i, float f) {
> @@ -15,10 +16,11 @@
> }
>
> // RUN: rm -rf %t
> -// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=lookup_left_cxx -x c++ %S/Inputs/module.map -verify
> -// RUN: %clang_cc1 -emit-module -fmodule-cache-path %t -fmodule-name=lookup_right_cxx -x c++ %S/Inputs/module.map -verify
> -// RUN: %clang_cc1 -x c++ -fmodule-cache-path %t %s -verify
> -// RUN: %clang_cc1 -ast-print -x c++ -fmodule-cache-path %t %s | FileCheck -check-prefix=CHECK-PRINT %s
> +// RUN: %clang_cc1 -fmodules -x objective-c++ -emit-module -fmodule-cache-path %t -fmodule-name=lookup_left_cxx %S/Inputs/module.map -verify
> +// RUN: %clang_cc1 -fmodules -x objective-c++ -emit-module -fmodule-cache-path %t -fmodule-name=lookup_right_cxx %S/Inputs/module.map -verify
> +// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t %s -verify
> +// RUN: %clang_cc1 -fmodules -ast-print -x objective-c++ -fmodule-cache-path %t %s | FileCheck -check-prefix=CHECK-PRINT %s
> +// FIXME: When we have a syntax for modules in C++, use that.
>
> // CHECK-PRINT: int *f0(int *);
> // CHECK-PRINT: float *f0(float *);
>
> Modified: cfe/trunk/test/Modules/macros.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/macros.c?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/macros.c (original)
> +++ cfe/trunk/test/Modules/macros.c Tue Jan 3 13:32:59 2012
> @@ -1,9 +1,10 @@
> // RUN: rm -rf %t
> -// RUN: %clang_cc1 -fmodules -emit-module -fmodule-cache-path %t -fmodule-name=macros %S/Inputs/module.map
> -// RUN: %clang_cc1 -fmodules -verify -fmodule-cache-path %t %s
> -// RUN: %clang_cc1 -E -fmodules -fmodule-cache-path %t %s | FileCheck -check-prefix CHECK-PREPROCESSED %s
> +// RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=macros %S/Inputs/module.map
> +// RUN: %clang_cc1 -fmodules -x objective-c -verify -fmodule-cache-path %t %s
> +// RUN: %clang_cc1 -E -fmodules -x objective-c -fmodule-cache-path %t %s | FileCheck -check-prefix CHECK-PREPROCESSED %s
> +// FIXME: When we have a syntax for modules in C, use that.
>
> -__import_module__ macros;
> + at import macros;
>
> #ifndef INTEGER
> # error INTEGER macro should be visible
>
> Modified: cfe/trunk/test/Modules/module-private.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/module-private.cpp?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/module-private.cpp (original)
> +++ cfe/trunk/test/Modules/module-private.cpp Tue Jan 3 13:32:59 2012
> @@ -1,10 +1,11 @@
> // RUN: rm -rf %t
> -// RUN: %clang_cc1 -fmodule-cache-path %t -fmodule-name=module_private_left -x c++ -emit-module %S/Inputs/module.map
> -// RUN: %clang_cc1 -fmodule-cache-path %t -fmodule-name=module_private_right -x c++ -emit-module %S/Inputs/module.map
> -// RUN: %clang_cc1 -fmodule-cache-path %t %s -verify
> +// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -fmodule-name=module_private_left -emit-module %S/Inputs/module.map
> +// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -fmodule-name=module_private_right -emit-module %S/Inputs/module.map
> +// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t %s -verify
> +// FIXME: When we have a syntax for modules in C++, use that.
>
> -__import_module__ module_private_left;
> -__import_module__ module_private_right;
> + at import module_private_left;
> + at import module_private_right;
>
> void test() {
> int &ir = f0(1.0); // okay: f0() from 'right' is not visible
>
> Modified: cfe/trunk/test/Modules/normal-module-map.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/normal-module-map.cpp?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/normal-module-map.cpp (original)
> +++ cfe/trunk/test/Modules/normal-module-map.cpp Tue Jan 3 13:32:59 2012
> @@ -8,7 +8,7 @@
> return umbrella + umbrella_sub;
> }
>
> -__import_module__ Umbrella2;
> + at import Umbrella2;
>
> #include "a1.h"
> #include "b1.h"
> @@ -18,7 +18,7 @@
> return a1 + b1 + nested2;
> }
>
> -__import_module__ nested_umbrella.a;
> + at import nested_umbrella.a;
>
> int testNestedUmbrellaA() {
> return nested_umbrella_a;
> @@ -28,7 +28,7 @@
> return nested_umbrella_b; // expected-error{{use of undeclared identifier 'nested_umbrella_b'; did you mean 'nested_umbrella_a'?}}
> }
>
> -__import_module__ nested_umbrella.b;
> + at import nested_umbrella.b;
>
> int testNestedUmbrellaB() {
> return nested_umbrella_b;
>
> Modified: cfe/trunk/test/Modules/submodules-preprocess.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodules-preprocess.cpp?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/submodules-preprocess.cpp (original)
> +++ cfe/trunk/test/Modules/submodules-preprocess.cpp Tue Jan 3 13:32:59 2012
> @@ -1,7 +1,8 @@
> // RUN: rm -rf %t
> -// RUN: %clang_cc1 -Eonly -fmodule-cache-path %t -fmodules -I %S/Inputs/submodules %s -verify
> +// RUN: %clang_cc1 -fmodules -x objective-c++ -Eonly -fmodule-cache-path %t -I %S/Inputs/submodules %s -verify
> +// FIXME: When we have a syntax for modules in C++, use that.
>
> -__import_module__ std.vector;
> + at import std.vector;
>
> #ifndef HAVE_VECTOR
> # error HAVE_VECTOR macro is not available (but should be)
> @@ -15,7 +16,7 @@
> # error HAVE_HASH_MAP macro is available (but shouldn't be)
> #endif
>
> -__import_module__ std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}}
> + at import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}}
>
> #ifndef HAVE_VECTOR
> # error HAVE_VECTOR macro is not available (but should be)
> @@ -29,9 +30,9 @@
> # error HAVE_HASH_MAP macro is available (but shouldn't be)
> #endif
>
> -__import_module__ std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
> + at import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
>
> -__import_module__ std; // import everything in 'std'
> + at import std; // import everything in 'std'
>
> #ifndef HAVE_VECTOR
> # error HAVE_VECTOR macro is not available (but should be)
> @@ -45,7 +46,7 @@
> # error HAVE_HASH_MAP macro is available (but shouldn't be)
> #endif
>
> -__import_module__ std.hash_map;
> + at import std.hash_map;
>
> #ifndef HAVE_VECTOR
> # error HAVE_VECTOR macro is not available (but should be)
>
> Modified: cfe/trunk/test/Modules/submodules.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodules.cpp?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/submodules.cpp (original)
> +++ cfe/trunk/test/Modules/submodules.cpp Tue Jan 3 13:32:59 2012
> @@ -1,7 +1,8 @@
> // RUN: rm -rf %t
> -// RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -I %S/Inputs/submodules %s -verify
> +// RUN: %clang_cc1 -x objective-c++ -fmodule-cache-path %t -fmodules -I %S/Inputs/submodules %s -verify
> +// FIXME: When we have a syntax for modules in C++, use that.
>
> -__import_module__ std.vector;
> + at import std.vector;
>
> vector<int> vi;
>
> @@ -9,20 +10,20 @@
> remove_reference<int&>::type *int_ptr = 0; // expected-error{{unknown type name 'remove_reference'}} \
> // expected-error{{expected unqualified-id}}
>
> -__import_module__ std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}}
> + at import std.typetraits; // expected-error{{no submodule named 'typetraits' in module 'std'; did you mean 'type_traits'?}}
>
> vector<float> vf;
> remove_reference<int&>::type *int_ptr2 = 0;
>
> -__import_module__ std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
> + at import std.vector.compare; // expected-error{{no submodule named 'compare' in module 'std.vector'}}
>
> -__import_module__ std; // import everything in 'std'
> + at import std; // import everything in 'std'
>
> // hash_map still isn't available.
> hash_map<int, float> ints_to_floats; // expected-error{{unknown type name 'hash_map'}} \
> // expected-error{{expected unqualified-id}}
>
> -__import_module__ std.hash_map;
> + at import std.hash_map;
>
> hash_map<int, float> ints_to_floats2;
>
>
> Modified: cfe/trunk/test/Modules/wildcard-submodule-exports.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/wildcard-submodule-exports.cpp?rev=147467&r1=147466&r2=147467&view=diff
> ==============================================================================
> --- cfe/trunk/test/Modules/wildcard-submodule-exports.cpp (original)
> +++ cfe/trunk/test/Modules/wildcard-submodule-exports.cpp Tue Jan 3 13:32:59 2012
> @@ -1,7 +1,8 @@
> // RUN: rm -rf %t
> -// RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -I %S/Inputs/wildcard-submodule-exports %s -verify
> +// RUN: %clang_cc1 -x objective-c++ -fmodule-cache-path %t -fmodules -I %S/Inputs/wildcard-submodule-exports %s -verify
> +// FIXME: When we have a syntax for modules in C++, use that.
>
> -__import_module__ C.One;
> + at import C.One;
>
> void test_C_One() {
> int *A1_ptr = A1;
> @@ -9,7 +10,7 @@
> (void)B1; // expected-error{{use of undeclared identifier 'B1'}}
> }
>
> -__import_module__ C.Two;
> + at import C.Two;
>
> void test_C_Two() {
> unsigned int *A2_ptr = A2;
> @@ -17,7 +18,7 @@
> unsigned long *C2_ptr = C2;
> }
>
> -__import_module__ B.One;
> + at import B.One;
>
> void test_B_One() {
> short *B1_ptr = B1;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list