[cfe-commits] [patch] Lookup
John McCall
rjmccall at apple.com
Wed Oct 7 17:42:04 PDT 2009
This patch refactors and hopefully simplifies and clarifies some of the
logic in name lookup, mostly for the benefit of C++. The major
structural change is that a LookupResult is now a non-POD type which is
passed by reference to the lookup routines; this allows us to eliminate
a lot of unnecessary copies from C++ lookups that reach into multiple
scopes. No allocations or extra logic are required in the common case,
and along the common C paths, where only a single declaration is found.
In addition, the logic to replace declarations in scope chains is now
identical to that in declarationReplaces, and we no longer rely on the
ordering of declarations within a single scope to implement C++ tag-name
shadowing.
In addition, users which assume that lookup will find at most one
declaration must now explicitly call either LookupSingleName or, if
working with a LookupResult, getAsSingleDecl(). These methods exist to
mark users making this assumption. Users which for some reason are
certain that at most one declaration can be returned should use
getFoundDecl() instead.
My performance evaluations show a (very) small gain on the Cocoa.h
benchmark.
John.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: lookup.patch.txt
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20091007/214ff0c3/attachment.txt>
More information about the cfe-commits
mailing list