https://github.com/benshi001 closed
https://github.com/llvm/llvm-project/pull/73335
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
benshi001 wrote:
The CI test seems being pending, so I do a new `push` to refresh it.
https://github.com/llvm/llvm-project/pull/73335
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/benshi001 updated
https://github.com/llvm/llvm-project/pull/73335
>From b520a4aee77f36622e82b12a32fee54ed20b07d0 Mon Sep 17 00:00:00 2001
From: Ben Shi
Date: Fri, 24 Nov 2023 22:51:27 +0800
Subject: [PATCH] [clang][analyzer] Support `fputs` in the StreamChecker
---
.../Stat
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/73335
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
benshi001 wrote:
> I prefer to have the new test code with
> `StreamTesterChecker_make_feof_stream` in a new test function (with
> appropriate name like `write_after_eof_is_allowed`), to improve code
> maintainability (`fputc` and `fputs` can be in the same function).
>
> In github PR's usual
https://github.com/benshi001 updated
https://github.com/llvm/llvm-project/pull/73335
>From ff1ab48c5760302dc55ff889b5b3dfd0b884aa33 Mon Sep 17 00:00:00 2001
From: Ben Shi
Date: Fri, 24 Nov 2023 22:51:27 +0800
Subject: [PATCH 1/2] [clang][analyzer] Support `fputs` in the StreamChecker
---
.../
balazske wrote:
I prefer to have the new test code with `StreamTesterChecker_make_feof_stream`
in a new test function (with appropriate name like
`write_after_eof_is_allowed`), to improve code maintainability (`fputc` and
`fputs` can be in the same function).
In github PR's usually force push
@@ -824,20 +817,76 @@ void StreamChecker::evalFgetcFputc(const FnDescription
*Desc,
// If a (non-EOF) error occurs, the resulting value of the file position
// indicator for the stream is indeterminate.
- StreamErrorState NewES;
- if (IsRead)
-NewES =
-OldSS
https://github.com/benshi001 updated
https://github.com/llvm/llvm-project/pull/73335
>From a335821f73529a0460a848fb12820fb60dc91c09 Mon Sep 17 00:00:00 2001
From: Ben Shi
Date: Fri, 24 Nov 2023 22:51:27 +0800
Subject: [PATCH] [clang][analyzer] Support `fputs` in the StreamChecker
---
.../Stat
https://github.com/benshi001 updated
https://github.com/llvm/llvm-project/pull/73335
>From d2a50ecca1d4a3d7c3db5331486488effe2d120c Mon Sep 17 00:00:00 2001
From: Ben Shi
Date: Fri, 24 Nov 2023 22:51:27 +0800
Subject: [PATCH] [clang][analyzer] Support `fputs` in the StreamChecker
---
.../Stat
@@ -141,6 +141,24 @@ void error_fputc(void) {
fputc('A', F); // expected-warning {{Stream might be already closed}}
}
+void error_fputs(void) {
+ FILE *F = tmpfile();
+ if (!F)
+return;
+ int Ret = fputs("XYZ", F);
+ if (Ret >= 0) {
+clang_analyzer_eval(feof(F) |
@@ -824,20 +817,76 @@ void StreamChecker::evalFgetcFputc(const FnDescription
*Desc,
// If a (non-EOF) error occurs, the resulting value of the file position
// indicator for the stream is indeterminate.
- StreamErrorState NewES;
- if (IsRead)
-NewES =
-OldSS
@@ -824,20 +817,76 @@ void StreamChecker::evalFgetcFputc(const FnDescription
*Desc,
// If a (non-EOF) error occurs, the resulting value of the file position
// indicator for the stream is indeterminate.
- StreamErrorState NewES;
- if (IsRead)
-NewES =
-OldSS
@@ -824,20 +817,76 @@ void StreamChecker::evalFgetcFputc(const FnDescription
*Desc,
// If a (non-EOF) error occurs, the resulting value of the file position
// indicator for the stream is indeterminate.
- StreamErrorState NewES;
- if (IsRead)
-NewES =
-OldSS
@@ -824,20 +817,76 @@ void StreamChecker::evalFgetcFputc(const FnDescription
*Desc,
// If a (non-EOF) error occurs, the resulting value of the file position
// indicator for the stream is indeterminate.
- StreamErrorState NewES;
- if (IsRead)
-NewES =
-OldSS
https://github.com/benshi001 updated
https://github.com/llvm/llvm-project/pull/73335
>From 881d627cde823edded1c0fd1a72d9ffc2f4ee186 Mon Sep 17 00:00:00 2001
From: Ben Shi
Date: Fri, 24 Nov 2023 22:51:27 +0800
Subject: [PATCH] [clang][analyzer] Support `fputs` in the StreamChecker
---
.../Stat
https://github.com/benshi001 updated
https://github.com/llvm/llvm-project/pull/73335
>From 2759d206be48d68dc93ed34efa782daf1097bb26 Mon Sep 17 00:00:00 2001
From: Ben Shi
Date: Fri, 24 Nov 2023 22:51:27 +0800
Subject: [PATCH] [clang][analyzer] Support `fputs` in the StreamChecker
---
.../Stat
https://github.com/benshi001 updated
https://github.com/llvm/llvm-project/pull/73335
>From 9a11834bb5a8d2c0aa97311541ca5a2b9848c859 Mon Sep 17 00:00:00 2001
From: Ben Shi
Date: Fri, 24 Nov 2023 22:51:27 +0800
Subject: [PATCH] [clang][analyzer] Support `fputs` in the StreamChecker
---
.../Stat
https://github.com/benshi001 updated
https://github.com/llvm/llvm-project/pull/73335
>From efb399b878830899cdabc2fe0ee9d6fd398df259 Mon Sep 17 00:00:00 2001
From: Ben Shi
Date: Fri, 24 Nov 2023 22:51:27 +0800
Subject: [PATCH] [clang][analyzer] Support `fputs` in the StreamChecker
---
.../Stat
https://github.com/benshi001 updated
https://github.com/llvm/llvm-project/pull/73335
>From caa4a548adbab8532b6a3906e574eb9584914631 Mon Sep 17 00:00:00 2001
From: Ben Shi
Date: Fri, 24 Nov 2023 22:51:27 +0800
Subject: [PATCH] [clang][analyzer] Support `fputs` in the StreamChecker
---
.../Stat
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff 5ac5c0e7d1007745456329dbcf05aa15b50c08c8
c015c1aa18e1048071dc59e637b7e20707b9ae83 --
https://github.com/benshi001 updated
https://github.com/llvm/llvm-project/pull/73335
>From c015c1aa18e1048071dc59e637b7e20707b9ae83 Mon Sep 17 00:00:00 2001
From: Ben Shi
Date: Fri, 24 Nov 2023 22:51:27 +0800
Subject: [PATCH] [clang][analyzer] Support `fputs` in the StreamChecker
---
.../Stat
https://github.com/balazske edited
https://github.com/llvm/llvm-project/pull/73335
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -774,26 +780,45 @@ void StreamChecker::evalFgetcFputc(const FnDescription
*Desc,
// `fgetc` returns the read character on success, otherwise returns EOF.
// `fputc` returns the written character on success, otherwise returns EOF.
+ // `fputs` returns a non negative va
@@ -50,6 +50,7 @@ size_t fread(void *restrict, size_t, size_t, FILE *restrict);
size_t fwrite(const void *restrict, size_t, size_t, FILE *restrict);
int fgetc(FILE *stream);
int fputc(int ch, FILE *stream);
+int fputs(const char *str, FILE *stream);
balazske wr
https://github.com/balazske requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/73335
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang-static-analyzer-1
@llvm/pr-subscribers-clang
Author: Ben Shi (benshi001)
Changes
---
Full diff: https://github.com/llvm/llvm-project/pull/73335.diff
4 Files Affected:
- (modified) clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp (+43-18)
-
https://github.com/benshi001 created
https://github.com/llvm/llvm-project/pull/73335
None
>From c59788f4b918c5335efe7444b8d588878565cb26 Mon Sep 17 00:00:00 2001
From: Ben Shi
Date: Fri, 24 Nov 2023 22:51:27 +0800
Subject: [PATCH] [clang][analyzer] Support `fputs` in the StreamChecker
---
..
28 matches
Mail list logo