Commit Graph

3 Commits

Author SHA1 Message Date
George Burgess IV b8709babd2 Use unsigned instead of an enum for map keys
ubsan's enum sanitizer doesn't like the latter, and we had to have
out-of-bounds values for DenseMapInfo's tombstone/empty keys.

llvm-svn: 310523
2017-08-09 21:20:41 +00:00
George Burgess IV 35cb4f84a4 [AST] Cache intermediate visibility/linkage results
This is a follow-up to r310436 with actual functional changes. Please
see that commit message for a description of why a cache is appearing
here.

Suggestions for less-bad ways of testing this are appreciated. :)

This fixes PR29160.

llvm-svn: 310437
2017-08-09 04:12:17 +00:00
George Burgess IV 99db3ea690 [AST] Move visibility computations into a class; NFC
This is patch 1 in a 2 patch series that aims to fix PR29160. Its goal
is to cache decl visibility/linkage for the duration of each
visibility+linkage query.

The simplest way I can see to do this is to put the visibility
calculation code that needs to (transitively) access this cache into a
class, which is what this patch does. Actual caching will come in patch
2. (Another way would be to keep the cache in ASTContext + manually
invalidate it or something, but that felt way too subtle to me.)

Caching visibility results across multiple queries seems a bit tricky,
since the user can add visibility attributes ~whenever they want, and
these attributes can apparently have far-reaching effects (e.g. class
visibility extends to its members, ...). Because a cache that's dropped
at the end of each top-level query seems to work nearly as well and
doesn't require any eviction logic, I opted for that design.

llvm-svn: 310436
2017-08-09 04:02:49 +00:00