Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
clang/test/CXX/module/basic/basic.def.odr/p4.cppm
// RUN: rm -rf %t | // RUN: rm -rf %t | ||||
// RUN: mkdir %t | // RUN: mkdir %t | ||||
// RUN: split-file %s %t | // RUN: split-file %s %t | ||||
// | // | ||||
// RUN: %clang_cc1 -std=c++20 %t/Module.cppm -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %t/Module.cppm --implicit-check-not unused | // RUN: %clang_cc1 -std=c++20 %t/Module.cppm -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %t/Module.cppm --implicit-check-not unused | ||||
// | // | ||||
// RUN: %clang_cc1 -std=c++20 %t/Module.cppm -triple %itanium_abi_triple -emit-module-interface -o %t/Module.pcm | // RUN: %clang_cc1 -std=c++20 %t/Module.cppm -triple %itanium_abi_triple -emit-module-interface -o %t/Module.pcm | ||||
// RUN: %clang_cc1 -std=c++20 %t/module.cpp -triple %itanium_abi_triple -fmodule-file=%t/Module.pcm -emit-llvm -o - | FileCheck %t/module.cpp --implicit-check-not=unused --implicit-check-not=global_module | // RUN: %clang_cc1 -std=c++20 %t/module.cpp -triple %itanium_abi_triple -fmodule-file=Module=%t/Module.pcm -emit-llvm -o - | FileCheck %t/module.cpp --implicit-check-not=unused --implicit-check-not=global_module | ||||
// | // | ||||
// RUN: %clang_cc1 -std=c++20 %t/user.cpp -triple %itanium_abi_triple -fmodule-file=%t/Module.pcm -emit-llvm -o - | FileCheck %t/user.cpp --implicit-check-not=unused --implicit-check-not=global_module | // RUN: %clang_cc1 -std=c++20 %t/user.cpp -triple %itanium_abi_triple -fmodule-file=Module=%t/Module.pcm -emit-llvm -o - | FileCheck %t/user.cpp --implicit-check-not=unused --implicit-check-not=global_module | ||||
//--- Module.cppm | //--- Module.cppm | ||||
// CHECK-DAG: @extern_var_global_module = external {{(dso_local )?}}global | // CHECK-DAG: @extern_var_global_module = external {{(dso_local )?}}global | ||||
// CHECK-DAG: @inline_var_global_module = linkonce_odr {{(dso_local )?}}global | // CHECK-DAG: @inline_var_global_module = linkonce_odr {{(dso_local )?}}global | ||||
// CHECK-DAG: @_ZL24static_var_global_module = internal global | // CHECK-DAG: @_ZL24static_var_global_module = internal global | ||||
// CHECK-DAG: @_ZL23const_var_global_module = internal constant | // CHECK-DAG: @_ZL23const_var_global_module = internal constant | ||||
// | // | ||||
// With strong-ownership, the module is mangled into exported symbols | // With strong-ownership, the module is mangled into exported symbols | ||||
// that are attached to a named module. | // that are attached to a named module. | ||||
// CHECK-DAG: @_ZW6Module19extern_var_exported = external {{(dso_local )?}}global | // CHECK-DAG: @_ZW6Module19extern_var_exported = external {{(dso_local )?}}global | ||||
// FIXME: Should this be 'weak_odr global'? Presumably it must be, since we | // FIXME: Should this be 'weak_odr global'? Presumably it must be, since we | ||||
// can discard this global and its initializer (if any), and other TUs are not | // can discard this global and its initializer (if any), and other TUs are not | ||||
// permitted to run the initializer for this variable. | // permitted to run the initializer for this variable. | ||||
// CHECK-DAG: @_ZW6Module19inline_var_exported = linkonce_odr {{(dso_local )?}}global | // CHECK-DAG: @_ZW6Module19inline_var_exported = linkonce_odr {{(dso_local )?}}global | ||||
// CHECK-DAG: @_ZW6Module18const_var_exported = {{(dso_local )?}}constant | // CHECK-DAG: @_ZW6Module18const_var_exported = {{(dso_local )?}}constant | ||||
// | // | ||||
// CHECK-DAG: @_ZW6Module25extern_var_module_linkage = external {{(dso_local )?}}global | // CHECK-DAG: @_ZW6Module25extern_var_module_linkage = external {{(dso_local )?}}global | ||||
// FIXME: Should this be 'weak_odr global'? Presumably it must be, since we | // FIXME: Should this be 'weak_odr global'? Presumably it must be, since we | ||||
// can discard this global and its initializer (if any), and other TUs are not | // can discard this global and its initializer (if any), and other TUs are not | ||||
// permitted to run the initializer for this variable. | // permitted to run the initializer for this variable. | ||||
// CHECK-DAG: @_ZW6Module25inline_var_module_linkage = linkonce_odr {{(dso_local )?}}global | // CHECK-DAG: @_ZW6Module25inline_var_module_linkage = linkonce_odr {{(dso_local )?}}global | ||||
// CHECK-DAG: @_ZL25static_var_module_linkage = internal | // CHECK-DAG: @_ZL25static_var_module_linkage = internal | ||||
// CHECK-DAG: @_ZL24const_var_module_linkage = internal | // CHECK-DAG: @_ZW6Module24const_var_module_linkage = {{(dso_local )?}}constant | ||||
// | // | ||||
// CHECK-DAG: @_ZW6Module25unused_var_module_linkage = {{(dso_local )?}}global i32 4 | // CHECK-DAG: @_ZW6Module25unused_var_module_linkage = {{(dso_local )?}}global i32 4 | ||||
module; | module; | ||||
static void unused_static_global_module() {} | static void unused_static_global_module() {} | ||||
static void used_static_global_module() {} | static void used_static_global_module() {} | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | |||||
// CHECK-DAG: @_ZW6Module19extern_var_exported = external {{(dso_local )?}}global | // CHECK-DAG: @_ZW6Module19extern_var_exported = external {{(dso_local )?}}global | ||||
// CHECK-DAG: @_ZW6Module19inline_var_exported = linkonce_odr {{(dso_local )?}}global | // CHECK-DAG: @_ZW6Module19inline_var_exported = linkonce_odr {{(dso_local )?}}global | ||||
// CHECK-DAG: @_ZW6Module18const_var_exported = available_externally {{(dso_local )?}}constant i32 3, | // CHECK-DAG: @_ZW6Module18const_var_exported = available_externally {{(dso_local )?}}constant i32 3, | ||||
// | // | ||||
// CHECK-DAG: @_ZW6Module25extern_var_module_linkage = external {{(dso_local )?}}global | // CHECK-DAG: @_ZW6Module25extern_var_module_linkage = external {{(dso_local )?}}global | ||||
// CHECK-DAG: @_ZW6Module25inline_var_module_linkage = linkonce_odr {{(dso_local )?}}global | // CHECK-DAG: @_ZW6Module25inline_var_module_linkage = linkonce_odr {{(dso_local )?}}global | ||||
// CHECK-DAG: @_ZL25static_var_module_linkage = internal {{(dso_local )?}}global i32 0, | // CHECK-DAG: @_ZL25static_var_module_linkage = internal {{(dso_local )?}}global i32 0, | ||||
// CHECK-DAG: @_ZL24const_var_module_linkage = internal {{(dso_local )?}}constant i32 3, | // CHECK-DAG: @_ZW6Module24const_var_module_linkage = available_externally {{(dso_local )?}}constant i32 3, | ||||
module Module; | module Module; | ||||
void use() { | void use() { | ||||
// CHECK: define linkonce_odr {{.*}}@_ZW6Module20used_inline_exportedv | // CHECK: define linkonce_odr {{.*}}@_ZW6Module20used_inline_exportedv | ||||
used_inline_exported(); | used_inline_exported(); | ||||
// CHECK: declare {{.*}}@_ZW6Module18noninline_exportedv | // CHECK: declare {{.*}}@_ZW6Module18noninline_exportedv | ||||
noninline_exported(); | noninline_exported(); | ||||
Show All 40 Lines |