Author: rsmith Date: Fri Apr 21 19:47:53 2017 New Revision: 301066 URL: http://llvm.org/viewvc/llvm-project?rev=301066&view=rev Log: Rearrange some Modules TS testcases into test/CXX/modules-ts.
Added: cfe/trunk/test/CXX/modules-ts/ cfe/trunk/test/CXX/modules-ts/basic/ cfe/trunk/test/CXX/modules-ts/basic/basic.link/ cfe/trunk/test/CXX/modules-ts/basic/basic.link/module-declaration.cpp - copied, changed from r301056, cfe/trunk/test/Parser/cxx-modules-import.cpp cfe/trunk/test/CXX/modules-ts/codegen-basics.cppm - copied unchanged from r301056, cfe/trunk/test/CodeGenCXX/modules-ts.cppm cfe/trunk/test/CXX/modules-ts/dcl.dcl/ cfe/trunk/test/CXX/modules-ts/dcl.dcl/dcl.module/ cfe/trunk/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.export/ cfe/trunk/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.import/ cfe/trunk/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.import/p1.cpp - copied, changed from r301056, cfe/trunk/test/Parser/cxx-modules-import.cpp cfe/trunk/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/ Removed: cfe/trunk/test/CodeGenCXX/modules-ts.cppm cfe/trunk/test/Parser/cxx-modules-import.cpp Copied: cfe/trunk/test/CXX/modules-ts/basic/basic.link/module-declaration.cpp (from r301056, cfe/trunk/test/Parser/cxx-modules-import.cpp) URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/modules-ts/basic/basic.link/module-declaration.cpp?p2=cfe/trunk/test/CXX/modules-ts/basic/basic.link/module-declaration.cpp&p1=cfe/trunk/test/Parser/cxx-modules-import.cpp&r1=301056&r2=301066&rev=301066&view=diff ============================================================================== --- cfe/trunk/test/Parser/cxx-modules-import.cpp (original) +++ cfe/trunk/test/CXX/modules-ts/basic/basic.link/module-declaration.cpp Fri Apr 21 19:47:53 2017 @@ -1,3 +1,5 @@ +// Tests for module-declaration syntax. +// // RUN: rm -rf %t // RUN: mkdir -p %t // RUN: echo 'export module x; int a, b;' > %t/x.cppm @@ -6,55 +8,48 @@ // RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %t/x.cppm -o %t/x.pcm // RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface -fmodule-file=%t/x.pcm %t/x.y.cppm -o %t/x.y.pcm // +// Module implementation for unknown and known module. (The former is ill-formed.) +// FIXME: TEST=1 should fail because we don't have an interface for module z. // RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ // RUN: -DTEST=1 -DEXPORT= -DPARTITION= -DMODULE_NAME=z // RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ // RUN: -DTEST=2 -DEXPORT= -DPARTITION= -DMODULE_NAME=x +// +// Module interface for unknown and known module. (The latter is ill-formed due to +// redefinition.) // RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ // RUN: -DTEST=3 -DEXPORT=export -DPARTITION= -DMODULE_NAME=z // RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=4 -DEXPORT=export -DPARTITION=partition -DMODULE_NAME=z +// RUN: -DTEST=4 -DEXPORT=export -DPARTITION= -DMODULE_NAME=x +// +// Defining a module partition. +// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ +// RUN: -DTEST=5 -DEXPORT=export -DPARTITION=partition -DMODULE_NAME=z // RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=5 -DEXPORT= -DPARTITION=elderberry -DMODULE_NAME=z +// RUN: -DTEST=6 -DEXPORT= -DPARTITION=partition -DMODULE_NAME=z +// +// Miscellaneous syntax. // RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=1 -DEXPORT= -DPARTITION= -DMODULE_NAME='z [[]]' +// RUN: -DTEST=7 -DEXPORT= -DPARTITION=elderberry -DMODULE_NAME=z // RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=6 -DEXPORT= -DPARTITION= -DMODULE_NAME='z [[fancy]]' +// RUN: -DTEST=8 -DEXPORT= -DPARTITION= -DMODULE_NAME='z [[]]' // RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=7 -DEXPORT= -DPARTITION= -DMODULE_NAME='z [[maybe_unused]]' +// RUN: -DTEST=9 -DEXPORT= -DPARTITION= -DMODULE_NAME='z [[fancy]]' // RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=8 -DEXPORT= -DPARTITION=partition -DMODULE_NAME=z +// RUN: -DTEST=10 -DEXPORT= -DPARTITION= -DMODULE_NAME='z [[maybe_unused]]' EXPORT module PARTITION MODULE_NAME; -#if TEST == 3 || TEST == 4 -// ok, building object code for module interface -#elif TEST == 5 -// expected-error@-4 {{expected ';'}} expected-error@-4 {{requires a type specifier}} +#if TEST == 4 +// expected-error@-2 {{redefinition of module 'x'}} +// expected-note...@module-declaration.cpp:* {{loaded from '{{.*}}/x.pcm'}} #elif TEST == 6 -// expected-warning@-6 {{unknown attribute 'fancy' ignored}} +// expected-error@-5 {{module partition must be declared 'export'}} #elif TEST == 7 -// expected-error-re@-8 {{'maybe_unused' attribute cannot be applied to a module{{$}}}} -#elif TEST == 8 -// expected-error@-10 {{module partition must be declared 'export'}} -#endif - -int use_1 = a; -#if TEST != 2 -// expected-error@-2 {{declaration of 'a' must be imported from module 'x' before it is required}} -// expected-n...@x.cppm:1 {{here}} +// expected-error@-7 {{expected ';'}} expected-error@-7 {{requires a type specifier}} +#elif TEST == 9 +// expected-warning@-9 {{unknown attribute 'fancy' ignored}} +#elif TEST == 10 +// expected-error-re@-11 {{'maybe_unused' attribute cannot be applied to a module{{$}}}} +#else +// expected-no-diagnostics #endif - -import x; - -int use_2 = b; // ok - -import x [[]]; -import x [[foo]]; // expected-warning {{unknown attribute 'foo' ignored}} -import x [[noreturn]]; // expected-error {{'noreturn' attribute cannot be applied to a module import}} -import x [[blarg::noreturn]]; // expected-warning {{unknown attribute 'noreturn' ignored}} - -import x.y; -import x.; // expected-error {{expected a module name after 'import'}} -import .x; // expected-error {{expected a module name after 'import'}} - -import blarg; // expected-error {{module 'blarg' not found}} Copied: cfe/trunk/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.import/p1.cpp (from r301056, cfe/trunk/test/Parser/cxx-modules-import.cpp) URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.import/p1.cpp?p2=cfe/trunk/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.import/p1.cpp&p1=cfe/trunk/test/Parser/cxx-modules-import.cpp&r1=301056&r2=301066&rev=301066&view=diff ============================================================================== --- cfe/trunk/test/Parser/cxx-modules-import.cpp (original) +++ cfe/trunk/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.import/p1.cpp Fri Apr 21 19:47:53 2017 @@ -7,39 +7,14 @@ // RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface -fmodule-file=%t/x.pcm %t/x.y.cppm -o %t/x.y.pcm // // RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=1 -DEXPORT= -DPARTITION= -DMODULE_NAME=z +// RUN: -DMODULE_NAME=z // RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=2 -DEXPORT= -DPARTITION= -DMODULE_NAME=x -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=3 -DEXPORT=export -DPARTITION= -DMODULE_NAME=z -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=4 -DEXPORT=export -DPARTITION=partition -DMODULE_NAME=z -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=5 -DEXPORT= -DPARTITION=elderberry -DMODULE_NAME=z -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=1 -DEXPORT= -DPARTITION= -DMODULE_NAME='z [[]]' -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=6 -DEXPORT= -DPARTITION= -DMODULE_NAME='z [[fancy]]' -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=7 -DEXPORT= -DPARTITION= -DMODULE_NAME='z [[maybe_unused]]' -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=8 -DEXPORT= -DPARTITION=partition -DMODULE_NAME=z +// RUN: -DMODULE_X -DMODULE_NAME=x -EXPORT module PARTITION MODULE_NAME; -#if TEST == 3 || TEST == 4 -// ok, building object code for module interface -#elif TEST == 5 -// expected-error@-4 {{expected ';'}} expected-error@-4 {{requires a type specifier}} -#elif TEST == 6 -// expected-warning@-6 {{unknown attribute 'fancy' ignored}} -#elif TEST == 7 -// expected-error-re@-8 {{'maybe_unused' attribute cannot be applied to a module{{$}}}} -#elif TEST == 8 -// expected-error@-10 {{module partition must be declared 'export'}} -#endif +module MODULE_NAME; int use_1 = a; -#if TEST != 2 +#if !MODULE_X // expected-error@-2 {{declaration of 'a' must be imported from module 'x' before it is required}} // expected-n...@x.cppm:1 {{here}} #endif @@ -48,6 +23,10 @@ import x; int use_2 = b; // ok +// There is no relation between module x and module x.y. +int use_3 = c; // expected-error {{declaration of 'c' must be imported from module 'x.y'}} + // expected-n...@x.y.cppm:1 {{here}} + import x [[]]; import x [[foo]]; // expected-warning {{unknown attribute 'foo' ignored}} import x [[noreturn]]; // expected-error {{'noreturn' attribute cannot be applied to a module import}} @@ -57,4 +36,6 @@ import x.y; import x.; // expected-error {{expected a module name after 'import'}} import .x; // expected-error {{expected a module name after 'import'}} +int use_4 = c; // ok + import blarg; // expected-error {{module 'blarg' not found}} Removed: cfe/trunk/test/CodeGenCXX/modules-ts.cppm URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/modules-ts.cppm?rev=301065&view=auto ============================================================================== --- cfe/trunk/test/CodeGenCXX/modules-ts.cppm (original) +++ cfe/trunk/test/CodeGenCXX/modules-ts.cppm (removed) @@ -1,23 +0,0 @@ -// RUN: %clang_cc1 -fmodules-ts -std=c++1z -triple=x86_64-linux-gnu -fmodules-codegen -emit-module-interface %s -o %t.pcm -// RUN: %clang_cc1 -fmodules-ts -std=c++1z -triple=x86_64-linux-gnu %t.pcm -emit-llvm -o - | FileCheck %s - -export module FooBar; - -export { - // CHECK-LABEL: define i32 @_Z1fv( - int f() { return 0; } -} - -// CHECK-LABEL: define weak_odr void @_Z2f2v( -inline void f2() { } - -// FIXME: Emit global variables and their initializers with this TU. -// Emit an initialization function that other TUs can call, with guard variable. - -// FIXME: Mangle non-exported symbols so they don't collide with -// non-exported symbols from other modules? - -// FIXME: Formally-internal-linkage symbols that are used from an exported -// symbol need a mangled name and external linkage. - -// FIXME: const-qualified variables don't have implicit internal linkage when owned by a module. Removed: cfe/trunk/test/Parser/cxx-modules-import.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-modules-import.cpp?rev=301065&view=auto ============================================================================== --- cfe/trunk/test/Parser/cxx-modules-import.cpp (original) +++ cfe/trunk/test/Parser/cxx-modules-import.cpp (removed) @@ -1,60 +0,0 @@ -// RUN: rm -rf %t -// RUN: mkdir -p %t -// RUN: echo 'export module x; int a, b;' > %t/x.cppm -// RUN: echo 'export module x.y; int c;' > %t/x.y.cppm -// -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %t/x.cppm -o %t/x.pcm -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface -fmodule-file=%t/x.pcm %t/x.y.cppm -o %t/x.y.pcm -// -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=1 -DEXPORT= -DPARTITION= -DMODULE_NAME=z -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=2 -DEXPORT= -DPARTITION= -DMODULE_NAME=x -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=3 -DEXPORT=export -DPARTITION= -DMODULE_NAME=z -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=4 -DEXPORT=export -DPARTITION=partition -DMODULE_NAME=z -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=5 -DEXPORT= -DPARTITION=elderberry -DMODULE_NAME=z -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=1 -DEXPORT= -DPARTITION= -DMODULE_NAME='z [[]]' -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=6 -DEXPORT= -DPARTITION= -DMODULE_NAME='z [[fancy]]' -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=7 -DEXPORT= -DPARTITION= -DMODULE_NAME='z [[maybe_unused]]' -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -I%t -fmodule-file=%t/x.y.pcm -verify %s \ -// RUN: -DTEST=8 -DEXPORT= -DPARTITION=partition -DMODULE_NAME=z - -EXPORT module PARTITION MODULE_NAME; -#if TEST == 3 || TEST == 4 -// ok, building object code for module interface -#elif TEST == 5 -// expected-error@-4 {{expected ';'}} expected-error@-4 {{requires a type specifier}} -#elif TEST == 6 -// expected-warning@-6 {{unknown attribute 'fancy' ignored}} -#elif TEST == 7 -// expected-error-re@-8 {{'maybe_unused' attribute cannot be applied to a module{{$}}}} -#elif TEST == 8 -// expected-error@-10 {{module partition must be declared 'export'}} -#endif - -int use_1 = a; -#if TEST != 2 -// expected-error@-2 {{declaration of 'a' must be imported from module 'x' before it is required}} -// expected-n...@x.cppm:1 {{here}} -#endif - -import x; - -int use_2 = b; // ok - -import x [[]]; -import x [[foo]]; // expected-warning {{unknown attribute 'foo' ignored}} -import x [[noreturn]]; // expected-error {{'noreturn' attribute cannot be applied to a module import}} -import x [[blarg::noreturn]]; // expected-warning {{unknown attribute 'noreturn' ignored}} - -import x.y; -import x.; // expected-error {{expected a module name after 'import'}} -import .x; // expected-error {{expected a module name after 'import'}} - -import blarg; // expected-error {{module 'blarg' not found}} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits