diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-07-07 20:04:28 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-07-07 20:04:28 +0000 |
commit | 1283e9868d2c1cbf31a834bb5151af6d046c1cb3 (patch) | |
tree | d8a0ea5f202e996293ae22a4487e81b466174cad /clang/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp | |
parent | 77235d345eb11a3705fbb93196eb7817734402a9 (diff) | |
download | bcm5719-llvm-1283e9868d2c1cbf31a834bb5151af6d046c1cb3.tar.gz bcm5719-llvm-1283e9868d2c1cbf31a834bb5151af6d046c1cb3.zip |
[modules ts] Basic for module linkage.
In addition to the formal linkage rules, the Modules TS includes cases where
internal-linkage symbols within a module interface unit can be referenced from
outside the module via exported inline functions / templates. We give such
declarations "module-internal linkage", which is formally internal linkage, but
results in an externally-visible symbol.
llvm-svn: 307434
Diffstat (limited to 'clang/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp')
-rw-r--r-- | clang/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/clang/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp b/clang/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp index c8b8725ed2a..dc6a3635a8e 100644 --- a/clang/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp +++ b/clang/test/CXX/modules-ts/basic/basic.def.odr/p4/module.cpp @@ -1,6 +1,19 @@ // RUN: %clang_cc1 -fmodules-ts %S/module.cppm -triple %itanium_abi_triple -emit-module-interface -o %t // RUN: %clang_cc1 -fmodules-ts %s -triple %itanium_abi_triple -fmodule-file=%t -emit-llvm -o - | FileCheck %s --implicit-check-not=unused --implicit-check-not=global_module +// CHECK-DAG: @extern_var_exported = external global +// FIXME: Should this be 'external global'? +// CHECK-DAG: @inline_var_exported = linkonce_odr global +// CHECK-DAG: @_ZL19static_var_exported = external global +// CHECK-DAG: @const_var_exported = external constant +// +// FIXME: The module name should be mangled into all of these. +// CHECK-DAG: @extern_var_module_linkage = external global +// FIXME: Should this be 'external global'? +// CHECK-DAG: @inline_var_module_linkage = linkonce_odr global +// CHECK-DAG: @_ZL25static_var_module_linkage = external global +// CHECK-DAG: @_ZL24const_var_module_linkage = external constant + module Module; void use() { @@ -9,8 +22,13 @@ void use() { // CHECK: declare {{.*}}@_Z18noninline_exportedv noninline_exported(); + (void)&extern_var_exported; + (void)&inline_var_exported; + (void)&static_var_exported; // FIXME: Should not be exported. + (void)&const_var_exported; + // FIXME: This symbol should not be visible here. - // CHECK: define internal {{.*}}@_ZL26used_static_module_linkagev + // CHECK: declare {{.*}}@_ZL26used_static_module_linkagev used_static_module_linkage(); // FIXME: The module name should be mangled into the name of this function. @@ -20,4 +38,9 @@ void use() { // FIXME: The module name should be mangled into the name of this function. // CHECK: declare {{.*}}@_Z24noninline_module_linkagev noninline_module_linkage(); + + (void)&extern_var_module_linkage; + (void)&inline_var_module_linkage; + (void)&static_var_module_linkage; // FIXME: Should not be visible here. + (void)&const_var_module_linkage; } |