function.carbon 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. namespace Foo;
  7. // Never called, just here to help catch bugs in name lookup.
  8. fn Baz() {
  9. }
  10. fn Foo.Baz() {
  11. }
  12. fn Bar() {
  13. Foo.Baz();
  14. }
  15. // CHECK:STDOUT: --- function.carbon
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: constants {
  18. // CHECK:STDOUT: %Baz.1: type = fn_type @Baz.1 [template]
  19. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  20. // CHECK:STDOUT: %struct.1: Baz = struct_value () [template]
  21. // CHECK:STDOUT: %Baz.2: type = fn_type @Baz.2 [template]
  22. // CHECK:STDOUT: %struct.2: Baz = struct_value () [template]
  23. // CHECK:STDOUT: %Bar: type = fn_type @Bar [template]
  24. // CHECK:STDOUT: %struct.3: Bar = struct_value () [template]
  25. // CHECK:STDOUT: }
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: file {
  28. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  29. // CHECK:STDOUT: .Core = %Core
  30. // CHECK:STDOUT: .Foo = %Foo
  31. // CHECK:STDOUT: .Baz = %Baz.decl.loc10
  32. // CHECK:STDOUT: .Bar = %Bar.decl
  33. // CHECK:STDOUT: }
  34. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  35. // CHECK:STDOUT: %Foo: <namespace> = namespace [template] {
  36. // CHECK:STDOUT: .Baz = %Baz.decl.loc13
  37. // CHECK:STDOUT: }
  38. // CHECK:STDOUT: %Baz.decl.loc10: Baz = fn_decl @Baz.1 [template = constants.%struct.1] {}
  39. // CHECK:STDOUT: %Baz.decl.loc13: Baz = fn_decl @Baz.2 [template = constants.%struct.2] {}
  40. // CHECK:STDOUT: %Bar.decl: Bar = fn_decl @Bar [template = constants.%struct.3] {}
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: fn @Baz.1() {
  44. // CHECK:STDOUT: !entry:
  45. // CHECK:STDOUT: return
  46. // CHECK:STDOUT: }
  47. // CHECK:STDOUT:
  48. // CHECK:STDOUT: fn @Baz.2() {
  49. // CHECK:STDOUT: !entry:
  50. // CHECK:STDOUT: return
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT:
  53. // CHECK:STDOUT: fn @Bar() {
  54. // CHECK:STDOUT: !entry:
  55. // CHECK:STDOUT: %Foo.ref: <namespace> = name_ref Foo, file.%Foo [template = file.%Foo]
  56. // CHECK:STDOUT: %Baz.ref: Baz = name_ref Baz, file.%Baz.decl.loc13 [template = constants.%struct.2]
  57. // CHECK:STDOUT: %Baz.call: init () = call %Baz.ref()
  58. // CHECK:STDOUT: return
  59. // CHECK:STDOUT: }
  60. // CHECK:STDOUT: