[PATCH] D50214: Add inherited attributes before parsed attributes.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 12 08:26:44 PDT 2018


aaron.ballman added subscribers: rsmith, echristo, dlj, nicholas.
aaron.ballman edited reviewers, added: rsmith; removed: nicholas, dlj, echristo.
aaron.ballman added a comment.

In general, I think this is the right way to go. I've added @rsmith to the reviewers because I'm curious what his thoughts are on this approach, though.



================
Comment at: lib/AST/DeclBase.cpp:854-859
+  auto I = Attrs.begin(), E = Attrs.end();
+  for (; I != E; ++I) {
+    if (!(*I)->isInherited())
+      break;
+  }
+  Attrs.insert(I, A);
----------------
The unfortunate part about this is that inherited attributes are fairly common, so this extra searching may happen more often than we'd like. I wonder how bad it would be to keep track of the location within the list where the inherited attributes start. Then again, the list of attributes should be relatively short in most cases, so this search isn't likely to be too expensive.

Having some performance measurements might help decide this, too.


Repository:
  rC Clang

https://reviews.llvm.org/D50214





More information about the cfe-commits mailing list