MichaReiser / llvm-node

LLVM 9.0+ Node Bindings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DIBuilder class

vihanb opened this issue · comments

commented

LLVM has a LLVM::DIBuilder which provides tools for creating debug information.

I'll attempt to make a PR for this in the upcoming weeks.

Hy vihanb.

Let me know if you need any help to get started. I'm happy to assist you and look forward for the DIBuilder. Something I probably could also make use of in my other project.

commented

Hi, so today I was working on implementing some of the DIBuilder classes and due to the similarity between DIBuilder and IRBuilder I was referencing the existing IRBuilder implementation to help me make the DIBuilder bindings.

One item I had a question on however is why the constructor is implemented as a static function that just returns the static constructor instance rather than just being a static variable?

static inline Nan::Persistent<v8::Function>& irBuilderConstructor() {
static Nan::Persistent<v8::Function> constructor {};
return constructor;
}

@vihanb Sorry that I didn't found the time to reply to you sooner.

I don't remember but my assumption is that the reason is that I've done the same in all other files, e.g. the integer-type. It makes more sense for those types to use a function since the template configuration code is inside of the factory function but no such code is needed for the IRBuilder.