================
@@ -297,17 +297,19 @@ void ExprEngine::processCallExit(ExplodedNode *CEBNode) {
   if (CE) {
     if (const ReturnStmt *RS = dyn_cast_or_null<ReturnStmt>(LastSt)) {
       const LocationContext *LCtx = CEBNode->getLocationContext();
+      // FIXME: This tries to look up the return statement in the environment,
+      // which is special cased to look up the subexpression RS->getRetValue()
+      // in environment. Instead of relying on this hack, pass
+      // RS->getRetValue() to getSVal() after checking it for nullness.
----------------
NagyDonat wrote:

> Changing the getSVal to only accept Exprs shouldn't be hard and would clarify 
> things.

It will be done soon (probably by @tigbr).

> In my mind, `getSVal` can't to anything but to query from the Environment. So 
> I didn't get what' was your confusion about.

Oh, I see – that was a completely reasonable assumption on your side. 
Unfortunatley this codebase is not completely reasonable...

`<offtopic>`
By the way, taken out of context, "`getSVal` can't to anything but to query 
from the Environment" is also incorrect because in `ProgramState` we have
```c++
/// Returns the SVal bound to the statement 'S' in the state's environment.
SVal getSVal(const Stmt *S, const LocationContext *LCtx) const;

/// Return the value bound to the specified location.
/// Returns UnknownVal() if none found.
SVal getSVal(Loc LV, QualType T = QualType()) const;

/// Return the value bound to the specified location.
/// Returns UnknownVal() if none found.
SVal getSVal(const MemRegion* R, QualType T = QualType()) const;    
```
Here the first one is what we're talking about, while the other two overloads 
do something completely different (load values from the store).

It would be nice to rename these to e.g. `getExprVal` and `getStoredVal` to 
highlight the difference -- but they are used very frequently so I'm not sure 
that this is worth the disruption.
`</offtopic>`

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

Reply via email to