[clang] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker (PR #77040)

2024-01-08 Thread Ben Shi via cfe-commits
https://github.com/benshi001 closed https://github.com/llvm/llvm-project/pull/77040 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker (PR #77040)

2024-01-08 Thread Balázs Kéri via cfe-commits
https://github.com/balazske approved this pull request. https://github.com/llvm/llvm-project/pull/77040 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker (PR #77040)

2024-01-08 Thread Ben Shi via cfe-commits
https://github.com/benshi001 updated https://github.com/llvm/llvm-project/pull/77040 >From 10a0e9aae5effdd6e26476e78a778b89373358df Mon Sep 17 00:00:00 2001 From: Ben Shi Date: Fri, 5 Jan 2024 10:05:15 +0800 Subject: [PATCH 1/3] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker 1

[clang] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker (PR #77040)

2024-01-08 Thread Balázs Kéri via cfe-commits
@@ -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) {} /

[clang] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker (PR #77040)

2024-01-08 Thread Balázs Kéri via cfe-commits
@@ -2519,12 +2519,17 @@ void StdLibraryFunctionsChecker::initFunctionSummaries( addToFunctionSummaryMap( "getcwd", Signature(ArgTypes{CharPtrTy, SizeTy}, RetType{CharPtrTy}), Summary(NoEvalCall) -.Case({ReturnValueCondition(BO_EQ, ArgNo(0))}, +

[clang] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker (PR #77040)

2024-01-08 Thread Balázs Kéri via cfe-commits
@@ -2519,12 +2519,17 @@ void StdLibraryFunctionsChecker::initFunctionSummaries( addToFunctionSummaryMap( "getcwd", Signature(ArgTypes{CharPtrTy, SizeTy}, RetType{CharPtrTy}), Summary(NoEvalCall) -.Case({ReturnValueCondition(BO_EQ, ArgNo(0))}, +

[clang] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker (PR #77040)

2024-01-06 Thread Ben Shi via cfe-commits
https://github.com/benshi001 updated https://github.com/llvm/llvm-project/pull/77040 >From 10a0e9aae5effdd6e26476e78a778b89373358df Mon Sep 17 00:00:00 2001 From: Ben Shi Date: Fri, 5 Jan 2024 10:05:15 +0800 Subject: [PATCH 1/2] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker 1

[clang] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker (PR #77040)

2024-01-05 Thread Balázs Kéri via cfe-commits
@@ -2516,12 +2516,15 @@ void StdLibraryFunctionsChecker::initFunctionSummaries( .ArgConstraint(NotNull(ArgNo(0; // char *getcwd(char *buf, size_t size); -// FIXME: Improve for errno modeling. addToFunctionSummaryMap( "getcwd", Signature(Ar

[clang] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker (PR #77040)

2024-01-04 Thread Ben Shi via cfe-commits
https://github.com/benshi001 updated https://github.com/llvm/llvm-project/pull/77040 >From 10a0e9aae5effdd6e26476e78a778b89373358df Mon Sep 17 00:00:00 2001 From: Ben Shi Date: Fri, 5 Jan 2024 10:05:15 +0800 Subject: [PATCH] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker 1. Im

[clang] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker (PR #77040)

2024-01-04 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Ben Shi (benshi001) Changes 1. Improve the 'errno' modeling. 2. Improve the buffer size argument's constraint. --- Full diff: https://github.com/llvm/llvm-project/pull/77040.diff 4 Files Affected: - (modified) clang/lib/StaticAnalyzer/C

[clang] Improve modeling of 'getcwd' in the StdLibraryFunctionsChecker (PR #77040)

2024-01-04 Thread Ben Shi via cfe-commits
https://github.com/benshi001 created https://github.com/llvm/llvm-project/pull/77040 1. Improve the 'errno' modeling. 2. Improve the buffer size argument's constraint. >From ab7f635446f8277ef305e606ca6973860755e316 Mon Sep 17 00:00:00 2001 From: Ben Shi Date: Fri, 5 Jan 2024 10:05:15 +0800 Sub