llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-modules Author: None (yronglin) <details> <summary>Changes</summary> Refine CXX/module/module.interface/p1.cpp with split-file. This MR is a part of https://github.com/llvm/llvm-project/pull/107168. --- Full diff: https://github.com/llvm/llvm-project/pull/148861.diff 1 Files Affected: - (modified) clang/test/CXX/module/module.interface/p1.cpp (+24-18) ``````````diff diff --git a/clang/test/CXX/module/module.interface/p1.cpp b/clang/test/CXX/module/module.interface/p1.cpp index 54a201e502323..c3bfca930f5cc 100644 --- a/clang/test/CXX/module/module.interface/p1.cpp +++ b/clang/test/CXX/module/module.interface/p1.cpp @@ -1,28 +1,19 @@ -// RUN: %clang_cc1 -std=c++2a %s -DERRORS -verify -// RUN: %clang_cc1 -std=c++2a %s -emit-module-interface -o %t.pcm -// RUN: %clang_cc1 -std=c++2a %s -fmodule-file=M=%t.pcm -DIMPLEMENTATION -verify -Db=b2 -Dc=c2 +// RUN: rm -rf %t +// RUN: split-file %s %t -module; +// RUN: %clang_cc1 -std=c++2a %t/errors.cpp -verify +// RUN: %clang_cc1 -std=c++2a %t/M.cppm -emit-module-interface -o %t/M.pcm +// RUN: %clang_cc1 -std=c++2a %t/impl.cpp -fmodule-file=M=%t/M.pcm -verify -#ifdef ERRORS +//--- errors.cpp +module; export int a; // expected-error {{export declaration can only be used within a module purview}} -#endif - -#ifndef IMPLEMENTATION -export -#else -// expected-error@#1 {{export declaration can only be used within a module purview}} -// expected-error@#2 {{export declaration can only be used within a module purview}} -// expected-note@+2 1+{{add 'export'}} -#endif -module M; - +export module M; export int b; // #1 namespace N { export int c; // #2 } -#ifdef ERRORS namespace { // expected-note 2{{anonymous namespace begins here}} export int d1; // expected-error {{export declaration appears within anonymous namespace}} namespace X { @@ -35,4 +26,19 @@ export { export int f; } // expected-error {{within another export declaration}} module :private; // expected-note {{private module fragment begins here}} export int priv; // expected-error {{export declaration cannot be used in a private module fragment}} -#endif + +//--- M.cppm +export module M; +export int b; +namespace N { + export int c; +} + +//--- impl.cpp +module M; // #M + +export int b2; // expected-error {{export declaration can only be used within a module purview}} +namespace N { + export int c2; // expected-error {{export declaration can only be used within a module purview}} +} +// expected-note@#M 2+{{add 'export'}} `````````` </details> https://github.com/llvm/llvm-project/pull/148861 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits