[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 11 14:41:45 PDT 2024
================
@@ -3637,6 +3637,15 @@ FunctionProtoType::FunctionProtoType(QualType result, ArrayRef<QualType> params,
auto &EllipsisLoc = *getTrailingObjects<SourceLocation>();
EllipsisLoc = epi.EllipsisLoc;
}
+
+ if (epi.FunctionEffects) {
+ auto &ExtraBits = *getTrailingObjects<FunctionTypeExtraBitfields>();
+ ExtraBits.HasFunctionEffects = true;
+
+ // N.B. This is uninitialized storage.
+ FunctionEffectSet *PFX = getTrailingObjects<FunctionEffectSet>();
+ new (PFX) FunctionEffectSet(epi.FunctionEffects);
----------------
Sirraide wrote:
Ah yes, that is on purpose. All AST nodes (and everything stored in them) must be trivially destructible. The AST nodes are all allocated in a bump pointer allocator, so to free them, we just free that allocator. That also means that you can never put e.g. a `SmallVector` in an AST node (or anything else that has a non-trivial destructor).
https://github.com/llvm/llvm-project/pull/84983
More information about the cfe-commits
mailing list