[cfe-commits] r63219 - /cfe/trunk/lib/Parse/ParseDecl.cpp

Chris Lattner clattner at apple.com
Wed Jan 28 23:05:31 PST 2009


On Jan 28, 2009, at 11:16 AM, Steve Naroff wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=63219&view=rev
> Log:
> Change Parser::ParseFunctionDeclarator() to annotate typename tokens.
>
> This removes ~10% of the calls to Sema::isTypeName(), which amount  
> to a little less than a 1% reduction in usertime (for Cocoa.h).

Ahh, very nice catch.  Two requests: please change the condition to  
"if (!TypeRep) { ... }  ... " so that only the short case is nested,  
not the current "if" case.

Second, calling setAnnotationEndLoc and friends is both a bit unusual  
and also a bit dangerous.  Would it be reasonable to just call  
TryAnnotateTypeOrScopeToken like all the other clients that handle  
'identifier'?  That would make it more consistent with other code.

The dangerous part is that I'm not sure that this will work for C++  
Constructs like:
void foo(bar::baz x);
However, the code is guarded by if !C++ so I guess that is a moot point.

-Chris




More information about the cfe-commits mailing list