Page MenuHomePhabricator

[CUDA] Disallow __constant__ local variables.
ClosedPublic

Authored by jlebar on Sep 30 2016, 2:12 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

jlebar updated this revision to Diff 73139.Sep 30 2016, 2:12 PM
jlebar retitled this revision from to [CUDA] Disallow __constant__ local variables..
jlebar updated this object.
jlebar added reviewers: tra, rnk.
jlebar added a subscriber: cfe-commits.
tra accepted this revision.Sep 30 2016, 2:51 PM
tra edited edge metadata.

LGTM.

clang/include/clang/Basic/DiagnosticSemaKinds.td
6727 ↗(On Diff #73139)

Nit: Technically they are allowed in namespace scope.

This revision is now accepted and ready to land.Sep 30 2016, 2:51 PM
jlebar added inline comments.Sep 30 2016, 2:52 PM
clang/include/clang/Basic/DiagnosticSemaKinds.td
6727 ↗(On Diff #73139)

That's still a "global variable"? Or do you think calling it such will be confusing?

tra added inline comments.Sep 30 2016, 3:04 PM
clang/include/clang/Basic/DiagnosticSemaKinds.td
6727 ↗(On Diff #73139)

It's not clear whether you mean global storage class or global namespace.
The code checks for global storage, but error message is could be interpreted either way, IMO.

I'll leave phrasing up to you.

jlebar added inline comments.Sep 30 2016, 5:00 PM
clang/include/clang/Basic/DiagnosticSemaKinds.td
6727 ↗(On Diff #73139)

It's not clear whether you mean global storage class or global namespace.

So there's actually no such thing as "global" storage class. It's *static* storage (so helpful), meaning, a global variable or a static variable inside of a function.

But __constant__ symbols must actually be global variables -- nvcc doesn't allow them to appear inside function bodies.

I think "global" is the right way to describe what we're going after. Until a Language Lawyer corrects me, anyway. :)

This revision was automatically updated to reflect the committed changes.