================
@@ -66,13 +66,21 @@ void DanglingPtrDeref::checkPostCall(const CallEvent &Call,
}
}
+static std::string getRegionName(const MemRegion *Reg) {
+ // FIXME: Once the checker supports heap allocation, more region kinds
+ // should be handled to produce the correct descriptive name.
+ if (const std::string RegName = Reg->getDescriptiveName(); !RegName.empty())
+ return RegName;
+ return "the region";
----------------
isuckatcs wrote:
Nit:
One way to enforce this pattern is to do something like this:
```suggestion
// FIXME: Once the checker supports heap allocation, more region kinds
// should be handled to produce the correct descriptive name.
if (const std::string RegName = Reg->getDescriptiveName(); !RegName.empty())
return RegName;
assert(false && unhandled region);
```
```suggestion
// FIXME: Once the checker supports heap allocation, more region kinds
// should be handled to produce the correct descriptive name.
if (const std::string RegName = Reg->getDescriptiveName(); !RegName.empty())
return RegName;
llvm_unreachable("unexpected region");
```
The upside is that you will not forget to add the new region, but the downside
is that the CSA is going to crash if you do so.
https://github.com/llvm/llvm-project/pull/211552
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits