basic.carbon 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. fn A(p: const i32**) -> const i32** {
  7. return p;
  8. }
  9. fn B(p: const (i32*)) -> const (i32*) {
  10. return p;
  11. }
  12. // CHECK:STDOUT: --- basic.carbon
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: constants {
  15. // CHECK:STDOUT: %.1: type = const_type i32 [template]
  16. // CHECK:STDOUT: %.2: type = ptr_type const i32 [template]
  17. // CHECK:STDOUT: %.3: type = ptr_type const i32* [template]
  18. // CHECK:STDOUT: %.4: type = ptr_type i32 [template]
  19. // CHECK:STDOUT: %.5: type = const_type i32* [template]
  20. // CHECK:STDOUT: }
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: file {
  23. // CHECK:STDOUT: package: <namespace> = namespace {.A = %A, .B = %B} [template]
  24. // CHECK:STDOUT: %A: <function> = fn_decl @A {
  25. // CHECK:STDOUT: %.loc7_9: type = const_type i32 [template = constants.%.1]
  26. // CHECK:STDOUT: %.loc7_18: type = ptr_type const i32 [template = constants.%.2]
  27. // CHECK:STDOUT: %.loc7_19: type = ptr_type const i32* [template = constants.%.3]
  28. // CHECK:STDOUT: %p.loc7_6.1: const i32** = param p
  29. // CHECK:STDOUT: @A.%p: const i32** = bind_name p, %p.loc7_6.1
  30. // CHECK:STDOUT: %.loc7_25: type = const_type i32 [template = constants.%.1]
  31. // CHECK:STDOUT: %.loc7_34: type = ptr_type const i32 [template = constants.%.2]
  32. // CHECK:STDOUT: %.loc7_35: type = ptr_type const i32* [template = constants.%.3]
  33. // CHECK:STDOUT: %return.var.loc7: ref const i32** = var <return slot>
  34. // CHECK:STDOUT: } [template]
  35. // CHECK:STDOUT: %B: <function> = fn_decl @B {
  36. // CHECK:STDOUT: %.loc11_19: type = ptr_type i32 [template = constants.%.4]
  37. // CHECK:STDOUT: %.loc11_9: type = const_type i32* [template = constants.%.5]
  38. // CHECK:STDOUT: %p.loc11_6.1: const (i32*) = param p
  39. // CHECK:STDOUT: @B.%p: const (i32*) = bind_name p, %p.loc11_6.1
  40. // CHECK:STDOUT: %.loc11_36: type = ptr_type i32 [template = constants.%.4]
  41. // CHECK:STDOUT: %.loc11_26: type = const_type i32* [template = constants.%.5]
  42. // CHECK:STDOUT: %return.var.loc11: ref const (i32*) = var <return slot>
  43. // CHECK:STDOUT: } [template]
  44. // CHECK:STDOUT: }
  45. // CHECK:STDOUT:
  46. // CHECK:STDOUT: fn @A(%p: const i32**) -> const i32** {
  47. // CHECK:STDOUT: !entry:
  48. // CHECK:STDOUT: %p.ref: const i32** = name_ref p, %p
  49. // CHECK:STDOUT: return %p.ref
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT:
  52. // CHECK:STDOUT: fn @B(%p: const (i32*)) -> const (i32*) {
  53. // CHECK:STDOUT: !entry:
  54. // CHECK:STDOUT: %p.ref: const (i32*) = name_ref p, %p
  55. // CHECK:STDOUT: return %p.ref
  56. // CHECK:STDOUT: }
  57. // CHECK:STDOUT: