File: loc_stack.ml.ref

package info (click to toggle)
ocamlformat 0.28.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,436 kB
  • sloc: ml: 63,321; pascal: 4,769; lisp: 229; sh: 217; makefile: 121
file content (33 lines) | stat: -rw-r--r-- 956 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
let _ =
  (* a *)
  (* b *)
  2

let _ =
  (* before match *)
  match (* after match *) x with
  | _ -> 1

let _ =
  (* before try *)
  try (* after try *) x with _ -> 1

let should_inline : Llvm.llvalue -> bool =
 fun llv ->
  match Llvm.use_begin llv with
  | Some use -> (
      match Llvm.use_succ use with
      | Some _ -> (
          (* If we are not in the default context, we can only use the OCAMLPATH
         variable if it is specific to this build context *)
          (* CR-someday diml: maybe we should actually clear OCAMLPATH in other
         build contexts *)
          match Llvm.classify_value llv with
          | Instruction
              ( Trunc | ZExt | SExt | FPToUI | FPToSI | UIToFP | SIToFP
              | FPTrunc | FPExt | PtrToInt | IntToPtr | BitCast | AddrSpaceCast
                ) ->
              true (* inline casts *)
          | _ -> false (* do not inline if >= 2 uses *))
      | None -> true)
  | None -> true