[PATCH] D31338: Move ParsedAttrInfos into a registry and point to one in ParsedAttr

John Brawn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 10:12:34 PST 2020


john.brawn marked an inline comment as done.
john.brawn added inline comments.


================
Comment at: clang/lib/Basic/Attributes.cpp:101-103
+  for (ParsedAttrInfoRegistry::iterator it = ParsedAttrInfoRegistry::begin(),
+                                        ie = ParsedAttrInfoRegistry::end();
+       it != ie; ++it) {
----------------
aaron.ballman wrote:
> Range-based for loop? Also, `it` and `ie` don't meet the usual naming conventions.
> 
> One thing I'm not keen on with this is the performance hit. We spent a decent amount of effort making this lookup fast and it's now a linear search through all of the attributes and requires memory allocations and deallocations to perform the search.
Yes, I've done some experiments and in the pathological case (lots of trivial functions with the xray_log_args attribute) the slowdown is noticeable. I've done some tinkering and I think the best way to resolve this is to first use a generated function (i.e. something like the current getAttrKind) to look up the attributes that are compiled into clang, then if that fails look in the registry to find a match.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D31338/new/

https://reviews.llvm.org/D31338





More information about the cfe-commits mailing list