benedekaibas wrote:
This is great, thank you! I am also wondering if we want to add `getString()`
method to `SVal`. If we would done that then analyzers using `SVal` could make
a use of `Twine` by allowing a variable that has an `SVal` type to be printed
by using `Twine`.
As an example:
```cpp
llvm::SmallString<128> Str;
llvm::raw_svector_ostream OS(Str);
OS << " Origin " << ArgSVal << " bound to " << Region;
auto BR = std::make_unique<PathSensitiveBugReport>(BugMsg, OS.str(), N);
C.emitReport(std::move(BR));
```
Could be simply written as:
```cpp
auto BR = std::make_unique<PathSensitiveBugReport>(BugMsg, llvm::Twine("
Origin ") + ArgSVal.getString() + " bound to " +
Region->getString(), N);
```
AFAIK this change would require to add `getString()` method to `SVal` similar
to how `MemRegion::getString()` works. If you agree, I'd love to work on this
feature.
https://github.com/llvm/llvm-project/pull/205527
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits