[clang] [Clang][analyzer] replace Stmt* with ConstCFGElementRef in SymbolConjured (PR #128251)

via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 26 07:48:28 PST 2025


================
@@ -29,6 +31,18 @@ class SValExplainer : public FullSValVisitor<SValExplainer, std::string> {
   ASTContext &ACtx;
   ProgramStateRef State;
 
+  std::string printCFGElementRef(const CFGBlock::ConstCFGElementRef ElemRef) {
+    std::string Str;
+    llvm::raw_string_ostream OS(Str);
+    ElemRef->dumpToStream(OS);
+    // HACK: `CFGBlock::ConstCFGElementRef::dumpToStream` contains a new line
+    // character in the end of the string, we don't want it so we remove it here.
+    while (!Str.empty() && std::isspace(Str.back())) {
----------------
isuckatcs wrote:

`std::isspace` is dependant on the local, so I would advise against using it.

Also don't we have a builtin `trim()` function in LLVM, which can be used here?

https://github.com/llvm/llvm-project/pull/128251


More information about the cfe-commits mailing list