simple_init.carbon 1.1 KB

12345678910111213141516171819202122232425
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/global/simple_init.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/global/simple_init.carbon
  10. var a: i32 = 0;
  11. // CHECK:STDOUT: ; ModuleID = 'simple_init.carbon'
  12. // CHECK:STDOUT: source_filename = "simple_init.carbon"
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: @a = internal global i32
  15. // CHECK:STDOUT: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 0, ptr @__global_init, ptr null }]
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: define void @__global_init() {
  18. // CHECK:STDOUT: entry:
  19. // CHECK:STDOUT: store i32 0, ptr @a, align 4
  20. // CHECK:STDOUT: ret void
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: ; uselistorder directives
  24. // CHECK:STDOUT: uselistorder i32 0, { 1, 0 }