================
@@ -350,8 +350,13 @@ SVal ExprEngine::computeObjectUnderConstruction(
         // Operator arguments do not correspond to operator parameters
         // because this-argument is implemented as a normal argument in
         // operator call expressions but not in operator declarations.
-        const TypedValueRegion *TVR = Caller->getParameterLocation(
-            *Caller->getAdjustedParameterIndex(Idx), NumVisitedCaller);
+        std::optional<unsigned> DeclParamIdx =
+            Caller->getAdjustedParameterIndex(Idx);
+        if (!DeclParamIdx)
+          return std::nullopt;
+
+        const TypedValueRegion *TVR =
+            Caller->getParameterLocation(*DeclParamIdx, NumVisitedCaller);
----------------
benedekaibas wrote:

Applied changes here: 
[25f5339](https://github.com/llvm/llvm-project/pull/221252/commits/25f5339a6ef0e59ac4e1e478215ac07eadcd46a4)

I have confirmed that `unsigned` implicitly converts to 
`std::optional<unsigned>`. Accepting `std::optional<unsigned>` as a parameter 
can be "dangerous" (if a negative signed value reaches it since it would 
silently wrap to a huge unsigned value), but cases where it can behave 
incorrectly does not apply for parameter index lookup cases.

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

Reply via email to