This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Fix pointer-to-int-cast diagnostic for _Bool
ClosedPublic

Authored by Mordante on Feb 19 2020, 12:49 PM.

Details

Summary

The diagnostic added in D72231 also shows a diagnostic when casting to a _Bool. This is unwanted. This patch removes the diagnostic for _Bool.

Diff Detail

Event Timeline

Mordante created this revision.Feb 19 2020, 12:49 PM

Can we test the same thing in C++?

Also, make sure to run git-clang-format HEAD~ on the patch, as the linter suggests. Thanks for the patch.

Can we test the same thing in C++?

I'll add some tests, but C++ uses a different codepath for c-style casts.

Also, make sure to run git-clang-format HEAD~ on the patch, as the linter suggests. Thanks for the patch.

I'd rather not run it on the tests. The new code uses the same style as the surrounding code. If wanted I can run the formatter on the changed test files and commit them separately.

Mordante updated this revision to Diff 246082.Feb 22 2020, 10:04 AM

Added some C++ tests for similar c-style casts.

rjmccall accepted this revision.Feb 22 2020, 10:28 AM

Can we test the same thing in C++?

I'll add some tests, but C++ uses a different codepath for c-style casts.

Since the warning applies in both modes, we generally need to be testing all the cases in both. The implementation being significantly different is a *better* reason to do this.

Anyway, thanks, LGTM.

This revision is now accepted and ready to land.Feb 22 2020, 10:28 AM
This revision was automatically updated to reflect the committed changes.