mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-30 09:35:04 +01:00
This is in support of a goal of changing the blanket `destroy` impl to
use (roughly):
```
private fn CanAggregateDestroy() -> type = "type.can_aggregate_destroy";
// Handles aggregate type destruction.
impl forall [AggregateDestroyT:! CanAggregateDestroy()] AggregateDestroyT as Destroy {
fn Op[addr self: Self*]() = "type.aggregate_destroy";
}
```
That isn't done here because there's still other issues that migrating
raises. What this *does* do is add the builtin functions, and in
particular, support to `FacetTypeInfo` to make `CanAggregateDestroy`
work.
The "special requirement" approach in `FacetTypeInfo` allows us to
support restricting a blanket impl under the current approach of impls.
Maybe we'll find a cleaner approach that can work in the future, but
this fits into the current model by propagating similar to other
requirements. I'm using an enum mask because we have a number of similar
things to add (e.g. copy, move) but I'm not sure we need a full vector.
A few alternatives considered were:
- Supporting syntax more like `where .Self impls
TypeCanAggregateDestroy(.Self, SupportedInterface,
UnsupportedInterface)`. I think it'd be a little cleaner, but requires
better compile-time evaluation in order to assess the type of the call.
Right now it's expected to be a `FacetType` too early to make this work,
and I was concerned about pouring too much more time down this route.
- Providing an actual interface, in particular doing name lookup back
into `Core.` for an interface. This would've added name lookup overhead,
and the question of whether an `impl` exists.
- Generating an interface. This avoids the name lookup, but would still
raise the question of whether an `impl` should also be generated. Work
I've previously done generating interfaces for class destruction also
feels complex to both write and understand (an unfortunate issue).
- Still modeling as an `ImplsConstraint`, for example by defining a
special `InterfaceId::CanAggregateDestroy = -2` similar to what we do on
other ids. I was hesitant because of how this expands the number of
modes of `InterfaceId`, and things for consuming code to watch out for,
for what feels like a relatively niche set of use-cases that are only
interface-like.
---------
Co-authored-by: Dana Jansens <danakj@orodu.net>
441 lines
18 KiB
Plaintext
441 lines
18 KiB
Plaintext
// 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/primitives.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/namespace.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/namespace.carbon
|
|
|
|
// ============================================================================
|
|
// Single
|
|
// ============================================================================
|
|
|
|
// --- single.h
|
|
|
|
namespace my_namespace { void foo(); }
|
|
|
|
// --- import_single.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp library "single.h";
|
|
|
|
fn MyF() {
|
|
//@dump-sem-ir-begin
|
|
Cpp.my_namespace.foo();
|
|
//@dump-sem-ir-end
|
|
}
|
|
|
|
// --- fail_import_namespace_wrong_member_name.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp library "single.h";
|
|
|
|
fn MyF() {
|
|
// CHECK:STDERR: fail_import_namespace_wrong_member_name.carbon:[[@LINE+4]]:3: error: member name `not_foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope]
|
|
// CHECK:STDERR: Cpp.my_namespace.not_foo();
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
Cpp.my_namespace.not_foo();
|
|
}
|
|
|
|
// --- fail_import_namespace_wrong_name.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp library "single.h";
|
|
|
|
fn MyF() {
|
|
// CHECK:STDERR: fail_import_namespace_wrong_name.carbon:[[@LINE+4]]:3: error: member name `not_my_namespace` not found in `Cpp` [MemberNameNotFoundInInstScope]
|
|
// CHECK:STDERR: Cpp.not_my_namespace.foo();
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
|
|
// CHECK:STDERR:
|
|
Cpp.not_my_namespace.foo();
|
|
}
|
|
|
|
// ============================================================================
|
|
// Multiple
|
|
// ============================================================================
|
|
|
|
// --- multiple.h
|
|
|
|
namespace my_namespace1 {
|
|
void foo1();
|
|
namespace my_namespace2 {
|
|
void foo2();
|
|
namespace my_namespace3 {
|
|
void foo3();
|
|
}
|
|
}
|
|
}
|
|
|
|
// --- import_multiple.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp library "multiple.h";
|
|
|
|
fn MyF() {
|
|
//@dump-sem-ir-begin
|
|
Cpp.my_namespace1.foo1();
|
|
Cpp.my_namespace1.my_namespace2.foo2();
|
|
Cpp.my_namespace1.my_namespace2.my_namespace3.foo3();
|
|
//@dump-sem-ir-end
|
|
}
|
|
|
|
// ============================================================================
|
|
// Inline namespace
|
|
// ============================================================================
|
|
|
|
// --- inline.h
|
|
|
|
inline namespace { namespace N { inline namespace { void foo(); } } }
|
|
|
|
// --- import_inline.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp library "inline.h";
|
|
|
|
fn MyF() {
|
|
//@dump-sem-ir-begin
|
|
Cpp.N.foo();
|
|
//@dump-sem-ir-end
|
|
}
|
|
|
|
// ============================================================================
|
|
// Inline namespace triggers ambiguity
|
|
// ============================================================================
|
|
|
|
// --- inline_ambiguity.h
|
|
|
|
namespace N { void foo(); }
|
|
inline namespace { namespace N {} }
|
|
|
|
// --- fail_import_inline_ambiguity.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp library "inline_ambiguity.h";
|
|
|
|
fn MyF() {
|
|
// Artificially create an error message here so that the first error line for
|
|
// this file (which otherwise has no source location) is associated with this
|
|
// file split.
|
|
// TODO: Pass a location into Clang when performing C++ name lookup so that
|
|
// its error has a location attached.
|
|
// CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE+13]]:3: error: name `error` not found [NameNotFound]
|
|
// CHECK:STDERR: error;
|
|
// CHECK:STDERR: ^~~~~
|
|
// CHECK:STDERR:
|
|
// CHECK:STDERR: error: reference to 'N' is ambiguous [CppInteropParseError]
|
|
// CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE-13]]:10: in file included here [InCppInclude]
|
|
// CHECK:STDERR: ./inline_ambiguity.h:2:11: note: candidate found by name lookup is 'N' [CppInteropParseNote]
|
|
// CHECK:STDERR: 2 | namespace N { void foo(); }
|
|
// CHECK:STDERR: | ^
|
|
// CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE-17]]:10: in file included here [InCppInclude]
|
|
// CHECK:STDERR: ./inline_ambiguity.h:3:30: note: candidate found by name lookup is '(anonymous namespace)::N' [CppInteropParseNote]
|
|
// CHECK:STDERR: 3 | inline namespace { namespace N {} }
|
|
// CHECK:STDERR: | ^
|
|
error;
|
|
|
|
// CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `N` [InCppNameLookup]
|
|
// CHECK:STDERR: Cpp.N.foo();
|
|
// CHECK:STDERR: ^~~~~
|
|
// CHECK:STDERR:
|
|
Cpp.N.foo();
|
|
}
|
|
|
|
// ============================================================================
|
|
// Inline namespace ambiguity not triggered
|
|
// ============================================================================
|
|
|
|
// --- inline_ambiguity_not_triggered.h
|
|
|
|
namespace N { struct X {}; }
|
|
auto foo() -> N::X;
|
|
inline namespace { namespace N {} }
|
|
|
|
// --- import_inline_ambiguity_not_triggered.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp library "inline_ambiguity_not_triggered.h";
|
|
|
|
fn MyF() {
|
|
//@dump-sem-ir-begin
|
|
Cpp.foo();
|
|
//@dump-sem-ir-end
|
|
}
|
|
|
|
// ============================================================================
|
|
// Carbon keyword name
|
|
// ============================================================================
|
|
|
|
// --- special_name.h
|
|
|
|
namespace base { void foo(); }
|
|
|
|
// --- fail_import_special_name_call_unescpaed.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp library "special_name.h";
|
|
|
|
fn MyF() {
|
|
// CHECK:STDERR: fail_import_special_name_call_unescpaed.carbon:[[@LINE+4]]:3: error: member name `base` not found in `Cpp` [MemberNameNotFoundInInstScope]
|
|
// CHECK:STDERR: Cpp.base.foo();
|
|
// CHECK:STDERR: ^~~~~~~~
|
|
// CHECK:STDERR:
|
|
Cpp.base.foo();
|
|
}
|
|
|
|
// --- import_special_name_call_escpaed.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp library "special_name.h";
|
|
|
|
fn MyF() {
|
|
//@dump-sem-ir-begin
|
|
Cpp.r#base.foo();
|
|
//@dump-sem-ir-end
|
|
}
|
|
|
|
// ============================================================================
|
|
// Nested namespaces.
|
|
// ============================================================================
|
|
|
|
// --- nested.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp inline '''
|
|
namespace A {
|
|
namespace B {
|
|
namespace C {
|
|
struct X { int n; };
|
|
}
|
|
}
|
|
}
|
|
|
|
struct Y {
|
|
A::B::C::X x;
|
|
};
|
|
''';
|
|
|
|
fn Use(y: Cpp.Y) -> i32 {
|
|
return y.x.n;
|
|
}
|
|
|
|
// CHECK:STDOUT: --- import_single.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %.1f4: type = cpp_overload_set_type @foo [concrete]
|
|
// CHECK:STDOUT: %empty_struct: %.1f4 = struct_value () [concrete]
|
|
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
|
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
|
// CHECK:STDOUT: .my_namespace = %my_namespace
|
|
// CHECK:STDOUT: import Cpp//...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %my_namespace: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .foo = %.6d2
|
|
// CHECK:STDOUT: import Cpp//...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %.6d2: %.1f4 = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @MyF() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
|
// CHECK:STDOUT: %my_namespace.ref: <namespace> = name_ref my_namespace, imports.%my_namespace [concrete = imports.%my_namespace]
|
|
// CHECK:STDOUT: %foo.ref: %.1f4 = name_ref foo, imports.%.6d2 [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl()
|
|
// CHECK:STDOUT: <elided>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- import_multiple.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %.9b0: type = cpp_overload_set_type @foo3 [concrete]
|
|
// CHECK:STDOUT: %empty_struct.19f: %.9b0 = struct_value () [concrete]
|
|
// CHECK:STDOUT: %foo1.type: type = fn_type @foo1 [concrete]
|
|
// CHECK:STDOUT: %foo1: %foo1.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %.7f6: type = cpp_overload_set_type @<null name> [concrete]
|
|
// CHECK:STDOUT: %empty_struct.a22: %.7f6 = struct_value () [concrete]
|
|
// CHECK:STDOUT: %foo2.type: type = fn_type @foo2 [concrete]
|
|
// CHECK:STDOUT: %foo2: %foo2.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %.ca1: type = cpp_overload_set_type @<null name> [concrete]
|
|
// CHECK:STDOUT: %empty_struct.7d1: %.ca1 = struct_value () [concrete]
|
|
// CHECK:STDOUT: %foo3.type: type = fn_type @foo3 [concrete]
|
|
// CHECK:STDOUT: %foo3: %foo3.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
|
// CHECK:STDOUT: .my_namespace1 = %my_namespace1
|
|
// CHECK:STDOUT: import Cpp//...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %my_namespace1: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .foo1 = %.74a
|
|
// CHECK:STDOUT: .my_namespace2 = %my_namespace2
|
|
// CHECK:STDOUT: import Cpp//...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %.74a: %.9b0 = cpp_overload_set_value @foo3 [concrete = constants.%empty_struct.19f]
|
|
// CHECK:STDOUT: %foo1.decl: %foo1.type = fn_decl @foo1 [concrete = constants.%foo1] {} {}
|
|
// CHECK:STDOUT: %my_namespace2: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .foo2 = %.76b
|
|
// CHECK:STDOUT: .my_namespace3 = %my_namespace3
|
|
// CHECK:STDOUT: import Cpp//...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %.76b: %.7f6 = cpp_overload_set_value @<null name> [concrete = constants.%empty_struct.a22]
|
|
// CHECK:STDOUT: %foo2.decl: %foo2.type = fn_decl @foo2 [concrete = constants.%foo2] {} {}
|
|
// CHECK:STDOUT: %my_namespace3: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .foo3 = %.d17
|
|
// CHECK:STDOUT: import Cpp//...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %.d17: %.ca1 = cpp_overload_set_value @<null name> [concrete = constants.%empty_struct.7d1]
|
|
// CHECK:STDOUT: %foo3.decl: %foo3.type = fn_decl @foo3 [concrete = constants.%foo3] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @MyF() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
|
// CHECK:STDOUT: %my_namespace1.ref.loc8: <namespace> = name_ref my_namespace1, imports.%my_namespace1 [concrete = imports.%my_namespace1]
|
|
// CHECK:STDOUT: %foo1.ref: %.9b0 = name_ref foo1, imports.%.74a [concrete = constants.%empty_struct.19f]
|
|
// CHECK:STDOUT: %foo1.call: init %empty_tuple.type = call imports.%foo1.decl()
|
|
// CHECK:STDOUT: %Cpp.ref.loc9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
|
// CHECK:STDOUT: %my_namespace1.ref.loc9: <namespace> = name_ref my_namespace1, imports.%my_namespace1 [concrete = imports.%my_namespace1]
|
|
// CHECK:STDOUT: %my_namespace2.ref.loc9: <namespace> = name_ref my_namespace2, imports.%my_namespace2 [concrete = imports.%my_namespace2]
|
|
// CHECK:STDOUT: %foo2.ref: %.7f6 = name_ref foo2, imports.%.76b [concrete = constants.%empty_struct.a22]
|
|
// CHECK:STDOUT: %foo2.call: init %empty_tuple.type = call imports.%foo2.decl()
|
|
// CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
|
// CHECK:STDOUT: %my_namespace1.ref.loc10: <namespace> = name_ref my_namespace1, imports.%my_namespace1 [concrete = imports.%my_namespace1]
|
|
// CHECK:STDOUT: %my_namespace2.ref.loc10: <namespace> = name_ref my_namespace2, imports.%my_namespace2 [concrete = imports.%my_namespace2]
|
|
// CHECK:STDOUT: %my_namespace3.ref: <namespace> = name_ref my_namespace3, imports.%my_namespace3 [concrete = imports.%my_namespace3]
|
|
// CHECK:STDOUT: %foo3.ref: %.ca1 = name_ref foo3, imports.%.d17 [concrete = constants.%empty_struct.7d1]
|
|
// CHECK:STDOUT: %foo3.call: init %empty_tuple.type = call imports.%foo3.decl()
|
|
// CHECK:STDOUT: <elided>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- import_inline.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %.b35: type = cpp_overload_set_type @foo [concrete]
|
|
// CHECK:STDOUT: %empty_struct: %.b35 = struct_value () [concrete]
|
|
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
|
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
|
// CHECK:STDOUT: .N = %N
|
|
// CHECK:STDOUT: import Cpp//...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %N: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .foo = %.595
|
|
// CHECK:STDOUT: import Cpp//...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %.595: %.b35 = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @MyF() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
|
// CHECK:STDOUT: %N.ref: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
|
|
// CHECK:STDOUT: %foo.ref: %.b35 = name_ref foo, imports.%.595 [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl()
|
|
// CHECK:STDOUT: <elided>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- import_inline_ambiguity_not_triggered.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %X: type = class_type @X [concrete]
|
|
// CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @foo [concrete]
|
|
// CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
|
|
// CHECK:STDOUT: %ptr.13d: type = ptr_type %X [concrete]
|
|
// CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
|
|
// CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: %T.as.Destroy.impl.Op.type.e9c: type = fn_type @T.as.Destroy.impl.Op, @T.as.Destroy.impl(%X) [concrete]
|
|
// CHECK:STDOUT: %T.as.Destroy.impl.Op.d48: %T.as.Destroy.impl.Op.type.e9c = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
|
// CHECK:STDOUT: .foo = %.a21
|
|
// CHECK:STDOUT: import Cpp//...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
|
|
// CHECK:STDOUT: <elided>
|
|
// CHECK:STDOUT: } {
|
|
// CHECK:STDOUT: <elided>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @MyF() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
|
// CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %.loc8_11.1: ref %X = temporary_storage
|
|
// CHECK:STDOUT: %addr.loc8_11.1: %ptr.13d = addr_of %.loc8_11.1
|
|
// CHECK:STDOUT: %foo__carbon_thunk.call: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc8_11.1)
|
|
// CHECK:STDOUT: %.loc8_11.2: init %X = in_place_init %foo__carbon_thunk.call, %.loc8_11.1
|
|
// CHECK:STDOUT: %.loc8_11.3: ref %X = temporary %.loc8_11.1, %.loc8_11.2
|
|
// CHECK:STDOUT: %T.as.Destroy.impl.Op.bound: <bound method> = bound_method %.loc8_11.3, constants.%T.as.Destroy.impl.Op.d48
|
|
// CHECK:STDOUT: <elided>
|
|
// CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc8_11.3, %T.as.Destroy.impl.Op.specific_fn
|
|
// CHECK:STDOUT: %addr.loc8_11.2: %ptr.13d = addr_of %.loc8_11.3
|
|
// CHECK:STDOUT: %T.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%addr.loc8_11.2)
|
|
// CHECK:STDOUT: <elided>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: --- import_special_name_call_escpaed.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
|
|
// CHECK:STDOUT: %.6e5: type = cpp_overload_set_type @foo [concrete]
|
|
// CHECK:STDOUT: %empty_struct: %.6e5 = struct_value () [concrete]
|
|
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
|
|
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: imports {
|
|
// CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
|
|
// CHECK:STDOUT: .r#base = %base
|
|
// CHECK:STDOUT: import Cpp//...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %base: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .foo = %.0b7
|
|
// CHECK:STDOUT: import Cpp//...
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %.0b7: %.6e5 = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @MyF() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
|
|
// CHECK:STDOUT: %base.ref: <namespace> = name_ref r#base, imports.%base [concrete = imports.%base]
|
|
// CHECK:STDOUT: %foo.ref: %.6e5 = name_ref foo, imports.%.0b7 [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl()
|
|
// CHECK:STDOUT: <elided>
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|