Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement missing apis #112

Merged
merged 3 commits into from Aug 19, 2019
Merged

implement missing apis #112

merged 3 commits into from Aug 19, 2019

Conversation

AviAvni
Copy link
Contributor

@AviAvni AviAvni commented Aug 13, 2019

missing apis while porting some of my code from https://www.nuget.org/packages/swigged.llvm/
to LLVMSharp v8

return span.Slice(0, span.IndexOf((byte)'\0')).AsString();
}

public bool EmitToFile(LLVMModuleRef module, string fileName, LLVMCodeGenFileType codegen, out string message)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This should be TryEmitToFile and there should optionally be a corresponding string EmitToFile which throws on failure (this follows the .NET Framework design guidelines).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tannergooding Thanks fixed

{
sbyte* pMessage;

int result = LLVM.TargetMachineEmitToFile(this, module, marshaledFileName, codegen, &pMessage);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the docs, we need to call LLVMDisposeMessage on errorMessage after marshaling it to managed code. It would probably be good to explicitly call it errorMessage as well, so it is clear to the consumer its intent.

Otherwise, the changes LGTM. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tannergooding thanks fixed

@tannergooding tannergooding merged commit f986236 into dotnet:master Aug 19, 2019
@tannergooding
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants