[PATCH] D52239: [OCaml] Add OCaml APIs to access DebugLoc info

Josh Berdine via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 29 15:34:52 PDT 2018


jberdine added inline comments.


================
Comment at: bindings/ocaml/llvm/llvm_ocaml.c:873
+  if ((Chars = LLVMGetDebugLocDirectory(Val, &Length))) {
+    CAMLlocal2(Option, String);
+    String = caml_alloc_string(Length);
----------------
jberdine wrote:
> whitequark wrote:
> > Is it legal to use `CAMLlocal2` in a conditional like this?
> No, nice catch! The manual states:
> 
> > Local variables of type value must be declared with one of the CAMLlocal macros. [...] These macros must be used at the beginning of the function, not in a nested block.
> 
> Note that there are a number of existing instances of `CAMLlocal` in nested blocks in this file. Shall I change them at the same time?
Other CAMLlocal changes are in D53841 for reference, I'm happy to merge the patches or not either way.


Repository:
  rL LLVM

https://reviews.llvm.org/D52239





More information about the llvm-commits mailing list