This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Do a better job at detecting wrong-side calls.
ClosedPublic

Authored by jlebar on Sep 14 2016, 10:09 AM.

Details

Summary

Move CheckCUDACall from ActOnCallExpr and BuildDeclRefExpr to
DiagnoseUseOfDecl. This lets us catch some edge cases we were missing,
specifically around class operators.

This necessitates a few other changes:

  • Avoid emitting duplicate deferred diags in CheckCUDACall.

    Previously we'd carefully placed our call to CheckCUDACall such that it would only ever run once for a particular callsite. But now this isn't the case.
  • Emit deferred diagnostics from a template specialization/instantiation's primary template, in addition to from the specialization/instantiation itself. DiagnoseUseOfDecl ends up putting the deferred diagnostics on the template, rather than the specialization, so we need to check both.

Diff Detail

Event Timeline

jlebar updated this revision to Diff 71381.Sep 14 2016, 10:09 AM
jlebar retitled this revision from to [CUDA] Do a better job at detecting wrong-side calls..
jlebar updated this object.
jlebar added a reviewer: rsmith.
jlebar added subscribers: tra, cfe-commits.

I'm sorry to put more stuff on your plate, Richard, but you already have context on this, so you may be the best person to review this. Unfortunately people keep hitting the bug fixed here (and being confused), so it's maybe not as much of an edge case as I thought.

FWIW this patch is not actually as big as it looks at first: The ActOnCallExpr changes are just moving things out of an "Impl" function, nothing interesting there.

jlebar added a subscriber: rryan.Sep 28 2016, 4:13 PM
rsmith accepted this revision.Oct 7 2016, 4:21 PM
rsmith edited edge metadata.
This revision is now accepted and ready to land.Oct 7 2016, 4:21 PM
This revision was automatically updated to reflect the committed changes.