[clang] Effect analysis: correctly detect `(f ? a : b)` as nonblocking when a and b are (PR #111224)

Doug Wyatt via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 4 18:37:19 PDT 2024


================
@@ -1048,15 +1048,14 @@ class Analyzer {
     }
 
     void checkIndirectCall(CallExpr *Call, QualType CalleeType) {
-      auto *FPT =
-          CalleeType->getAs<FunctionProtoType>(); // Null if FunctionType.
       FunctionEffectKindSet CalleeEffects;
-      if (FPT)
-        CalleeEffects.insert(FPT->getFunctionEffects());
+      if (FunctionEffectsRef Effects = FunctionEffectsRef::get(CalleeType);
----------------
dougsonos wrote:

`FunctionEffectsRef::get()` knows how to pick through indirections (references/pointers) to get to a `FunctionProtoType` so just reuse that.

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


More information about the cfe-commits mailing list