hokein accepted this revision.
hokein added inline comments.
This revision is now accepted and ready to land.


================
Comment at: 
clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp:806
         const auto &T = MI->tokens().back();
-        StringRef ValueStr = StringRef(T.getLiteralData(), T.getLength());
-        llvm::APInt IntValue;
-        ValueStr.getAsInteger(10, IntValue);
-        AreSafeFunctionsWanted = IntValue.getZExtValue();
+        if (T.isLiteral()) {
+          StringRef ValueStr = StringRef(T.getLiteralData(), T.getLength());
----------------
let's add the `getLiteralData` check here --  `if (T.isLiteral() && 
T.getLiteralData())`


================
Comment at: 
clang-tools-extra/test/clang-tidy/checkers/bugprone-not-null-terminated-result-stdc-want-lib-ext1-not-a-literal.c:3
+// RUN: -- -std=c11 -I %S/Inputs/bugprone-not-null-terminated-result
+
+#include "not-null-terminated-result-c.h"
----------------
I think you probably need a `// UNSUPPORTED: system-windows`, as the 
`bugprone-not-null-terminated-result-strlen.c` does.


================
Comment at: 
clang-tools-extra/test/clang-tidy/checkers/bugprone-not-null-terminated-result-stdc-want-lib-ext1-not-a-literal.c:16
+}
\ No newline at end of file

----------------
nit: add EOF.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85525/new/

https://reviews.llvm.org/D85525

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to