[clang] [Clang] Add __builtin_is_within_lifetime to implement P2641R4's std::is_within_lifetime (PR #91895)

Mital Ashok via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 20 03:26:11 PDT 2024


================
@@ -3760,6 +3765,9 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
     if ((O->isAbsent() && !(handler.AccessKind == AK_Construct && I == N)) ||
         (O->isIndeterminate() &&
          !isValidIndeterminateAccess(handler.AccessKind))) {
+      // Object has ended lifetime since pointer was formed
+      if (handler.AccessKind == AK_IsWithinLifetime)
+        return false;
----------------
MitalAshok wrote:

There are already other `return false;`/`return true;` returns in `findSubobject`, so `findSubobject::result_type` must be constructible from bool

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


More information about the cfe-commits mailing list