I've decided to try out binding llvm to felix, and I'm getting some
strange error messages:

Other exn = Flx_exceptions.Free_fixpoint(_)
Warning: typeclass Builder entry create_at_end is not virtual
Warning: typeclass Builder entry create_before is not virtual

Here's my code. "create_at_end" is definitely marked virtual. If I
swap to using "fun" instead of "gen" though it doesn't print this out.
I wonder what's going on. Oh and the commented out "dispose" doesn't
seem to work either.


include "std";

module llvm {
  header basicblock_h = "#include <llvm/BasicBlock.h>";
  header instructions_h = "#include <llvm/Instructions.h>";
  header support_llvmbuilder_h = "#include <llvm/Support/LLVMBuilder.h";

  module Instruction {
    requires instructions_h;
    type t = "llvm::Instruction*";
  }

  module BasicBlock {
    requires basicblock_h;
    type t = "llvm::BasicBlock*";
  }

  typeclass Builder[t] {
    // Create a builder.
    virtual gen create: unit -> t;

    // Create a builder and set it before the instruction.
    virtual gen create_before (bb:BasicBlock::t, i:Instruction::t) = {
      val b = create ();
      set_insert_point (b, bb, i);
      return b;
    }

    // Create a builder at the end of a basic block.
    virtual gen create_at_end (bb:BasicBlock::t) = {
      val b = create ();
      set_insert_point (b, bb);
      return b;
    }

    // Destroy the builder.
    proc dispose: t -> unit = "delete $1;";

    // Set the insertion at the end of the basic block.
    proc set_insert_point: t * BasicBlock::t = "$1->SetInsertPoint($2);";

    // Set the insertion point before the instruction.
    proc set_insert_point: t * BasicBlock::t * Instruction::t =
"$1->SetInsertPoint($2, $3);";
  }

  module LLVMBuilder {
    requires support_llvmbuilder_h;
    type t = "llvm::LLVMBuilder*";

    instance Builder[t] {
      gen create: unit -> t = "new llvm::LLVMBuilder();";
    }
  }
}

open llvm::Builder[llvm::LLVMBuilder::t];

val b = create ();
//dispose b;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to