<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, May 23, 2014 at 2:41 PM, Tyler Nowicki <span dir="ltr"><<a href="mailto:tnowicki@apple.com" target="_blank">tnowicki@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br>
<br>
As requested here is the patch to support non-type template parameters in #pragma loop. The patch uses LookupName to build a DeclRefExpr to the template parameter and overloads TransformAttr in the template instantiator to transform the value expression and replace the LoopHintAttr. It is built on the PragmaAttr and Pragma Spelling patch listed in the 'Add PragmaAttr and Pragma Spelling to Tablegen’ thread. Since it is a git patch please use ‘patch -p1’ to apply it.<br>
</blockquote><div><br></div><div>This seems like fundamentally the wrong approach to me. It doesn't make much sense to me to accept only an identifier here; at a minimum you should accept an id-expression, and ideally you should accept any constant-expression. And that in turn means your approach of parsing the pragma from the lexer is unworkable -- you need to move the parsing logic to the parser in order to be able to actually parse an id-expression / constant-expression. See HandlePragmaMSPragma for an example of an existing pragma that does this.</div>
<div><br></div><div>Is there some pre-existing standard / specification we're implementing here, or is this a pragma of our own invention?</div><div><br></div><div>Also:</div><div><br></div><div><div>+  if (ValueName == "enable" || ValueName == "disable")</div>
<div>+    return ExprEmpty();</div></div><div><br></div><div>If this is a pragma we invented, can we design it such that we don't have an ambiguity between its pseudo-keywords and its identifier lookup?</div></div></div>
</div>