[clang] [analyzer][NFC] Take BugReport descriptions as Twine instead of StringRef (PR #205527)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 24 04:07:24 PDT 2026


================
@@ -156,19 +156,17 @@ void CXXArrayDeleteChecker::checkTypedDeleteExpr(
   if (!N)
     return;
 
-  SmallString<256> Buf;
-  llvm::raw_svector_ostream OS(Buf);
-
   QualType SourceType = BaseClassRegion->getValueType();
   QualType TargetType =
       DerivedClassRegion->getSymbol()->getType()->getPointeeType();
 
-  OS << "Deleting an array of '" << TargetType.getAsString()
-     << "' objects as their base class '"
-     << SourceType.getAsString(C.getASTContext().getPrintingPolicy())
-     << "' is undefined";
-
-  auto R = std::make_unique<PathSensitiveBugReport>(BT, OS.str(), N);
+  auto R = std::make_unique<PathSensitiveBugReport>(
+      BT,
+      "Deleting an array of '" + TargetType.getAsString() +
----------------
Xazax-hun wrote:

Wouldn't you still need to convert the first string literal to `Twine` to make sure we use the `Twine`'s overloaded operators? Same for other places. 

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


More information about the cfe-commits mailing list