[clang] Fix null-deref thanks to an attribute on a global declarator chunk (PR #83611)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 1 20:29:43 PST 2024


================
@@ -100,6 +100,12 @@ void AttributePool::takePool(AttributePool &pool) {
   pool.Attrs.clear();
 }
 
+void AttributePool::takeFrom(ParsedAttributesView &List, AttributePool &Pool) {
+  assert(&Pool != this && "AttributePool can't take attributes from itself");
+  llvm::for_each(List.AttrList, [&Pool](ParsedAttr *A) { Pool.remove(A); });
----------------
shafik wrote:

Should we remove from the pool after we added them to the `Attrs`?

https://github.com/llvm/llvm-project/pull/83611


More information about the cfe-commits mailing list