The patch makes sure that register names in named register variables and inline assembly are checked only on appropriate side of CUDA compilation.
Details
Diff Detail
Event Timeline
lib/Sema/SemaDecl.cpp | ||
---|---|---|
5944 | Since this is a CUDA-only thing, ShouldHandleTargetErrors can perhaps be named better. The checks you added are very selective now - some diags are disabled, some are not. It's not clear why some fall under the "should handle target error" umbrella. A clearer name like MatchingCUDAMode or something of the sort, may help? | |
5971 | Do we plan to support this for CUDA at all? Why not disable here on top? |
Removed rarely used temp var.
lib/Sema/SemaDecl.cpp | ||
---|---|---|
5944 | Considering it's only used in two places, I may as well use DeclAttrsMatchCUDAMode() directly, making variable naming moot and hopefully making intent somewhat clearer. CUDA code may contain constructs that can only be validated by appropriate TargetInfo() and we currently have access only to one used during current compilation mode. We will check for those errors in another CUDA compilation pass. The error set is further restricted to error classes I've ran into in practice and can reproduce and write tests for. | |
5971 | It does not quite fit virtual registers model used by NVPTX, but as a feature per se I believe we should keep it enabled, because it should be OK to use it for targets where it's valid. For example, using this feature in host code on x86 should be acceptable. |
Since this is a CUDA-only thing, ShouldHandleTargetErrors can perhaps be named better. The checks you added are very selective now - some diags are disabled, some are not. It's not clear why some fall under the "should handle target error" umbrella. A clearer name like MatchingCUDAMode or something of the sort, may help?