forward_decl.carbon 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  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/check/testdata/function/definition/no_prelude/forward_decl.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/no_prelude/forward_decl.carbon
  10. fn Foo();
  11. fn Foo() {}
  12. // CHECK:STDOUT: --- forward_decl.carbon
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: constants {
  15. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  16. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  17. // CHECK:STDOUT: }
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: file {
  20. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  21. // CHECK:STDOUT: .Foo = %Foo.decl.loc11
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT: %Foo.decl.loc11: %Foo.type = fn_decl @Foo [template = constants.%Foo] {} {}
  24. // CHECK:STDOUT: %Foo.decl.loc13: %Foo.type = fn_decl @Foo [template = constants.%Foo] {} {}
  25. // CHECK:STDOUT: }
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: fn @Foo() {
  28. // CHECK:STDOUT: !entry:
  29. // CHECK:STDOUT: return
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT: