r339808 - [CStringSyntaxChecker] Reduces space around error message for strlcat.

David Carlier via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 15 13:09:52 PDT 2018


Author: devnexen
Date: Wed Aug 15 13:09:52 2018
New Revision: 339808

URL: http://llvm.org/viewvc/llvm-project?rev=339808&view=rev
Log:
[CStringSyntaxChecker] Reduces space around error message for strlcat.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp
    cfe/trunk/test/Analysis/cstring-syntax.c

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp?rev=339808&r1=339807&r2=339808&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp Wed Aug 15 13:09:52 2018
@@ -273,7 +273,7 @@ void WalkAST::VisitCallExpr(CallExpr *CE
       if (!LenName.empty())
         os << "'" << LenName << "'";
       else
-        os << " <size> ";
+        os << "<size>";
       if (!DstName.empty())
         os << " - strlen(" << DstName << ")";
       else

Modified: cfe/trunk/test/Analysis/cstring-syntax.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/cstring-syntax.c?rev=339808&r1=339807&r2=339808&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/cstring-syntax.c (original)
+++ cfe/trunk/test/Analysis/cstring-syntax.c Wed Aug 15 13:09:52 2018
@@ -42,7 +42,7 @@ void testStrlcat(const char *src) {
   strlcpy(dest, "aaaaa", sizeof("aaaaa") - 1);
   strlcat(dest, "bbbb", (sizeof("bbbb") - 1) - sizeof(dest) - 1);
   strlcpy(dest, "012345678", sizeof(dest));
-  strlcat(dest, "910", sizeof(dest)); // expected-warning {{The third argument allows to potentially copy more bytes than it should. Replace with the value  <size>  - strlen(dest) - 1 or lower}}
+  strlcat(dest, "910", sizeof(dest)); // expected-warning {{The third argument allows to potentially copy more bytes than it should. Replace with the value <size> - strlen(dest) - 1 or lower}}
   strlcpy(dest, "0123456789", sizeof(dest));
   strlcat(dest, "0123456789", badlen); // expected-warning {{The third argument allows to potentially copy more bytes than it should. Replace with the value 'badlen' - strlen(dest) - 1 or lower}}
   strlcat(dest, "0123456789", badlen - strlen(dest) - 1);




More information about the cfe-commits mailing list