[PATCH] D17861: [OpenCL] Accept __attribute__((nosvm))

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 22 10:01:47 PDT 2016

yaxunl marked an inline comment as done.

Comment at: include/clang/Basic/Attr.td:701
@@ -699,1 +700,3 @@
+def OpenCLNoSVM : Attr {
+  let Spellings = [GNU<"nosvm">];
aaron.ballman wrote:
> yaxunl wrote:
> > aaron.ballman wrote:
> > > Since the attribute is ignored by clang, you should inherit from IgnoredAttr.
> > I tried that from beginning. If I inherit from IgnoredAttr, it seems to be ignored by the parser and won't reach the sema check part, and I cannot emit error msg based on OpenCL version.
> Ah. so it isn't *totally* ignored. Okay, in that case, you should set ASTNode = 0 and SemaHandler = 0.
If I set ASTNode = 0 and SemaHandler = 0, tablegen will not generate an id AT_OpenCLNoSVM to identify this attribute, and I cannot diagnose its invalid usage in SemaDeclAttr.cpp due to that. Then it seems the only viable place to diagnose its invalid usage is in Parser::ParseGNUAttributes. However currently Parser::ParseGNUAttributes only does generic processing of GNU attributes and does not diagnose specific attribute. Since there is no id for NoSVM attribute, I have to diagnose based on its name string.

Do we really want to do this?



More information about the cfe-commits mailing list