Page MenuHomePhabricator

[clang] Check unsupported types in expressions
ClosedPublic

Authored by asavonic on Sep 6 2021, 4:17 AM.

Details

Summary

The patch adds diagnostics for cases like:

float F3 = ((__float128)F1 * (__float128)F2) / 2.0f;

Sema::checkDeviceDecl (renamed to checkTypeSupport) is changed to work
with a type without the corresponding ValueDecl. It is also refactored
so that host diagnostics for unsupported types can be added here as
well.

Diff Detail

Event Timeline

asavonic requested review of this revision.Sep 6 2021, 4:17 AM
asavonic created this revision.
Herald added a project: Restricted Project. · View Herald Transcript

No objections, just a couple of minors.

clang/include/clang/Basic/DiagnosticSemaKinds.td
10718

Maybe it is just me, but the old version was a bit more clear since it pointed to the wrong declaration. Now looking at the tests I see that clang ends up emitting several identical diagnostics at the same line, but they point to the different declarations/expressions used on this line. Should we still mention which concrete declaration/expression the diagnostic is about?

clang/include/clang/Sema/Sema.h
12222–12224

Having that in single source offloading programming models usually two targets are used, "current target" sounds a bit more clear.

asavonic added inline comments.Sep 6 2021, 7:48 AM
clang/include/clang/Basic/DiagnosticSemaKinds.td
10718

Agree, but I couldn't figure out good wording for the diagnostic that works well for both decl and expr cases.

asavonic updated this revision to Diff 371693.Sep 9 2021, 12:42 PM
  • Reworded the diagnostic.
jdoerfert accepted this revision.Sep 10 2021, 7:59 AM

LG, let's wait for @Fznamznon though.

This revision is now accepted and ready to land.Sep 10 2021, 7:59 AM
Fznamznon accepted this revision.Sep 10 2021, 10:12 AM

LGTM, thanks

This revision was automatically updated to reflect the committed changes.
asavonic reopened this revision.Sep 20 2021, 3:12 AM

This is weird... Buildbot reported that lock/omp_init_lock.c test
crashed with SIGSEGV, but I cannot reproduce this on my machine.

I added a check for a null QualType; not sure if it fixes the issue
with the test.

This revision is now accepted and ready to land.Sep 20 2021, 3:12 AM
asavonic updated this revision to Diff 373531.Sep 20 2021, 3:14 AM
This revision was landed with ongoing or failed builds.Fri, Oct 15, 3:56 AM
This revision was automatically updated to reflect the committed changes.