[clang] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker (PR #77040)
Balázs Kéri via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 8 01:13:00 PST 2024
================
@@ -75,13 +75,16 @@ void errno_mkdtemp(char *template) {
}
}
-void errno_getcwd(char *Buf, size_t sz) {
- char *Path = getcwd(Buf, sz);
- if (Path == NULL) {
- clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}}
- if (errno) {} // no warning
+void errno_getcwd_general(char *Buf, size_t Sz) {
+ char *Path = getcwd(Buf, Sz);
+ if (Sz == 0) {
+ clang_analyzer_eval(errno != 0); // expected-warning{{TRUE}}
----------------
balazske wrote:
clang_analyzer_eval(Path == NULL); // expected-warning{{TRUE}}
https://github.com/llvm/llvm-project/pull/77040
More information about the cfe-commits
mailing list