no_else.carbon 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 F() {}
  7. fn G() {}
  8. fn If(b: bool) {
  9. if (b) {
  10. F();
  11. }
  12. G();
  13. }
  14. // CHECK:STDOUT: --- no_else.carbon
  15. // CHECK:STDOUT:
  16. // CHECK:STDOUT: constants {
  17. // CHECK:STDOUT: %F: type = fn_type @F [template]
  18. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  19. // CHECK:STDOUT: %struct.1: F = struct_value () [template]
  20. // CHECK:STDOUT: %G: type = fn_type @G [template]
  21. // CHECK:STDOUT: %struct.2: G = struct_value () [template]
  22. // CHECK:STDOUT: %If: type = fn_type @If [template]
  23. // CHECK:STDOUT: %struct.3: If = struct_value () [template]
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT:
  26. // CHECK:STDOUT: file {
  27. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  28. // CHECK:STDOUT: .Core = %Core
  29. // CHECK:STDOUT: .F = %F.decl
  30. // CHECK:STDOUT: .G = %G.decl
  31. // CHECK:STDOUT: .If = %If.decl
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  34. // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {}
  35. // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {}
  36. // CHECK:STDOUT: %If.decl: If = fn_decl @If [template = constants.%struct.3] {
  37. // CHECK:STDOUT: %b.loc10_7.1: bool = param b
  38. // CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc10_7.1
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT: }
  41. // CHECK:STDOUT:
  42. // CHECK:STDOUT: fn @F() {
  43. // CHECK:STDOUT: !entry:
  44. // CHECK:STDOUT: return
  45. // CHECK:STDOUT: }
  46. // CHECK:STDOUT:
  47. // CHECK:STDOUT: fn @G() {
  48. // CHECK:STDOUT: !entry:
  49. // CHECK:STDOUT: return
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT:
  52. // CHECK:STDOUT: fn @If(%b: bool) {
  53. // CHECK:STDOUT: !entry:
  54. // CHECK:STDOUT: %b.ref: bool = name_ref b, %b
  55. // CHECK:STDOUT: if %b.ref br !if.then else br !if.else
  56. // CHECK:STDOUT:
  57. // CHECK:STDOUT: !if.then:
  58. // CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1]
  59. // CHECK:STDOUT: %F.call: init () = call %F.ref()
  60. // CHECK:STDOUT: br !if.else
  61. // CHECK:STDOUT:
  62. // CHECK:STDOUT: !if.else:
  63. // CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2]
  64. // CHECK:STDOUT: %G.call: init () = call %G.ref()
  65. // CHECK:STDOUT: return
  66. // CHECK:STDOUT: }
  67. // CHECK:STDOUT: