Page MenuHomePhabricator

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

Authored by andusy on Tue, Jun 25, 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.Tue, Jun 25, 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.Tue, Jun 25, 3:17 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptWed, Jun 26, 12:27 PM