<div dir="ltr">This is nice. For non-keyword identifiers which still have some special<br>treatment, could we allow the same sort of treatment?<br><br>I'm thinking about the various Identifier* variables which are set up in<br>
places like Parser::Initialize(). The idea would be to have some notion<br>of a "known" identifier.<br><br>Code which currently compares an identifier to some stored Identifier*<br>--<br>&II == SuperID<br>--<br>
would be replaced with something like<br>--<br>II->getKnownID() == KnownIDs::super.<br><br>This centralizes the mechanism and avoids having various Identifier*s <br>initialized and stored across scattered locations. The cost is that the<br>
known ID table would presumably be centralized, and we would need<br>some bits in Identifier (probably just one, since KnownIDs could be <br>forced to be disjoint with Builtins, so we could reuse the builtin bits).<br><br>
Good idea or bad idea?<br><br> - Daniel<br><br><div class="gmail_quote">On Sun, Oct 5, 2008 at 9:48 PM, Chris Lattner <span dir="ltr"><<a href="mailto:sabre@nondot.org">sabre@nondot.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Author: lattner<br>
Date: Sun Oct  5 23:48:17 2008<br>
New Revision: 57149<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=57149&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=57149&view=rev</a><br>
Log:<br>
a more efficient test for __builtin_classify_type<br>
<br>
<br>
Modified:<br>
    cfe/trunk/lib/AST/Expr.cpp<br>
<br>
Modified: cfe/trunk/lib/AST/Expr.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=57149&r1=57148&r2=57149&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=57149&r1=57148&r2=57149&view=diff</a><br>

<br>
==============================================================================<br>
--- cfe/trunk/lib/AST/Expr.cpp (original)<br>
+++ cfe/trunk/lib/AST/Expr.cpp Sun Oct  5 23:48:17 2008<br>
@@ -188,7 +188,8 @@<br>
     return false;<br>
<br>
   // We have a DeclRefExpr.<br>
-  if (strcmp(DRE->getDecl()->getName(), "__builtin_classify_type") == 0) {<br>
+  if (DRE->getDecl()->getIdentifier()->getBuiltinID() ==<br>
+         Builtin::BI__builtin_classify_type) {<br>
     // If no argument was supplied, default to "no_type_class". This isn't<br>
     // ideal, however it's what gcc does.<br>
     Result = static_cast<uint64_t>(no_type_class);<br>
<br>
<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>
</blockquote></div><br></div>