<div dir="ltr"><div>I like the simplification here.</div><div><br></div><div>+  if (TagType == DeclSpec::TST_struct && Tok.isNot(tok::identifier)) {</div><div>+    const IdentifierInfo *II = Tok.getIdentifierInfo();</div>
<div><br></div><div>This will assert if there's an annotation token here (that might happen if we've done some tentative parsing and annotated a nested name specifier).</div><div><br></div><div><br></div><div>The reverting-and-unreverting mechanism here seems unsatisfying. Perhaps we should redesign this somewhat. How about changing the semantics to be simply that these tokens are always normal identifiers, except when they're followed by a left paren (in the case where your patch calls TryIdentKeywordUpgrade).</div>
<div><br></div><div>Specifically, something like: change the RevertedTokenID flag on Token to a ContextualKeyword flag or similar, set the kind to tok::identifier by default for these traits, and generate a StringSwitch in TryIdentKeywordUpgrade to pick the right kind. Then we can drop the TryKeywordIdentFallback hack entirely -- the semantics would be simply that these identifiers are normal identifiers unless they're followed by a left paren.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 12, 2013 at 6:46 AM, Alp Toker <span dir="ltr"><<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
Now that we emit diagnostics for keyword-as-identifier hacks (-Wkeyword-compat) we can go ahead and simplify some of the old revertible keyword support.<br>
<br>
This patch adds a TryIdentKeywordUpgrade() function to mirror the recently added TryKeywordIdentFallback(), and uses it to replace hard-coded REVERTIBLE_TYPE_TRAITs.<br>
<br>
The mid-term goal is to work with libc++ to remove dependence on the GNU token hacks, and to unify context-sensitive keyword handing in the C++ frontend.<br>
<br>
 4 files changed, 43 insertions(+), 70 deletions(-)<span class="HOEnZb"><font color="#888888"><br>
<br>
Alp.<br>
<br>
-- <br>
<a href="http://www.nuanti.com" target="_blank">http://www.nuanti.com</a><br>
the browser experts<br>
<br>
</font></span><br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>