mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-16 12:48:10 +00:00
Export function default values to C++ (#7988)
Adds code to track default values for function parameters in C++ export, and to export them as global variables to C++ that are attached to default value expressions in the clang AST. Modifes lower to export global variables from another block, and adds the variable initialization to the `global_init` block so their value gets set at load time.
This commit is contained in:
1 parent
505c4ae308
commit
9799a23262
20 files changed
+865
-449
No files matched your search
@@ -0,0 +1,26 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
|
||||
//
|
||||
// AUTOUPDATE
|
||||
// TIP: To test this file alone, run:
|
||||
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/export/default_values.carbon
|
||||
// TIP: To dump output, run:
|
||||
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/export/default_values.carbon
|
||||
|
||||
// --- other.carbon
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
fn F(unused i: i32 = 0) {}
|
||||
|
||||
// --- import.carbon
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
import library "other";
|
||||
import Cpp inline '''
|
||||
void CallF() {
|
||||
Carbon::F();
|
||||
}
|
||||
''';
|
||||
Reference in new issue
Block a user