================
@@ -52,6 +52,11 @@ static bool isDanglingStackSource(const MemRegion *Source,
         })) {
       return false;
     }
+    // Only a source whose frame is still live on the current stack can
+    // dangle. If that frame is not on the stack then the source outlives
+    // the returned value. The source is still alive when the returned value
+    // is used, so it does not dangle.
+    return is_contained(make_pointer_range(C.stackframes()), SF);
----------------
steakhal wrote:

If we unconditionally return here, isn't the rest of the statements at this 
indentation level dead code?

https://github.com/llvm/llvm-project/pull/213779
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to