This is an archive of the discontinued LLVM Phabricator instance.

[llvm-c] Expose LLVMContextGetDiagnostic{Handler,Context}
ClosedPublic

Authored by jketema on Apr 6 2016, 3:25 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

jketema updated this revision to Diff 52774.Apr 6 2016, 3:25 AM
jketema retitled this revision from to [llvm-c] Expose LLVMContextGetDiagnostic{Handler,Context}.
jketema updated this object.
jketema added a reviewer: whitequark.
jketema added a subscriber: llvm-commits.
whitequark accepted this revision.Apr 6 2016, 2:48 PM
whitequark edited edge metadata.

LGTM

This revision is now accepted and ready to land.Apr 6 2016, 2:48 PM
whitequark requested changes to this revision.Apr 6 2016, 3:31 PM
whitequark edited edge metadata.

Actually, can you please add a test? The main function of llvm-c-test/echo.cpp seems to be a suitable place to set and then retrieve a diagnostic handler.

This revision now requires changes to proceed.Apr 6 2016, 3:31 PM

I was wondering what a suitable place for a test was. Thanks for the pointer, I'll update. Once this is in I should have a first version of a patch for the OCaml bindings exposing the diagnostic handler.

jketema updated this revision to Diff 52865.Apr 6 2016, 4:08 PM
jketema edited edge metadata.

Added test for diagnostic handler

deadalnix, does the test look OK to you?

deadalnix edited edge metadata.Apr 6 2016, 10:28 PM

Overall I'm good with it. I'm not sure test belongs in the echo thing. I would add a new flag to llvm-c-test and just create a new kind of test. That way it would be possible to actually trigger the handler and see if it does what is expected.

jketema updated this revision to Diff 52892.Apr 7 2016, 3:39 AM
jketema edited edge metadata.

I've split out the diagnostic testing and improved it a bit as suggested. Let me know what you think.

While here, I also fixed some issues with the help text printed by llvm-c-test. I hope that's fine.

jketema updated this revision to Diff 52894.Apr 7 2016, 3:47 AM

Remove some unnecessary duplication introduced in the previous version of this patch.

deadalnix accepted this revision.Apr 7 2016, 2:47 PM
deadalnix edited edge metadata.

Small nits, but looks good overall.

tools/llvm-c-test/diagnostic.c
40 ↗(On Diff #52894)

Remove empty line

tools/llvm-c-test/llvm-c-test.h
53 ↗(On Diff #52894)

The name is a bit confusing, because this isn't the handler. Maybe llvm_test_diagnostic_handler or something alike.

jketema updated this revision to Diff 52976.Apr 7 2016, 4:33 PM
jketema edited edge metadata.

Addressed the little nitpicks.

@whitequark Is this ok with you?

whitequark accepted this revision.Apr 8 2016, 2:07 AM
whitequark edited edge metadata.
This revision is now accepted and ready to land.Apr 8 2016, 2:07 AM
This revision was automatically updated to reflect the committed changes.