[clang] [DRAFT][analyzer][NFC] clang-format our folders (PR #82599)

Paul T Robinson via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 26 08:09:03 PST 2024


================
@@ -219,17 +219,19 @@ void WalkAST::VisitCallExpr(CallExpr *CE) {
     if (containsBadStrncatPattern(CE)) {
       const Expr *DstArg = CE->getArg(0);
       const Expr *LenArg = CE->getArg(2);
-      PathDiagnosticLocation Loc =
-        PathDiagnosticLocation::createBegin(LenArg, BR.getSourceManager(), AC);
+      PathDiagnosticLocation Loc = PathDiagnosticLocation::createBegin(
+          LenArg, BR.getSourceManager(), AC);
 
       StringRef DstName = getPrintableName(DstArg);
 
       SmallString<256> S;
       llvm::raw_svector_ostream os(S);
       os << "Potential buffer overflow. ";
       if (!DstName.empty()) {
-        os << "Replace with 'sizeof(" << DstName << ") "
-              "- strlen(" << DstName <<") - 1'";
+        os << "Replace with 'sizeof(" << DstName
+           << ") "
+              "- strlen("
+           << DstName << ") - 1'";
----------------
pogo59 wrote:

Yeah, lots of these ostream chained operators are written to reflect coherent bits of output, and clang-format will be unaware of the semantic relevance. I think `clang-format off` is the only solution here.

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


More information about the cfe-commits mailing list