r340500 - Revert "[CStringSyntaxChecker] Reduces space around error message for strlcat."

George Karpenkov via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 22 17:02:12 PDT 2018


Author: george.karpenkov
Date: Wed Aug 22 17:02:12 2018
New Revision: 340500

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

This reverts commit 6b43b80320722da41ca6ef7a3b57cc300fb83094.

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=340500&r1=340499&r2=340500&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp Wed Aug 22 17:02:12 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=340500&r1=340499&r2=340500&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/cstring-syntax.c (original)
+++ cfe/trunk/test/Analysis/cstring-syntax.c Wed Aug 22 17:02:12 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