This is an archive of the discontinued LLVM Phabricator instance.

Print NULL as "(null)" in diagnostic message
ClosedPublic

Authored by andusy on Jun 25 2019, 1:27 PM.

Details

Summary

Passing a null pointer to the printf family for a %s format specifier leads to undefined behaviour. The tests currently expect (null). Explicitly test for a null pointer and provide the expected string.

Diff Detail

Repository
rL LLVM

Event Timeline

andusy created this revision.Jun 25 2019, 1:27 PM

LGTM. I have some minor style comments that could be fixed as part of the commit.

clang/tools/c-index-test/c-index-test.c
4648 ↗(On Diff #206514)

Minor nit: The blank line that was removed helps readability (at least for me). Also, FileNameStr should be declared first to match the corresponding CXStrings.

This revision is now accepted and ready to land.Jun 25 2019, 3:17 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 26 2019, 12:27 PM