[clang] nolock/noalloc attributes (PR #84983)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 12 16:22:57 PDT 2024


================
@@ -11100,6 +11136,48 @@ Attr *Sema::getImplicitCodeSegOrSectionAttrForFunction(const FunctionDecl *FD,
   return nullptr;
 }
 
+// Should only be called when getFunctionEffects() returns a non-empty set.
+// Decl should be a FunctionDecl or BlockDecl.
+void Sema::CheckAddCallableWithEffects(const Decl *D, FunctionEffectSet FX) {
+  if (!D->hasBody()) {
+    if (const auto *FD = D->getAsFunction()) {
+      if (!FD->willHaveBody()) {
+        return;
+      }
+    }
+  }
+
+  if (Diags.getIgnoreAllWarnings() ||
+      (Diags.getSuppressSystemWarnings() &&
+       SourceMgr.isInSystemHeader(D->getLocation())))
+    return;
+
+  if (hasUncompilableErrorOccurred())
+    return;
+
+  // For code in dependent contexts, we'll do this at instantiation time
+  // (??? This was copied from something else in AnalysisBasedWarnings ???)
+  if (cast<DeclContext>(D)->isDependentContext()) {
+    return;
+  }
----------------
Sirraide wrote:

Hmm, I’m not sure this needs to be here as checking whether individual expressions are dependent and then analysing only non-dependent ones for effects (which is how I understand this is going to work) should be enough. It might make sense to try and remove that if doing so doesn’t break anything horribly.

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


More information about the cfe-commits mailing list