This is nice. For non-keyword identifiers which still have some special treatment, could we allow the same sort of treatment?
I'm thinking about the various Identifier* variables which are set up in places like Parser::Initialize(). The idea would be to have some notion of a "known" identifier. Code which currently compares an identifier to some stored Identifier* -- &II == SuperID -- would be replaced with something like -- II->getKnownID() == KnownIDs::super. This centralizes the mechanism and avoids having various Identifier*s initialized and stored across scattered locations. The cost is that the known ID table would presumably be centralized, and we would need some bits in Identifier (probably just one, since KnownIDs could be forced to be disjoint with Builtins, so we could reuse the builtin bits). Good idea or bad idea? - Daniel On Sun, Oct 5, 2008 at 9:48 PM, Chris Lattner <[EMAIL PROTECTED]> wrote: > Author: lattner > Date: Sun Oct 5 23:48:17 2008 > New Revision: 57149 > > URL: http://llvm.org/viewvc/llvm-project?rev=57149&view=rev > Log: > a more efficient test for __builtin_classify_type > > > Modified: > cfe/trunk/lib/AST/Expr.cpp > > Modified: cfe/trunk/lib/AST/Expr.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=57149&r1=57148&r2=57149&view=diff > > > ============================================================================== > --- cfe/trunk/lib/AST/Expr.cpp (original) > +++ cfe/trunk/lib/AST/Expr.cpp Sun Oct 5 23:48:17 2008 > @@ -188,7 +188,8 @@ > return false; > > // We have a DeclRefExpr. > - if (strcmp(DRE->getDecl()->getName(), "__builtin_classify_type") == 0) { > + if (DRE->getDecl()->getIdentifier()->getBuiltinID() == > + Builtin::BI__builtin_classify_type) { > // If no argument was supplied, default to "no_type_class". This isn't > // ideal, however it's what gcc does. > Result = static_cast<uint64_t>(no_type_class); > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
