[clang] [clang][analyzer] FixedAddressChecker: no warning if system macro is used (PR #108993)

2024-09-17 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/108993 None From c13a4d7ed344209359ddb838b2688805ceb06304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Tue, 17 Sep 2024 17:33:34 +0200 Subject: [PATCH] [clang][analyzer] FixedAddressChecke

[clang] [clang][analyzer] Fix documentation of checker 'StackAddrAsyncEscape' (NFC) (PR #108586)

2024-09-13 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/108586 The checker was indicated as a 'C' language checker but is only applicable to 'ObjC' code. From 620a17fca9e6c011099e223cb965cd4bcc8f413a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date

[clang] [clang][analyzer] Move 'alpha.core.PointerSub' checker into 'core.PointerSub' (PR #107596)

2024-09-09 Thread Balázs Kéri via cfe-commits
balazske wrote: > I'm not satisfied with the quality of the reports. The report refers to > `Subtraction of two pointers that do not point into the same array is > undefined behavior` without pointing out where the two pointers point to > (and/or where are they declared, or set to point to dif

[clang] [clang][analyzer] Move 'alpha.core.PointerSub' checker into 'core.PointerSub' (PR #107596)

2024-09-06 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/107596 Checker was tested on 16 projects. The only results were the offset calculations that were considered as valid (faulty) cases already. https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=vim_

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-09-06 Thread Balázs Kéri via cfe-commits
https://github.com/balazske closed https://github.com/llvm/llvm-project/pull/101836 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Bring alpha.security.MmapWriteExec checker out of alpha package (PR #102636)

2024-09-03 Thread Balázs Kéri via cfe-commits
https://github.com/balazske closed https://github.com/llvm/llvm-project/pull/102636 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Add more notes to PointerSubChecker (PR #102432)

2024-09-02 Thread Balázs Kéri via cfe-commits
https://github.com/balazske closed https://github.com/llvm/llvm-project/pull/102432 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Bring alpha.security.MmapWriteExec checker out of alpha package (PR #102636)

2024-09-02 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/102636 From 11e871ab17c119c71b8ef4bbcd3b186ec0e9a14f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Fri, 9 Aug 2024 17:41:46 +0200 Subject: [PATCH 1/2] [clang][analyzer] Bring checker alpha.

[clang] [clang][analyzer] Bring alpha.security.MmapWriteExec checker out of alpha package (PR #102636)

2024-09-02 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/102636 From 11e871ab17c119c71b8ef4bbcd3b186ec0e9a14f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Fri, 9 Aug 2024 17:41:46 +0200 Subject: [PATCH] [clang][analyzer] Bring checker alpha.secur

[clang] [clang][analyzer] Bring alpha.security.MmapWriteExec checker out of alpha package (PR #102636)

2024-08-30 Thread Balázs Kéri via cfe-commits
balazske wrote: I have tested it on some of the projects but there are not results from this checker. The detected type of bug looks unlikely so it is difficult to test the checker this way. https://github.com/llvm/llvm-project/pull/102636 ___ cfe-co

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-30 Thread Balázs Kéri via cfe-commits
@@ -5968,11 +5962,21 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { } if (D->hasDefaultArgument()) { +// Default argument can be "inherited" when it has a reference to the +// previous declaration (of the default argument) which is stored

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-30 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/101836 From 2e98fc222566c5e746ade4ccaba23de3b59e0a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Sat, 3 Aug 2024 18:10:34 +0200 Subject: [PATCH 1/3] [clang][ASTImporter] New fix for defaul

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-23 Thread Balázs Kéri via cfe-commits
@@ -5968,11 +5962,21 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { } if (D->hasDefaultArgument()) { +// Default argument can be "inherited" when it has a reference to the +// previous declaration (of the default argument) which is stored

[clang] [clang][ASTImporter] set nonnull type for var specialized from lambda template (PR #105492)

2024-08-22 Thread Balázs Kéri via cfe-commits
balazske wrote: This fix looks good, but I can not tell now why it would not work to import the type just before construction of the `VarTemplateSpecializationDecl`. I tried it and all tests passed. Probably I can test this on a set of projects. https://github.com/llvm/llvm-project/pull/105492

[clang] [clang][analyzer] Bring alpha.security.MmapWriteExec checker out of alpha package (PR #102636)

2024-08-22 Thread Balázs Kéri via cfe-commits
balazske wrote: It is not easy to find an easily compilable (and not too big) project that contains `mmap` to test the checker. I could test it with libgit2, can try to find more projects to test. https://github.com/llvm/llvm-project/pull/102636 ___

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-21 Thread Balázs Kéri via cfe-commits
@@ -5968,11 +5962,21 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { } if (D->hasDefaultArgument()) { +// Default argument can be "inherited" when it has a reference to the +// previous declaration (of the default argument) which is stored

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-21 Thread Balázs Kéri via cfe-commits
@@ -5968,11 +5962,21 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { } if (D->hasDefaultArgument()) { +// Default argument can be "inherited" when it has a reference to the +// previous declaration (of the default argument) which is stored

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-21 Thread Balázs Kéri via cfe-commits
@@ -5968,11 +5962,21 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { } if (D->hasDefaultArgument()) { +// Default argument can be "inherited" when it has a reference to the +// previous declaration (of the default argument) which is stored

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-21 Thread Balázs Kéri via cfe-commits
@@ -5968,11 +5962,21 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { } if (D->hasDefaultArgument()) { +// Default argument can be "inherited" when it has a reference to the +// previous declaration (of the default argument) which is stored

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-21 Thread Balázs Kéri via cfe-commits
@@ -5968,11 +5962,21 @@ ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) { } if (D->hasDefaultArgument()) { +// Default argument can be "inherited" when it has a reference to the +// previous declaration (of the default argument) which is stored

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-16 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/101836 From 2e98fc222566c5e746ade4ccaba23de3b59e0a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Sat, 3 Aug 2024 18:10:34 +0200 Subject: [PATCH 1/2] [clang][ASTImporter] New fix for defaul

[clang] [clang][analyzer] Remove array bounds check from PointerSubChecker (PR #102580)

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

[clang] [clang][analyzer] Remove array bounds check from PointerSubChecker (PR #102580)

2024-08-12 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/102580 From 08367f06167d8b12ee4de06a37915decd1e754e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Fri, 9 Aug 2024 09:31:55 +0200 Subject: [PATCH 1/3] [clang][analyzer] Remove array bounds c

[clang] [clang][analyzer] Bring checker alpha.security.MmapWriteExec out of alpha package (PR #102636)

2024-08-09 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/102636 None From 11e871ab17c119c71b8ef4bbcd3b186ec0e9a14f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Fri, 9 Aug 2024 17:41:46 +0200 Subject: [PATCH] [clang][analyzer] Bring checker alpha

[clang] [clang][analyzer] Remove array bounds check from PointerSubChecker (PR #102580)

2024-08-09 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/102580 From 08367f06167d8b12ee4de06a37915decd1e754e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Fri, 9 Aug 2024 09:31:55 +0200 Subject: [PATCH 1/2] [clang][analyzer] Remove array bounds c

[clang] [clang][analyzer] Remove array bounds check from PointerSubChecker (PR #102580)

2024-08-09 Thread Balázs Kéri via cfe-commits
balazske wrote: The `ArrayBoundV2` checker needs some update to find all cases. For example `(&x - 1) - &x` is not found, because the checker does only check `ArraySubscriptExpr` (and others), not a `BinaryOperator` with pointer and integer. https://github.com/llvm/llvm-project/pull/102580 __

[clang] [clang][analyzer] Add more notes to PointerSubChecker (PR #102432)

2024-08-09 Thread Balázs Kéri via cfe-commits
balazske wrote: I uploaded now #102580 that removes the entire array bounds checking. https://github.com/llvm/llvm-project/pull/102432 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Remove array bounds check from PointerSubChecker (PR #102580)

2024-08-09 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/102580 At pointer subtraction only pointers are allowed that point into an array (or one after the end), this fact was checker by the checker. This check is now removed because it is a special case of array indexing

[clang] [clang][analyzer] Add more notes to PointerSubChecker (PR #102432)

2024-08-08 Thread Balázs Kéri via cfe-commits
balazske wrote: If the `ArrayBoundsV2` checker is finished it should find all of the cases in the test of `PointerSubChecker` that have out-of-bound indexing, and including the cases where a single variable is handled like an 1-element array? If yes the bounds check is not needed in this check

[clang] [clang][analyzer] Add more notes to PointerSubChecker (PR #102432)

2024-08-08 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/102432 Notes appear at out-of-range array index for index value and array size. From b9753a79654b1428f753a2fad865eacdf0250ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Thu, 8 Aug 2024 0

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-03 Thread Balázs Kéri via cfe-commits
@@ -9919,6 +9919,103 @@ TEST_P(ImportTemplateParmDeclDefaultValue, ImportExistingVarTemplate) { testImport(FromLastD); } +TEST_P(ImportTemplateParmDeclDefaultValue, + ImportParentTemplateDuringNonTypeTemplateParmDecl) { + // This wants to provoke that during import o

[clang] [clang][ASTImporter] New fix for default template parameter values. (PR #101836)

2024-08-03 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/101836 Commit e4440b8 added a change that introduced new crash in an incorrectly handled case. This is fixed here. From 2e98fc222566c5e746ade4ccaba23de3b59e0a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20

[clang] [clang][ASTImporter] support import return with UnaryTransformType (PR #101517)

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

[clang] [clang][ASTImporter] Remove trailing return testing on lambda proto (PR #101031)

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

[clang] [clang][ASTImporter] Remove trailing return testing on lambda proto (PR #101031)

2024-08-01 Thread Balázs Kéri via cfe-commits
balazske wrote: My concern was only that the return type check check can be too much overhead now if done for all C++11 lambdas but probably this type of lambda can not be recognized in other way (maybe from source locations?). But it is only the C++11 (not newer) case and it is more safe to c

[clang] [clang][analyzer] Improve PointerSubChecker (PR #96501)

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

[clang] [clang][ASTImporter] Remove trailing return testing on lambda proto (PR #101031)

2024-07-31 Thread Balázs Kéri via cfe-commits
balazske wrote: > Here can `ToProcess.append(CurrentS->child_begin(), CurrentS->child_end());` > add any nullptr into `ToProcess` in this testing context? I think it is possible, but I could not reproduce this case with the shown code. https://github.com/llvm/llvm-project/pull/101031 ___

[clang] [clang][ASTImporter] Remove trailing return testing on lambda proto (PR #101031)

2024-07-31 Thread Balázs Kéri via cfe-commits
balazske wrote: This looks like a good fix if there is no other way to detect the "C++11 lambda without parentheses" case. https://github.com/llvm/llvm-project/pull/101031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [analyzer] Fix crash of StreamChecker when eval calling 'fopen' (PR #100990)

2024-07-29 Thread Balázs Kéri via cfe-commits
https://github.com/balazske approved this pull request. This looks good now, documentation could be a bit more exact in that operations on standard streams are not checked by the checker, like any other operation on streams that are not opened on the analysis path. https://github.com/llvm/llvm

[clang] [clang][ASTImporter] Fix import of template parameter default values. (PR #100100)

2024-07-29 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/100100 From e4440b82f3d1fe5c7cafbad87da0e266d35a619e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Tue, 23 Jul 2024 11:20:22 +0200 Subject: [PATCH 1/2] [clang][ASTImporter] Fix import of tem

[clang] [analyzer] Avoid crashes in the stream checker (PR #100901)

2024-07-29 Thread Balázs Kéri via cfe-commits
balazske wrote: > Exactly. I didn't want to rush too much, but I can share that my current idea > is to call `assumeNoAliasingWithStdStreams` only on the success path. This can be a better (and more simple) solution. https://github.com/llvm/llvm-project/pull/100901

[clang] [analyzer] Avoid crashes in the stream checker (PR #100901)

2024-07-29 Thread Balázs Kéri via cfe-commits
balazske wrote: In the state dump I see that `stdout` seems to be NULL (last line in "constraints"). This explains why the `StateNull` becomes NULL, because call to `assumeNoAliasingWithStdStreams` was called already. I think the better solution is to check NULL-ness of the std stream variable

[clang] Revert "Reland [clang][ASTImport] Add support for import of empty records" (PR #100903)

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

[clang] [clang][analyzer] MmapWriteExecChecker improvements (PR #97078)

2024-07-26 Thread Balázs Kéri via cfe-commits
https://github.com/balazske closed https://github.com/llvm/llvm-project/pull/97078 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Improve PointerSubChecker (PR #96501)

2024-07-25 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/96501 From b431151f83fa2980e4a132191ccf5713ab69806b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Mon, 24 Jun 2024 16:48:54 +0200 Subject: [PATCH 1/2] [clang][analyzer] Improve PointerSubChe

[clang] [clang][analyzer] MmapWriteExecChecker improvements (PR #97078)

2024-07-25 Thread Balázs Kéri via cfe-commits
@@ -1,13 +1,14 @@ // RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=alpha.security.MmapWriteExec -analyzer-config alpha.security.MmapWriteExec:MmapProtExec=1 -analyzer-config alpha.security.MmapWriteExec:MmapProtRead=4 -DUSE_ALTERNATIVE_PROT_EXEC_DEFINIT

[clang] [clang][analyzer] MmapWriteExecChecker improvements (PR #97078)

2024-07-25 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/97078 From 1f04ce794a3aefc0f5622a9dea0a92a1e2b50be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Tue, 25 Jun 2024 16:27:00 +0200 Subject: [PATCH 1/3] [clang][analyzer] MmapWriteExecChecker

[clang] [clang][analyzer] MmapWriteExecChecker improvements (PR #97078)

2024-07-24 Thread Balázs Kéri via cfe-commits
balazske wrote: I removed the options to specify `PROT_` values. These should not be needed because detection from macro value should work in normal cases (probably this functionality was not available when the options were added). https://github.com/llvm/llvm-project/pull/97078 __

[clang] [analyzer] Assume the result of 'fopen' can't alias with 'std{in,out,err}' (PR #100085)

2024-07-24 Thread Balázs Kéri via cfe-commits
balazske wrote: Documentation of the checker could be updated with this new behavior. https://github.com/llvm/llvm-project/pull/100085 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] MmapWriteExecChecker improvements (PR #97078)

2024-07-24 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/97078 From 1f04ce794a3aefc0f5622a9dea0a92a1e2b50be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Tue, 25 Jun 2024 16:27:00 +0200 Subject: [PATCH 1/2] [clang][analyzer] MmapWriteExecChecker

[clang] [clang][ASTImporter] Fix import of template parameter default values. (PR #100100)

2024-07-23 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/100100 Default values of template parameters (non-type, type, template) were not correctly handled in the "inherited" case. This occurs if the first declaration contains the default value but a next one not. The defa

[clang] [clang][analyzer] MmapWriteExecChecker improvements (PR #97078)

2024-07-19 Thread Balázs Kéri via cfe-commits
@@ -21,30 +21,55 @@ #include "clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h" #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/Checker

[clang] [clang][ASTImporter] Fix import of anonymous enums if multiple are present (PR #99281)

2024-07-17 Thread Balázs Kéri via cfe-commits
https://github.com/balazske edited https://github.com/llvm/llvm-project/pull/99281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] Fix import of anonymous enums if multiple are present (PR #99281)

2024-07-17 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/99281 After the last change in PR #87144 regressions appeared in some cases. The problem was that if multiple anonymous enums are present in a class and are imported as new the import of the second enum can fail beca

[clang] [clang][analyzer] MmapWriteExecChecker improvements (PR #97078)

2024-06-28 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/97078 Read the 'mmap' flags from macro values and use a better test for the error situation. From 1f04ce794a3aefc0f5622a9dea0a92a1e2b50be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Tue

[clang] [clang][analyzer] Improve PointerSubChecker (PR #96501)

2024-06-28 Thread Balázs Kéri via cfe-commits
balazske wrote: Even protobuf contains this type of code: https://codechecker-demo.eastus.cloudapp.azure.com/Default/report-detail?run=protobuf_v3.13.0_pointersub1&is-unique=on&diff-type=New&checker-name=alpha.core.PointerSub&report-id=5545776&report-hash=1bcd310fbaeccbcc13645b9b277239a2&report-f

[clang] [clang][analyzer] Improve PointerSubChecker (PR #96501)

2024-06-28 Thread Balázs Kéri via cfe-commits
balazske wrote: If the array bounds checker does the same job then the array bounds check it is not needed in this checker. Specially if it makes no difference if the indexing is used at pointer subtraction. https://github.com/llvm/llvm-project/pull/96501 __

[clang] [clang][analyzer] Improve documentation of checker 'cplusplus.Move' (NFC) (PR #96295)

2024-06-28 Thread Balázs Kéri via cfe-commits
https://github.com/balazske closed https://github.com/llvm/llvm-project/pull/96295 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Improve documentation of checker 'cplusplus.Move' (NFC) (PR #96295)

2024-06-27 Thread Balázs Kéri via cfe-commits
balazske wrote: I fixed a test that contained the entire option help description. I think this is not needed, removed it and only included the first line of the description. https://github.com/llvm/llvm-project/pull/96295 ___ cfe-commits mailing list

[clang] [clang][analyzer] Improve documentation of checker 'cplusplus.Move' (NFC) (PR #96295)

2024-06-27 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/96295 From 0c57ad1ca36a841dff700eb98f878475e0243b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Fri, 21 Jun 2024 12:13:02 +0200 Subject: [PATCH 1/3] [clang][analyzer] Improve documentation

[clang] [clang][analyzer] Improve PointerSubChecker (PR #96501)

2024-06-26 Thread Balázs Kéri via cfe-commits
balazske wrote: The warning message may be still misleading if the LHS or RHS "arrays" are non-array variables. Is it better to improve the messages in this case (or detect if `offsetof` can be used and include it in the message)? https://github.com/llvm/llvm-project/pull/96501 ___

[clang] [clang][analyzer] Improve PointerSubChecker (PR #96501)

2024-06-26 Thread Balázs Kéri via cfe-commits
balazske wrote: These results look correct according to the checker, but I am not sure if such results are useful or really invalid: https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=vim_v8.2.1920_pointersub1&is-unique=on&diff-type=New&checker-name=alpha.core.PointerSub In t

[clang] [clang][analyzer] Improve PointerSubChecker (PR #96501)

2024-06-24 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/96501 The checker could report false positives if pointer arithmetic was done on pointers to non-array data before pointer subtraction. Another problem is fixed that could cause false positive if members of the same

[clang] [clang][analyzer] Add notes to PointerSubChecker (PR #95899)

2024-06-24 Thread Balázs Kéri via cfe-commits
https://github.com/balazske closed https://github.com/llvm/llvm-project/pull/95899 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Improve documentation of checker 'cplusplus.Move' (NFC) (PR #96295)

2024-06-21 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/96295 From 0c57ad1ca36a841dff700eb98f878475e0243b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Fri, 21 Jun 2024 12:13:02 +0200 Subject: [PATCH 1/2] [clang][analyzer] Improve documentation

[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-06-21 Thread Balázs Kéri via cfe-commits
https://github.com/balazske closed https://github.com/llvm/llvm-project/pull/89887 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)

2024-06-21 Thread Balázs Kéri via cfe-commits
balazske wrote: I have not enough resources to create a reproducer and it is not trivial, so I would merge this change now. https://github.com/llvm/llvm-project/pull/89887 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [clang][analyzer] Improve documentation of checker 'cplusplus.Move' (NFC) (PR #96295)

2024-06-21 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/96295 None From 0c57ad1ca36a841dff700eb98f878475e0243b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Fri, 21 Jun 2024 12:13:02 +0200 Subject: [PATCH] [clang][analyzer] Improve documentati

[clang] [clang] Move 'alpha.cplusplus.MisusedMovedObject' to 'cplusplus.Move' in documentation (NFC) (PR #95003)

2024-06-20 Thread Balázs Kéri via cfe-commits
https://github.com/balazske closed https://github.com/llvm/llvm-project/pull/95003 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)

2024-06-20 Thread Balázs Kéri via cfe-commits
https://github.com/balazske approved this pull request. At least the `StreamChecker` part looks correct, Probably we can test on the opensource projects if there appear too many bad results (but probably not many resource leak cases are found). https://github.com/llvm/llvm-project/pull/94957 _

[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)

2024-06-20 Thread Balázs Kéri via cfe-commits
balazske wrote: > > I did not find a similar test for `MallocChecker` but there could be one > > with similar test functions. > > I'm not sure what tests you are referring to. I did fix your other > observations. I meant another test file where the `NoStateChangeFuncVisitor` is tested (if the

[clang] [clang][analyzer] Add notes to PointerSubChecker (PR #95899)

2024-06-19 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/95899 From 1eb6e7ebde0e97e1cd077dc27ffd3ebd6ed0e93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Tue, 18 Jun 2024 10:09:24 +0200 Subject: [PATCH 1/4] [clang][analyzer] Add notes to PointerS

[clang] [clang][analyzer] Add notes to PointerSubChecker (PR #95899)

2024-06-19 Thread Balázs Kéri via cfe-commits
@@ -144,9 +144,24 @@ void PointerSubChecker::checkPreStmt(const BinaryOperator *B, // Allow arithmetic on different symbolic regions. if (isa(SuperLR) || isa(SuperRR)) return; +if (const auto *SuperDLR = dyn_cast(SuperLR)) + DiffDeclL = SuperDLR->getDecl

[clang] [clang][analyzer] Add notes to PointerSubChecker (PR #95899)

2024-06-19 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/95899 From 1eb6e7ebde0e97e1cd077dc27ffd3ebd6ed0e93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Tue, 18 Jun 2024 10:09:24 +0200 Subject: [PATCH 1/3] [clang][analyzer] Add notes to PointerS

[clang] [clang][analyzer] Add notes to PointerSubChecker (PR #95899)

2024-06-18 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/95899 From 1eb6e7ebde0e97e1cd077dc27ffd3ebd6ed0e93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Tue, 18 Jun 2024 10:09:24 +0200 Subject: [PATCH 1/2] [clang][analyzer] Add notes to PointerS

[clang] [clang][analyzer] Add notes to PointerSubChecker (PR #95899)

2024-06-18 Thread Balázs Kéri via cfe-commits
balazske wrote: I found difficult results from the checker where it is not obvious what the problem is. One type is this case where a negative index is found (any of these results, or check the first one): https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=curl_curl-7_66_0_p

[clang] [clang][analyzer] Add notes to PointerSubChecker (PR #95899)

2024-06-18 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/95899 Notes are added to indicate the array declarations of the arrays in a found invalid pointer subtraction. From 1eb6e7ebde0e97e1cd077dc27ffd3ebd6ed0e93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3

[clang] [Clang][Sema] Skip checking anonymous enum in using enum declaration (PR #87144)

2024-06-17 Thread Balázs Kéri via cfe-commits
balazske wrote: I did not get crash with this script and latest clang. Probably there is a difference in the used system headers (`iostream` and `string` is included)? https://github.com/llvm/llvm-project/pull/87144 ___ cfe-commits mailing list cfe-co

[clang] [analyzer] Check the correct first and last elements in cstring.UninitializedRead (PR #95408)

2024-06-14 Thread Balázs Kéri via cfe-commits
@@ -393,6 +401,173 @@ ProgramStateRef CStringChecker::checkNonNull(CheckerContext &C, return stateNonNull; } +static std::optional getIndex(ProgramStateRef State, + const ElementRegion *ER, CharKind CK) { + SValBuilder &SValBuilder = St

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-13 Thread Balázs Kéri via cfe-commits
balazske wrote: It should be possible in `StreamChecker` to perform the invalidations even if the `StreamState` is not found (stream was not opened). Another possible solution is that a generic invalidation support is added to `StdLibraryFunctionsChecker` that can be used for stream related an

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-13 Thread Balázs Kéri via cfe-commits
https://github.com/balazske approved this pull request. It looks now OK at least to my knowledge. https://github.com/llvm/llvm-project/pull/93408 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)

2024-06-11 Thread Balázs Kéri via cfe-commits
@@ -696,6 +732,69 @@ struct StreamOperationEvaluator { } // end anonymous namespace +//===--===// +// Definition of NoStreamStateChangeVisitor. +//===--

[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)

2024-06-11 Thread Balázs Kéri via cfe-commits
@@ -696,6 +730,69 @@ struct StreamOperationEvaluator { } // end anonymous namespace +//===--===// +// Definition of NoStreamStateChangeVisitor. +//===--

[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)

2024-06-11 Thread Balázs Kéri via cfe-commits
https://github.com/balazske edited https://github.com/llvm/llvm-project/pull/94957 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)

2024-06-11 Thread Balázs Kéri via cfe-commits
https://github.com/balazske commented: I did not find big issues. But a description could be added to the `NoOwnershipChangeVisitor` to explain what it does, and to `StreamChecker` for what is it used. I did not find a similar test for `MallocChecker` but there could be one with similar test f

[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)

2024-06-11 Thread Balázs Kéri via cfe-commits
@@ -0,0 +1,179 @@ +// RUN: %clang_analyze_cc1 -verify %s -analyzer-output=text \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-checker=unix.Stream balazske wrote: This file can have a better name (like "stream-notes-missing-close.cpp"). https://github

[clang] [clang] Move 'alpha.cplusplus.MisusedMovedObject' to 'cplusplus.Move' in documentation (NFC) (PR #95003)

2024-06-10 Thread Balázs Kéri via cfe-commits
https://github.com/balazske created https://github.com/llvm/llvm-project/pull/95003 The checker was renamed at some time ago but the documentation was not updated. The section is now just moved and renamed. The documentation is still very simple and needs improvement. From 6bcef3384ed986447b1

[clang] [clang][analyzer] Improved PointerSubChecker (PR #93676)

2024-06-10 Thread Balázs Kéri via cfe-commits
https://github.com/balazske closed https://github.com/llvm/llvm-project/pull/93676 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][analyzer] Improved PointerSubChecker (PR #93676)

2024-06-10 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/93676 From a896030e71d09ebe7239d6fab343606918ee4c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Wed, 29 May 2024 14:28:43 +0200 Subject: [PATCH 1/5] [clang][analyzer] Improved PointerSubCh

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balázs Kéri via cfe-commits
@@ -0,0 +1,443 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-07 Thread Balázs Kéri via cfe-commits
@@ -0,0 +1,443 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer][NFC] Factor out NoOwnershipChangeVisitor (PR #94357)

2024-06-07 Thread Balázs Kéri via cfe-commits
@@ -0,0 +1,116 @@ +//===--*- C++ -*--// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balázs Kéri via cfe-commits
https://github.com/balazske edited https://github.com/llvm/llvm-project/pull/93408 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balázs Kéri via cfe-commits
@@ -0,0 +1,443 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balázs Kéri via cfe-commits
@@ -0,0 +1,443 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-06 Thread Balázs Kéri via cfe-commits
@@ -0,0 +1,443 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [clang][analyzer] Improved PointerSubChecker (PR #93676)

2024-06-06 Thread Balázs Kéri via cfe-commits
https://github.com/balazske updated https://github.com/llvm/llvm-project/pull/93676 From a896030e71d09ebe7239d6fab343606918ee4c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?= Date: Wed, 29 May 2024 14:28:43 +0200 Subject: [PATCH 1/4] [clang][analyzer] Improved PointerSubCh

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-05 Thread Balázs Kéri via cfe-commits
@@ -0,0 +1,412 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-05 Thread Balázs Kéri via cfe-commits
@@ -0,0 +1,412 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

[clang] [analyzer] Refine invalidation caused by `fread` (PR #93408)

2024-06-05 Thread Balázs Kéri via cfe-commits
@@ -0,0 +1,412 @@ +// RUN: %clang_analyze_cc1 -verify %s \ +// RUN: -triple x86_64-linux-gnu \ +// RUN: -analyzer-checker=core,unix.Stream,alpha.security.taint \ +// RUN: -analyzer-checker=debug.ExprInspection + +#include "Inputs/system-header-simulator-for-simple-stream.h"

  1   2   3   4   5   6   7   8   >