[clang] nonblocking/nonallocating attributes (was: nolock/noalloc) (PR #84983)

Doug Wyatt via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 11 14:36:51 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);
----------------
dougsonos wrote:

It would also appear that neither `FunctionProtoType` nor `TrailingObjects` has any provision for invoking the destructors of the trailing objects. Is it okay that they are leaked?

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


More information about the cfe-commits mailing list