llvm-project/clang/test/CXX/modules-ts/codegen-basics.cppm
Nathan Sidwell ae4dce8659 [clang][ABI] New C++20 module mangling scheme
Implement a demangleable strong ownership symbol mangling.

 * The original module symbol mangling scheme turned out to be
undemangleable.

 * The hoped-for C++17 compatibility of weak ownership turns out to be
fragile

* C++20 now has better ways of controlling C++17 compatibility

The issue is captured on the ABI list at:
  https://github.com/itanium-cxx-abi/cxx-abi/issues/134

GCC implements this new mangling.

The old mangling is unceremoniously dropped.  No backwards
compatibility, no deprectated old-mangling flag.  It was always
labelled experimental.  (Old and new manglings cannot be confused.)

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D122256
2022-03-30 08:51:27 -07:00

22 lines
759 B
C++

// 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-DAG: define{{.*}} i32 @_ZW6FooBar1fv(
int f() { return 0; }
}
// CHECK-DAG: define weak_odr void @_ZW6FooBar2f2v(
inline void f2() {}
// CHECK-DAG: define{{.*}} void @_ZW6FooBar2f3v(
static void f3() {}
export void use_f3() { f3(); }
// FIXME: Emit global variables and their initializers with this TU.
// Emit an initialization function that other TUs can call, with guard variable?
// FIXME: const-qualified variables don't have implicit internal linkage when owned by a module.