================
@@ -779,7 +787,10 @@ ProgramStateRef 
CStringChecker::CheckOverlap(CheckerContext &C,
 }
 
 void CStringChecker::emitOverlapBug(CheckerContext &C, ProgramStateRef state,
-                                  const Stmt *First, const Stmt *Second) const 
{
+                                    const Stmt *First,
+                                    const Stmt *Second) const {
+  assert(BufferOverlap.isEnabled() &&
----------------
gamesh411 wrote:

This is true, all call sites for this method does operate under the same 
precondition. However, if I move the checking into the function I would need 
still need to pass that information out, because the return value of the call 
site depends on it.
I would not do this, as I find this less readable then the original:
```
  if (stateTrue && !stateFalse) {
    if (!emitOverlapBug(C, stateTrue, First.Expression, Second.Expression))
      return nullptr;
    }
    return state;
  }
```

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

Reply via email to