https://github.com/balazske updated
https://github.com/llvm/llvm-project/pull/74627
From cbcb81ebdbc49e3bd11b6f716ac14658a729b787 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Tue, 5 Dec 2023 15:23:37 +0100
Subject: [PATCH 1/3] [clang][ASTImporter] Improve import of f
@@ -1191,6 +1199,84 @@ void StreamChecker::evalSetFeofFerror(const
FnDescription *Desc,
C.addTransition(State);
}
+void StreamChecker::preFflush(const FnDescription *Desc, const CallEvent &Call,
+ CheckerContext &C) const {
+ ProgramStateRef St
https://github.com/balazske edited
https://github.com/llvm/llvm-project/pull/74296
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/74296
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1191,6 +1199,84 @@ void StreamChecker::evalSetFeofFerror(const
FnDescription *Desc,
C.addTransition(State);
}
+void StreamChecker::preFflush(const FnDescription *Desc, const CallEvent &Call,
+ CheckerContext &C) const {
+ ProgramStateRef St
@@ -299,6 +299,60 @@ void error_fseek_0(void) {
fclose(F);
}
+void error_fflush_0(void) {
+ FILE *F = tmpfile();
+ int Ret;
+ fflush(NULL); // no-warning
+ if (!F) {
+if ((Ret = fflush(F)) != EOF)
+ clang_analyzer_eval(Ret == 0); // expected
@@ -1191,6 +1199,84 @@ void StreamChecker::evalSetFeofFerror(const
FnDescription *Desc,
C.addTransition(State);
}
+void StreamChecker::preFflush(const FnDescription *Desc, const CallEvent &Call,
+ CheckerContext &C) const {
+ ProgramStateRef St
balazske wrote:
This code for the loop in `VisitTypeAliasTemplateDecl` should work:
```
for (auto *FoundDecl : FoundDecls) {
if (!FoundDecl->isInIdentifierNamespace(IDNS))
continue;
if (auto *FoundAlias = dyn_cast(FoundDecl)) {
if (IsStructuralMatch(D, FoundAlias))
@@ -9284,6 +9284,29 @@ TEST_P(ASTImporterOptionSpecificTestBase,
// EXPECT_EQ(ToF1Imported->getPreviousDecl(), ToF1);
}
+TEST_P(ASTImporterOptionSpecificTestBase, ImportTypeAliasTemplateDecl) {
balazske wrote:
I like better names for the test
(`ImportTypeA
balazske wrote:
>
> Is import of `Callable` should be failed? I compiled this code
>
> ```c++
> struct S;
> template
> using Callable = S;
> template
> using Callable = S;
> ```
>
> and clang report an error.
Yes the test was not exact, with the new code this import should fail.
https://gi
@@ -1977,6 +1977,22 @@ static bool
IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
D2->getTemplatedDecl()->getType());
}
+static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
+
@@ -5050,6 +5050,59 @@ TEST_P(ImportFriendClasses, RecordVarTemplateDecl) {
EXPECT_EQ(ToTUX, ToX);
}
+TEST_P(ASTImporterOptionSpecificTestBase, VarTemplateDeclConflict) {
+ getToTuDecl(
+ R"(
+ template
+ constexpr int X = 1;
+ )",
+ Lang_CXX14);
+
@@ -3220,6 +3220,12 @@ TEST_P(ImportExpr, UnresolvedMemberExpr) {
compoundStmt(has(callExpr(has(unresolvedMemberExpr());
}
+TEST_P(ImportExpr, BuiltinBitCastExpr) {
+ MatchVerifier Verifier;
+ testImport("void declToImport(int T) { (void)__builtin_bi
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/74991
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/74813
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske edited
https://github.com/llvm/llvm-project/pull/74296
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/74296
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -299,6 +299,74 @@ void error_fseek_0(void) {
fclose(F);
}
+void error_fflush_after_fclose(void) {
+ FILE *F = tmpfile();
+ int Ret;
+ fflush(NULL); // no-warning
+ if (!F)
+return;
+ if ((Ret = fflush(F)) != 0)
+clang_analyzer_eval(Ret ==
@@ -1191,6 +1199,82 @@ void StreamChecker::evalSetFeofFerror(const
FnDescription *Desc,
C.addTransition(State);
}
+void StreamChecker::preFflush(const FnDescription *Desc, const CallEvent &Call,
+ CheckerContext &C) const {
+ ProgramStateRef St
@@ -1191,6 +1199,82 @@ void StreamChecker::evalSetFeofFerror(const
FnDescription *Desc,
C.addTransition(State);
}
+void StreamChecker::preFflush(const FnDescription *Desc, const CallEvent &Call,
+ CheckerContext &C) const {
+ ProgramStateRef St
@@ -299,6 +299,74 @@ void error_fseek_0(void) {
fclose(F);
}
+void error_fflush_after_fclose(void) {
+ FILE *F = tmpfile();
+ int Ret;
+ fflush(NULL); // no-warning
+ if (!F)
+return;
+ if ((Ret = fflush(F)) != 0)
+clang_analyzer_eval(Ret ==
@@ -1191,6 +1199,82 @@ void StreamChecker::evalSetFeofFerror(const
FnDescription *Desc,
C.addTransition(State);
}
+void StreamChecker::preFflush(const FnDescription *Desc, const CallEvent &Call,
+ CheckerContext &C) const {
+ ProgramStateRef St
@@ -299,6 +299,74 @@ void error_fseek_0(void) {
fclose(F);
}
+void error_fflush_after_fclose(void) {
+ FILE *F = tmpfile();
+ int Ret;
+ fflush(NULL); // no-warning
+ if (!F)
+return;
+ if ((Ret = fflush(F)) != 0)
+clang_analyzer_eval(Ret ==
@@ -1191,6 +1199,82 @@ void StreamChecker::evalSetFeofFerror(const
FnDescription *Desc,
C.addTransition(State);
}
+void StreamChecker::preFflush(const FnDescription *Desc, const CallEvent &Call,
+ CheckerContext &C) const {
+ ProgramStateRef St
balazske wrote:
You have found that reason for the crash is that references to `IdentifierInfo`
are remaining in `OnDiskChainedHashTableGenerator` and previously deallocated
by `ASTUnit` destruction? In this case why is the `ASTUnit` (or something in
it, probably `ASTContext`) the owner of the
balazske wrote:
I plan to fix import of `VarTemplateSpecializationDecl` in a different PR. The
indicated assertion "Missing call to MapImported?" is likely to related to this
part.
https://github.com/llvm/llvm-project/pull/72841
___
cfe-commits maili
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/72627
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -64,6 +100,28 @@ double arrayInStructPtr(struct vec *pv) {
// expected-note@-2 {{Access of the field 'elems' at index 64, while it
holds only 64 'double' elements}}
}
+struct item {
+ int a, b;
+} itemArray[20] = {0};
+
+int structOfArrays(void) {
balaz
https://github.com/balazske requested changes to this pull request.
I think it is better to add the import of AttrName to the attribute import code
(function `Import(const Attr *FromAttr)` and what is called from it). Probably
it works to add it to `AttrImporter::cloneAttr` and do it like `cons
https://github.com/balazske closed
https://github.com/llvm/llvm-project/pull/69724
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -437,12 +439,67 @@ class StmtComparer {
};
} // namespace
+static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
+ const UnaryOperator *E1,
+ const CXXOperatorCallExpr *E2) {
+ re
https://github.com/balazske edited
https://github.com/llvm/llvm-project/pull/72242
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2252,6 +2252,176 @@ TEST_F(StructuralEquivalenceStmtTest,
UnaryOperatorDifferentOps) {
EXPECT_FALSE(testStructuralMatch(t));
}
+TEST_F(StructuralEquivalenceStmtTest,
+ CXXOperatorCallExprVsUnaryBinaryOperator) {
+ auto t = makeNamedDecls(
+ R"(
+ templa
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
@@ -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
@@ -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
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
@@ -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
@@ -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) |
https://github.com/balazske updated
https://github.com/llvm/llvm-project/pull/72242
From 5300f979c96eb2f88c298872f0519e274c155cfe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Tue, 14 Nov 2023 11:53:20 +0100
Subject: [PATCH 1/2] [clang][ASTImporter] Improve structural
balazske wrote:
I have updated the comment.
Probably I can test it with more projects after the other fixes with variable
templates (#72841) are finished, then there may be less crashes.
https://github.com/llvm/llvm-project/pull/72242
___
cfe-commits
@@ -350,17 +383,38 @@ void ArrayBoundCheckerV2::checkLocation(SVal Location,
bool IsLoad,
if (ExceedsUpperBound) {
if (!WithinUpperBound) {
// We know that the index definitely exceeds the upper bound.
-std::string RegName = getRegionName(Reg);
-
@@ -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
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
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
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/73290
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/73638
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1191,6 +1199,83 @@ void StreamChecker::evalSetFeofFerror(const
FnDescription *Desc,
C.addTransition(State);
}
+void StreamChecker::preFflush(const FnDescription *Desc, const CallEvent &Call,
+ CheckerContext &C) const {
+ ProgramStateRef St
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/74296
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske updated
https://github.com/llvm/llvm-project/pull/75308
From 2e6fe315bdebea705d84b4152a831e5934b659eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Wed, 13 Dec 2023 10:23:48 +0100
Subject: [PATCH 1/2] [clang][ASTImporter] Import AlignValueA
https://github.com/balazske closed
https://github.com/llvm/llvm-project/pull/75308
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
balazske wrote:
I do not see much benefit of adding `fileno` to the checker in the current
state. If the `StdLibraryFunctionsChecker` is turned on it will anyway do a
similar modeling of `fileno` (this applied to `ftell` too). The `fileno` and
`ftell` are semantically different and `fileno` ca
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/74919
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1491,6 +1492,12 @@ static bool
IsRecordContextStructurallyEquivalent(RecordDecl *D1,
return false;
}
+if (auto *D1Spec = dyn_cast(DC1)) {
+ auto *D2Spec = dyn_cast(DC2);
balazske wrote:
It would be better to check if `D2Spec` is null
@@ -9342,6 +9342,38 @@ TEST_P(ASTImporterOptionSpecificTestBase,
ImportConflictTypeAliasTemplate) {
EXPECT_FALSE(ImportedCallable);
}
+AST_MATCHER(ClassTemplateSpecializationDecl, hasInstantiatedFromMember) {
+ if (auto Instantiate = Node.getInstantiatedFrom()) {
+if (
@@ -9342,6 +9342,38 @@ TEST_P(ASTImporterOptionSpecificTestBase,
ImportConflictTypeAliasTemplate) {
EXPECT_FALSE(ImportedCallable);
}
+AST_MATCHER(ClassTemplateSpecializationDecl, hasInstantiatedFromMember) {
+ if (auto Instantiate = Node.getInstantiatedFrom()) {
+if (
@@ -9342,6 +9342,38 @@ TEST_P(ASTImporterOptionSpecificTestBase,
ImportConflictTypeAliasTemplate) {
EXPECT_FALSE(ImportedCallable);
}
+AST_MATCHER(ClassTemplateSpecializationDecl, hasInstantiatedFromMember) {
+ if (auto Instantiate = Node.getInstantiatedFrom()) {
+if (
@@ -2511,10 +2511,12 @@ void StdLibraryFunctionsChecker::initFunctionSummaries(
.ArgConstraint(NotNull(ArgNo(0;
// char *mkdtemp(char *template);
-// FIXME: Improve for errno modeling.
addToFunctionSummaryMap(
"mkdtemp", Signature(ArgTypes
@@ -54,3 +51,25 @@ int errno_lseek(int fildes, off_t offset) {
}
return 0;
}
+
+void errno_mkstemp(char *template) {
+ int FD = mkstemp(template);
+ if (FD >= 0) {
+if (errno) {}// expected-warning{{An undefined value
may be read from 'errno'}}
+
@@ -1491,6 +1492,12 @@ static bool
IsRecordContextStructurallyEquivalent(RecordDecl *D1,
return false;
}
+if (auto *D1Spec = dyn_cast(DC1)) {
+ auto *D2Spec = dyn_cast(DC2);
balazske wrote:
I see now that the old code was better, there i
https://github.com/balazske approved this pull request.
LGTM (if the tests pass)
https://github.com/llvm/llvm-project/pull/76671
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/76776
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/76493
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
balazske wrote:
One note that should be added to the documentation:
The `StreamChecker` does not handle file descriptors associated to streams.
Therefore some issues can appear, for example `fileno` does not return the
value that was used to open a stream with `fdopen`, and the standard streams
https://github.com/balazske created
https://github.com/llvm/llvm-project/pull/76979
Some stream functions were recently added to `StreamChecker` that were not
modeled by `StdCLibraryFunctionsChecker`. To ensure consistency these functions
are added to the other checker too.
Some of the related
https://github.com/balazske updated
https://github.com/llvm/llvm-project/pull/76979
From e24b90eebfff7a352dd2c0df7f948ffef26ea3b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Thu, 4 Jan 2024 18:16:12 +0100
Subject: [PATCH 1/2] [clang][analyzer] Add missing stream rel
balazske wrote:
Next step is to add all functions to the non-POSIX part that exist in the C
standard (at least the stream functions), and change `fread` and `fwrite` too
(currently `errno` is always modeled but should be only in POSIX mode).
https://github.com/llvm/llvm-project/pull/76979
@@ -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
balazske wrote:
Documentation is in **checkers.rst** but not accurate now. It must be updated
with more information.
https://github.com/llvm/llvm-project/pull/76776
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin
balazske wrote:
> Why do we need to keep these two checkers in-sync?
Technically the checkers work independently. There is a functionality that is
added by `StdLibraryFunctionsChecker`, the modeling of `errno` (this works even
if `StreamChecker` is not used), and maybe some preconditions are m
https://github.com/balazske edited
https://github.com/llvm/llvm-project/pull/76979
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
balazske wrote:
I can not check what caused exactly the problems but the change looks correct
and in change D154764 there seems to be no reason for re-ordering at non-record
objects. As an improvement, some tests could be added that check for
re-ordering at `RecordDecl` and (this is the more
@@ -2519,12 +2519,17 @@ void StdLibraryFunctionsChecker::initFunctionSummaries(
addToFunctionSummaryMap(
"getcwd", Signature(ArgTypes{CharPtrTy, SizeTy}, RetType{CharPtrTy}),
Summary(NoEvalCall)
-.Case({ReturnValueCondition(BO_EQ, ArgNo(0))},
+
@@ -2519,12 +2519,17 @@ void StdLibraryFunctionsChecker::initFunctionSummaries(
addToFunctionSummaryMap(
"getcwd", Signature(ArgTypes{CharPtrTy, SizeTy}, RetType{CharPtrTy}),
Summary(NoEvalCall)
-.Case({ReturnValueCondition(BO_EQ, ArgNo(0))},
+
@@ -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) {} /
https://github.com/balazske updated
https://github.com/llvm/llvm-project/pull/76979
From e24b90eebfff7a352dd2c0df7f948ffef26ea3b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Thu, 4 Jan 2024 18:16:12 +0100
Subject: [PATCH 1/3] [clang][analyzer] Add missing stream rel
https://github.com/balazske approved this pull request.
This reordering is not a significant feature (and may change in the future) and
no test existed before, it is enough (if this exists) if there is a GDB test
for the crash.
https://github.com/llvm/llvm-project/pull/77079
__
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
https://github.com/balazske created
https://github.com/llvm/llvm-project/pull/77331
`StdLibraryFunctionsChecker` is updated too with `ungetc`.
From 9bcc43b5c62ba969f91c495d4d570c5c4337aca2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Mon, 8 Jan 2024 16:42:58 +0100
S
https://github.com/balazske updated
https://github.com/llvm/llvm-project/pull/77331
From 9bcc43b5c62ba969f91c495d4d570c5c4337aca2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Mon, 8 Jan 2024 16:42:58 +0100
Subject: [PATCH 1/2] [clang][analyzer] Add 'ungetc' to Stream
https://github.com/balazske updated
https://github.com/llvm/llvm-project/pull/77331
From 9bcc43b5c62ba969f91c495d4d570c5c4337aca2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Mon, 8 Jan 2024 16:42:58 +0100
Subject: [PATCH 1/3] [clang][analyzer] Add 'ungetc' to Stream
@@ -916,6 +922,44 @@ void StreamChecker::evalFputx(const FnDescription *Desc,
const CallEvent &Call,
C.addTransition(StateFailed);
}
+void StreamChecker::evalUngetc(const FnDescription *Desc, const CallEvent
&Call,
+ CheckerContext &C) const {
@@ -916,6 +922,44 @@ void StreamChecker::evalFputx(const FnDescription *Desc,
const CallEvent &Call,
C.addTransition(StateFailed);
}
+void StreamChecker::evalUngetc(const FnDescription *Desc, const CallEvent
&Call,
+ CheckerContext &C) const {
balazske wrote:
I have already a patch to add these functions: #76979. The conditions for
`fputc` are not the same, this can be clarified at the other patch.
https://github.com/llvm/llvm-project/pull/77435
___
cfe-commits mailing list
cfe-commits@list
@@ -2201,6 +2214,56 @@ void StdLibraryFunctionsChecker::initFunctionSummaries(
ErrnoNEZeroIrrelevant, GenericFailureMsg)
.ArgConstraint(NotNull(ArgNo(0;
+// int fgetc(FILE *stream);
+// 'getc' is the same as 'fgetc' but may be a macro
https://github.com/balazske updated
https://github.com/llvm/llvm-project/pull/74627
From cbcb81ebdbc49e3bd11b6f716ac14658a729b787 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Tue, 5 Dec 2023 15:23:37 +0100
Subject: [PATCH 1/4] [clang][ASTImporter] Improve import of f
@@ -5919,15 +5919,26 @@ ExpectedDecl
ASTNodeImporter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
if (ToD)
return ToD;
- bool IsFriendTemplate = D->getFriendObjectKind() != Decl::FOK_None;
- bool IsDependentContext = DC != LexicalDC ? LexicalDC->isDependentContext(
https://github.com/balazske closed
https://github.com/llvm/llvm-project/pull/77331
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/77576
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske created
https://github.com/llvm/llvm-project/pull/77613
[clang][analyzer] Add function 'fprintf' to StreamChecker.
From 574816e425d623b3b07674422b901879cc3c83c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Wed, 10 Jan 2024 10:55:27 +0100
balazske wrote:
It is better to replace in code of `evalFtell` the `C.getASTContext().LongTy`
with `Call.getResultType()` (occurs 2 times), this is more exact if `off_t` is
defined to something else than `long`.
https://github.com/llvm/llvm-project/pull/77580
__
@@ -324,6 +355,57 @@ void error_fseek_0(void) {
fclose(F);
}
+void error_fseeko_0(void) {
+ FILE *F = fopen("file", "r");
+ if (!F)
+return;
+ int rc = fseeko(F, 0, SEEK_SET);
+ if (rc) {
+int IsFEof = feof(F), IsFError = ferror(F);
+// Get ferror or no error
@@ -324,6 +355,57 @@ void error_fseek_0(void) {
fclose(F);
}
+void error_fseeko_0(void) {
+ FILE *F = fopen("file", "r");
+ if (!F)
+return;
+ int rc = fseeko(F, 0, SEEK_SET);
+ if (rc) {
+int IsFEof = feof(F), IsFError = ferror(F);
+// Get ferror or no error
https://github.com/balazske deleted
https://github.com/llvm/llvm-project/pull/77580
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -324,6 +355,57 @@ void error_fseek_0(void) {
fclose(F);
}
+void error_fseeko_0(void) {
+ FILE *F = fopen("file", "r");
+ if (!F)
+return;
+ int rc = fseeko(F, 0, SEEK_SET);
+ if (rc) {
+int IsFEof = feof(F), IsFError = ferror(F);
+// Get ferror or no error
@@ -324,6 +355,57 @@ void error_fseek_0(void) {
fclose(F);
}
+void error_fseeko_0(void) {
+ FILE *F = fopen("file", "r");
+ if (!F)
+return;
+ int rc = fseeko(F, 0, SEEK_SET);
+ if (rc) {
+int IsFEof = feof(F), IsFError = ferror(F);
+// Get ferror or no error
@@ -268,8 +268,12 @@ class StreamChecker : public Checkerhttps://github.com/llvm/llvm-project/pull/77580
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
101 - 200 of 829 matches
Mail list logo