Files
carbon-lang/toolchain/lowering/testdata/struct/empty.carbon
T
Jon Ross-Perkins 75f1ac3a08 Add names for LLVM IR entries. (#2832)
This adds names for more LLVM IR entries. For now, `var` is just a placeholder due to the difficulty of associating a name, but the rest reasonably reflect intent.

I'm trying to comment logic for this because I suspect we'll want to make it more conditional later. Even though chandlerc noted the expectation that IRBuilder would have a way to disable them in output, that's fine for things like anonymous names; other places they'll still take extra work to calculate. e.g., as with struct fields where the type's fields are only fetched to print a name, not otherwise needed for the gep.
2023-05-18 12:08:09 -07:00

24 lines
732 B
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
//
// AUTOUPDATE
// CHECK:STDOUT: ; ModuleID = 'empty.carbon'
// CHECK:STDOUT: source_filename = "empty.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: %EmptyStructType = type {}
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @Run() {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %var = alloca %EmptyStructType, align 8
// CHECK:STDOUT: %var1 = alloca %EmptyStructType, align 8
// CHECK:STDOUT: store ptr %var, ptr %var1, align 8
// CHECK:STDOUT: ret i32 0
// CHECK:STDOUT: }
fn Run() -> i32 {
var x: {} = {};
var y: {} = x;
return 0;
}