From: Chuanqi Xu Date: Thu, 16 Feb 2023 08:24:37 +0000 (+0800) Subject: [NFC] Add two tests for C++ modules X-Git-Tag: upstream/17.0.6~17310 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f8d5f0e53b04040cebbba639530133b261a4432f;p=platform%2Fupstream%2Fllvm.git [NFC] Add two tests for C++ modules One test for checking the decls in language linkage shouldn't be discarded and can be mangled correctly. Another one for checking we can't export again in an export decl. --- diff --git a/clang/test/Modules/export-in-another-export.cppm b/clang/test/Modules/export-in-another-export.cppm new file mode 100644 index 0000000..38cb4d6 --- /dev/null +++ b/clang/test/Modules/export-in-another-export.cppm @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -std=c++20 %s -fsyntax-only -verify +export module M; +export { // expected-note {{export block begins here}} + export int foo() { return 43; } // expected-error {{export declaration appears within another export declaration}} +} diff --git a/clang/test/Modules/language-linkage.cppm b/clang/test/Modules/language-linkage.cppm new file mode 100644 index 0000000..bf7982c --- /dev/null +++ b/clang/test/Modules/language-linkage.cppm @@ -0,0 +1,18 @@ +// Make sure that the declarations inside the language linkage can +// be generated correctly. +// +// RUN: rm -fr %t +// RUN: mkdir %t +// +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %s -emit-module-interface -o %t/M.pcm +// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/M.pcm -S -emit-llvm -disable-llvm-passes -o - | FileCheck %s +export module M; + +extern "C++" { +void foo() {} +} + +extern "C" void bar() {} + +// CHECK: define {{.*}}@bar( +// CHECK: define {{.*}}@_Z3foov(