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

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 30 17:35:19 PDT 2018

rsmith marked an inline comment as done.
rsmith 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)
tra wrote:
> 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. 
The pragma is already flexible enough to allow selectively applying attributes to a subset of the declarations in its scope:


  rC Clang


More information about the cfe-commits mailing list