[PATCH] D51507: Allow all supportable attributes to be used with #pragma clang attribute.

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 30 15:06:20 PDT 2018

tra added inline comments.

Comment at: test/Misc/pragma-attribute-supported-attributes-list.test:27-32
+// CHECK-NEXT: CUDAConstant (SubjectMatchRule_variable)
+// CHECK-NEXT: CUDADevice (SubjectMatchRule_function, SubjectMatchRule_variable)
+// CHECK-NEXT: CUDAGlobal (SubjectMatchRule_function)
+// CHECK-NEXT: CUDAHost (SubjectMatchRule_function)
+// CHECK-NEXT: CUDALaunchBounds (SubjectMatchRule_objc_method, SubjectMatchRule_hasType_functionType)
+// CHECK-NEXT: CUDAShared (SubjectMatchRule_variable)
I don't see much practical use of this pragma for CUDA, but I also don't have any specific objections.

Theoretically  we could use it to apply `__host__ __device__` attribute to some portable headers-only library so we could use it on device side. In practice, though, there usually will be few things that would have to remain host-only (anything involving file-io, for example) and we would need to be more selective in applying the attributes or have a way to remove them from a subset of objects later on. 

  rC Clang


More information about the cfe-commits mailing list