[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)

Doug Wyatt via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 4 11:52:15 PDT 2024


================
@@ -8392,6 +8397,20 @@ void ASTReader::InitializeSema(Sema &S) {
         NewOverrides.applyOverrides(SemaObj->getLangOpts());
   }
 
+  if (!DeclsWithEffectsToVerify.empty()) {
+    for (GlobalDeclID ID : DeclsWithEffectsToVerify) {
+      Decl *D = GetDecl(ID);
+      FunctionEffectsRef FX;
+      if (auto *FD = dyn_cast<FunctionDecl>(D))
+        FX = FD->getFunctionEffects();
+      else if (auto *BD = dyn_cast<BlockDecl>(D))
+        FX = BD->getFunctionEffects();
----------------
dougsonos wrote:

If it were just one call, I wouldn't care so much but that would be a repetition of two lines and I'm a bit OCD about DRY. If the concern is about the test of `FX.empty()` being applied in the case where it's never been assigned, a `continue` could fix that.

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


More information about the cfe-commits mailing list