================
@@ -469,11 +470,19 @@ void FactsGenerator::handleFullExprCleanup(
}
void FactsGenerator::handleExitBlock() {
----------------
Xazax-hun wrote:
I think globals are special, and we might want to handle this more eagerly!
Consider the following code example:
```
int *global;
int *global_backup;
void save_global() {
global_backup = global;
}
void f() {
int local;
global = &local;
save_global();
global = nullptr;
}
```
Here, at the end of the function, the `global` does not point to local stack
memory. But `global_backup` does!
So, if we want to be strict, we might need to warn as soon as `save_global` is
called.
That being said, we can make the explicit decision to not catch this case due
to the amount of false positives it would produce, but I want us to document
this deliberate decision in some test cases.
https://github.com/llvm/llvm-project/pull/181646
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits