From bbcc9f0462c1b56e0bd6bdd830bd0250ec8ad2d4 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Fri, 26 Aug 2016 00:14:38 +0000 Subject: C++ Modules TS: add frontend support for building pcm files from module interface files. At the moment, all declarations (and no macros) are exported, and 'export' declarations are not supported yet. llvm-svn: 279794 --- clang/test/Parser/cxx-modules-interface.cppm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 clang/test/Parser/cxx-modules-interface.cppm (limited to 'clang/test/Parser/cxx-modules-interface.cppm') diff --git a/clang/test/Parser/cxx-modules-interface.cppm b/clang/test/Parser/cxx-modules-interface.cppm new file mode 100644 index 00000000000..88747714e5c --- /dev/null +++ b/clang/test/Parser/cxx-modules-interface.cppm @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.pcm -verify -DTEST=0 +// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.pcm -verify -Dmodule=int -DTEST=1 +// RUN: not %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -fmodule-file=%t.pcm -o %t.pcm -DTEST=2 2>&1 | FileCheck %s --check-prefix=CHECK-2 +// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -fmodule-file=%t.pcm -o %t.pcm -verify -Dfoo=bar -DTEST=3 + +#if TEST == 0 +// expected-no-diagnostics +#endif + +module foo; +#if TEST == 1 +// expected-error@-2 {{expected module declaration at start of module interface}} +#elif TEST == 2 +// CHECK-2: error: redefinition of module 'foo' +#endif + +int n; +#if TEST == 3 +// expected-error@-2 {{redefinition of 'n'}} +// expected-note@-3 {{previous}} +#endif -- cgit v1.2.3