[PATCH] D126801: [analyzer][NFC] Add partial specializations for ProgramStateTraits

2022-06-02 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM! Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h:292 -static void *MakeVoidPtr(data_type d) { - return const_cast(d);

[PATCH] D126802: [analyzer][NFC] Uplift checkers after D126801

2022-06-02 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126802/new/ https://reviews.llvm.org/D126802 ___ cfe-commits mailing list cfe-commits

[PATCH] D126560: [analyzer] Track assume call stack to detect fixpoint

2022-06-06 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Measurement results on the last diff looks good. F23339447: image.png Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126560/new/ https://reviews.llvm.org/D126560 ___

[PATCH] D126560: [analyzer] Track assume call stack to detect fixpoint

2022-06-06 Thread Gabor Marton via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGf66f4d3b07b2: [analyzer] Track assume call stack to detect fixpoint (authored by martong). Changed prior to commit: https://reviews.llvm.org/D1265

[PATCH] D126878: [analyzer] Remove NotifyAssumeClients

2022-06-06 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D126878#3553184 , @steakhal wrote: > Measure if it changes any reports. Results did not change, we had equal number of reports in all projects. Other stat numbers are also very close. F23339654: stats.html

[PATCH] D127190: [analyzer][NFC] Add LLVM_UNLIKELY to assumeDualImpl

2022-06-07 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added a reviewer: steakhal. Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: All

[PATCH] D127190: [analyzer][NFC] Add LLVM_UNLIKELY to assumeDualImpl

2022-06-07 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. F23340695: image.png Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127190/new/ https://reviews.llvm.org/D127190 ___ cfe-commits mailing list

[PATCH] D127190: [analyzer][NFC] Add LLVM_UNLIKELY to assumeDualImpl

2022-06-07 Thread Gabor Marton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG17e9ea613894: [analyzer][NFC] Add LLVM_UNLIKELY to assumeDualImpl (authored by martong). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127190/new/ https://r

[PATCH] D126878: [analyzer] Remove NotifyAssumeClients

2022-06-07 Thread Gabor Marton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG8131ee4c43a8: [analyzer] Remove NotifyAssumeClients (authored by martong). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126878/new/ https://reviews.llvm.or

[PATCH] D127105: [analyzer] Fix null pointer deref in CastValueChecker

2022-06-07 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/test/Analysis/cast-value-state-dump.cpp:26 if (dyn_cast_or_null(S)) { -// expected-note@-1 {{Assuming 'S' is not a 'Square'}} +// expected-note@-1 {{Assuming 'S' is not a 'const class clang::Square *'}} // expected-

[PATCH] D126215: [analyzer] Deprecate `-analyzer-store region` flag

2022-06-08 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D126215#3565572 , @steakhal wrote: > I believe, the silence from the code owner means that he agrees with this > change. > I'll land it tomorrow. I believe there is a misconception about the role of a code owner, we cannot e

[PATCH] D126560: [analyzer] Track assume call stack to detect fixpoint

2022-06-08 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Thanks for the report. I am looking into it. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126560/new/ https://reviews.llvm.org/D126560 ___ cfe-commits mailing list cfe-commits@l

[PATCH] D127285: [analyzer] Fix assertion failure after getKnwonValue call

2022-06-08 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added a reviewer: steakhal. Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. Herald added a project: All

[PATCH] D127285: [analyzer] Fix assertion failure after getKnownValue call

2022-06-08 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D127285#3566034 , @steakhal wrote: > ... Try to mark named entities like `this`. Could you please elaborate? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127285/new/ https://r

[PATCH] D126779: [analyzer] Fix assertion in simplifySymbolCast

2022-06-08 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126779/new/ https://reviews.llvm.org/D126779 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[PATCH] D117229: [Analyzer] Produce SymbolCast for pointer to integer cast

2022-06-08 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117229/new/ https://reviews.llvm.org/D117229 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[PATCH] D127285: [analyzer] Fix assertion failure after getKnownValue call

2022-06-08 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D127285#3566397 , @steakhal wrote: > In D127285#3566198 , @martong wrote: > >> In D127285#3566034 , @steakhal >> wrote: >> >>> ... Try to mark

[PATCH] D117229: [Analyzer] Produce SymbolCast for pointer to integer cast

2022-06-08 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 435152. martong added a comment. - Rebase to llvm/main Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117229/new/ https://reviews.llvm.org/D117229 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/

[PATCH] D127285: [analyzer] Fix assertion failure after getKnownValue call

2022-06-08 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 435154. martong marked an inline comment as done. martong added a comment. - Add one more sentence in the comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127285/new/ https://reviews.llvm.org/D127285 Fi

[PATCH] D127285: [analyzer] Fix assertion failure after getKnownValue call

2022-06-08 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:25-28 + // Query the constraint manager whether the SVal has only one possible + // (integer) value. If that is the case, the value is returned. Otherwise, + // returns NULL. + cons

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-08 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. > In theory, the engine should propagate taint in default eval call. If that > would be the case, we would still have this report. How complex would it be to add the taint propagation to the engine/evalCall? Do you see that feasible as a parent patch of this? Reposito

[PATCH] D125400: [clang][Analyzer] Add errno state to standard functions modeling.

2022-06-09 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/test/Analysis/errno-stdlibraryfunctions-notes.c:11 + +int access(const char *path, int amode); + Do you plan to extend the test file for other standard functions as well? Comment at: clang/test/A

[PATCH] D122150: [clang][analyzer] Add checker for bad use of 'errno'.

2022-06-09 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/docs/analyzer/checkers.rst:2553-2555 +The supported functions are the same that are modeled by checker +:doc:`alpha.unix.StdCLibraryFunctionArgs` (and affect value of ``errno``), +including effect of the ``ModelPOSIX`` option of th

[PATCH] D127389: [analyzer] Print the offending function at EndAnalysis crash

2022-06-09 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:616 void ExprEngine::processEndWorklist() { + PrettyStackTraceLocationContext CrashInfo(getRootLocationContext()); getCheckerManager().runCheckersForEndAnalysis(G, BR, *this); ---

[PATCH] D127396: [clang][ASTImporter] Fix import of function with auto return type.

2022-06-09 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. Herald added a subscriber: rnkovacs. Thanks, nice work! > This is a fix for issue #55500 . I think github will NOT automatically close the issue, unless you have a more specific format in t

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-09 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D127306#3566984 , @steakhal wrote: > In D127306#3566761 , @martong wrote: > >>> In theory, the engine should propagate taint in default eval call. If that >>> would be the case, we wou

[PATCH] D127389: [analyzer] Print the offending function at EndAnalysis crash

2022-06-09 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127389/new/ https://reviews.llvm.org/D127389

[PATCH] D127285: [analyzer] Fix assertion failure after getKnownValue call

2022-06-09 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D127285#3566032 , @steakhal wrote: > LGTM > Schedule a measurement to see what changes. Let's hope it won't introduce > more crashes. > If everything checks out, it gets approved. Results are good. No new assertion failures,

[PATCH] D127285: [analyzer] Fix assertion failure after getKnownValue call

2022-06-09 Thread Gabor Marton via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGbc2c759aeee7: [analyzer] Fix assertion failure after getKnownValue call (authored by martong). Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D122150: [clang][analyzer] Add checker for bad use of 'errno'.

2022-06-09 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. LGTM, it is a good start for an alpha checker. Comment at: clang/docs/ReleaseNotes.rst:525 +- Added a new checker ``alpha.unix.Errno``. This can find the first read + of ``errno`` after not failed standard function calls

[PATCH] D127306: [analyzer] Treat system globals as mutable if they are not const

2022-06-09 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D127306#3570170 , @steakhal wrote: > In D127306#3570083 , @martong wrote: > >> In D127306#3566984 , @steakhal >> wrote: >> >>> In D127306#3566

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-03-20 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 251648. martong marked an inline comment as done. martong added a comment. - Use prefixes for -verify to check different things in the same test file Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73898/new/ htt

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-03-20 Thread Gabor Marton via Phabricator via cfe-commits
martong marked an inline comment as done. martong added a comment. Thanks for the review guys! Comment at: clang/test/Analysis/std-c-library-functions-arg-constraints.c:1-7 +// RUN: %clang_analyze_cc1 %s \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-checker=apiMode

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-03-20 Thread Gabor Marton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG94061df6e5f2: [analyzer] StdLibraryFunctionsChecker: Add argument constraints (authored by martong). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73898/new/

[PATCH] D75063: [analyzer] StdLibraryFunctionsChecker: Add NotNull Arg Constraint

2020-03-20 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 251674. martong marked 9 inline comments as done. martong added a comment. - Use report/bugpath verify prefixes in test - Address review nits Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75063/new/ https://rev

[PATCH] D75063: [analyzer] StdLibraryFunctionsChecker: Add NotNull Arg Constraint

2020-03-20 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D75063#1923780 , @NoQ wrote: > This is basically a shorthand for "outside [0, 0]", right? I don't mind ^.^ Yeah, and my first attempt was exactly to implement this with ranges. However, it failed when I realized that we canno

[PATCH] D76361: [Analyzer] Iterator Modeling - Model `std::advance()`, `std::prev()` and `std::next()`

2020-03-20 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM! Comment at: clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp:221 +if (Handler) { + if (!C.wasInlined) { +if (Call.getNumArgs() > 1) { -

[PATCH] D75063: [analyzer] StdLibraryFunctionsChecker: Add NotNull Arg Constraint

2020-03-20 Thread Gabor Marton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGededa65d559d: [analyzer] StdLibraryFunctionsChecker: Add NotNull Arg Constraint (authored by martong). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75063/ne

[PATCH] D76509: [analyzer][NFC] Move the text output type to its own file, move code to PathDiagnosticConsumer creator functions

2020-03-23 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/Analyses.def:17 -ANALYSIS_STORE(RegionStore, "region", "Use region-based analyzer store", CreateRegionStoreManager) +ANALYSIS_STORE(RegionStore, "region", "Use region-based analyzer store", +

[PATCH] D76605: [analyzer] Display the checker name in the text output

2020-03-23 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp:98 const PathDiagnostic *PD = *I; + std::string WarningMsg = + (ShouldDisplayCheckerName ? " [" + PD->getCheckerName() + "]" : "") `StringRef`? `getC

[PATCH] D76590: [Analyzer] Model `empty()` member function of containers

2020-03-23 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp:34 - void handleBegin(CheckerContext &C, const Expr *CE, const SVal &RetVal, - const SVal &Cont) const; - void handleEnd(CheckerContext &C, const Expr *CE, con

[PATCH] D72281: [Matrix] Add matrix type to Clang.

2020-03-23 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/AST/ASTStructuralEquivalence.cpp:647 + return false; +if (Mat1->getNumRows() != Mat2->getNumRows()) + return false; Should we check `getNumColumns()` too? Repository: rG LLVM Github Monorepo

[PATCH] D76509: [analyzer][NFC] Move the text output type to its own file, move code to PathDiagnosticConsumer creator functions

2020-03-23 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. OK, LGTM. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76509/new/ https://reviews.llvm.org/D76509 ___ cfe-commits mailing list cfe-co

[PATCH] D76590: [Analyzer] Model `empty()` member function of containers

2020-03-23 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/Iterator.cpp:297 + +ProgramStateRef relateSymbols(ProgramStateRef State, SymbolRef Sym1, + SymbolRef Sym2, bool Equal) { Would `assumeEqual` be a better name

[PATCH] D76604: [Analyzer] Model `size()` member function of containers

2020-03-23 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp:456 + SVal RetVal) const { + const auto *ContReg = Cont.getAsRegion(); + if (!ContReg) Just out of curiosity: How do we handle c

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-03-25 Thread Gabor Marton via Phabricator via cfe-commits
martong marked an inline comment as done. martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:409 - Optional FoundSummary = findFunctionSummary(FD, CE, C); + for (const ValueConstraintPtr& VC : Summary.ArgConstraints) {

[PATCH] D71612: [analyzer] Add PlacementNewChecker

2020-03-25 Thread Gabor Marton via Phabricator via cfe-commits
martong marked 2 inline comments as done. martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp:1 +#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h" +#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" --

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-03-25 Thread Gabor Marton via Phabricator via cfe-commits
martong marked an inline comment as done. martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:409 - Optional FoundSummary = findFunctionSummary(FD, CE, C); + for (const ValueConstraintPtr& VC : Summary.ArgConstraints) {

[PATCH] D76790: [analyzer] StdLibraryFunctionsChecker: fix bug with arg constraints

2020-03-25 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: NoQ, Szelethus, baloghadamsoftware. Herald added subscribers: cfe-commits, ASDenysPetrov, steakhal, Charusso, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, xazax.hun, whisperity. Herald added a project: clang.

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-03-25 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. I just created a quick fix for the issue: https://reviews.llvm.org/D76790 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73898/new/ https://reviews.llvm.org/D73898 ___ cfe-commi

[PATCH] D76790: [analyzer] StdLibraryFunctionsChecker: fix bug with arg constraints

2020-03-25 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. I was thinking about the below test, but then I reverted back because I don't want to add "fake" summaries for testing purposes. Perhaps adding a new checker option could enable these "fake" summaries, @Szelethus what's your opinion? diff --git a/clang/lib/StaticAnaly

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:396 + /// yes was the value obtained or not. + mutable Optional> KernelZeroSizePtrValue; + Which one is referred to the lazy initialization? The inner or the outer? T

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1687 + if (ArgValKnown) { +if (!KernelZeroSizePtrValue) + KernelZeroSizePtrValue = martong wrote: > This is a bit confusing for me. Perhaps alternatively we c

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1687 + if (ArgValKnown) { +if (!KernelZeroSizePtrValue) + KernelZeroSizePtrValue = balazske wrote: > martong wrote: > > martong wrote: > > > This is a bit con

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:396 + /// yes was the value obtained or not. + mutable Optional> KernelZeroSizePtrValue; + balazske wrote: > martong wrote: > > Which one is referred to the lazy init

[PATCH] D76830: [Analyzer][MallocChecker] No warning for kfree of ZERO_SIZE_PTR.

2020-03-26 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. Herald added a subscriber: rnkovacs. LGTM! Comment at: clang/test/Analysis/kmalloc-linux-1.c:15 + +// FIXME: malloc checker expects kfree with 2 arguments, is this correct?

[PATCH] D76790: [analyzer] StdLibraryFunctionsChecker: fix bug with arg constraints

2020-03-27 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 253174. martong added a comment. - Add tests with a subchecker Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76790/new/ https://reviews.llvm.org/D76790 Files: clang/include/clang/StaticAnalyzer/Checkers/Chec

[PATCH] D77012: [analyzer] Fix StdLibraryFunctionsChecker NotNull Constraint Check

2020-03-30 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. LGTM and thanks! In D77012#1948550 , @NoQ wrote: > Thanks! > > @Szelethus can we make this checker depend on undefined value checker > (probably CallAndMessage) so that uninitialized arguments were

[PATCH] D76996: [analyzer] Improve PlacementNewChecker

2020-03-30 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Wohoow! I am impressed, this is really nice work, I like it! :) Could not find any glitch, looks good from my side once you address NoQ's concerns. Comment at: clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp:125 +Msg = std::string(llvm:

[PATCH] D76790: [analyzer] StdLibraryFunctionsChecker: fix bug with arg constraints

2020-03-30 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 253595. martong added a comment. - Test multiple constraints on the same arg Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76790/new/ https://reviews.llvm.org/D76790 Files: clang/include/clang/StaticAnalyzer

[PATCH] D77061: [analyzer] Add core.CallAndMessage to StdCLibraryFunctionArgsChecker's dependency

2020-03-30 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: Szelethus, NoQ. Herald added subscribers: cfe-commits, ASDenysPetrov, steakhal, Charusso, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun, whisperity. Herald added a project: clang.

[PATCH] D77066: [analyzer] ApiModeling: Add buffer size arg constraint

2020-03-30 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: NoQ, Szelethus, Charusso, steakhal. Herald added subscribers: cfe-commits, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun, whisperity. Herald added a project: clang.

[PATCH] D77061: [analyzer] Add core.CallAndMessage to StdCLibraryFunctionArgsChecker's dependency

2020-03-30 Thread Gabor Marton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG1a1bb876dba4: [analyzer] Add core.CallAndMessage to StdCLibraryFunctionArgsChecker's… (authored by martong). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77

[PATCH] D76996: [analyzer] Improve PlacementNewChecker

2020-03-31 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/test/Analysis/placement-new.cpp:265 + + // bad 2(custom align) + 1(index '2' offset) + ::new (&Xi.b[1]) long; // expected-warning{{Storage type is aligned to 3 bytes but allocated type is aligned to 8 bytes}} expected-note 1 {{}

[PATCH] D76996: [analyzer] Improve PlacementNewChecker

2020-03-31 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM! Thanks! But I am not that confident with the element regions and field regions, so @NoQ could you please take another look? Comment at: clang/lib/StaticAnalyzer/Chec

[PATCH] D77148: [analyzer] ApiModeling: Add buffer size arg constraint with multiplier involved

2020-03-31 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: Szelethus, NoQ, steakhal. Herald added subscribers: cfe-commits, ASDenysPetrov, Charusso, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun, whisperity. Herald added a project: clang.

[PATCH] D77125: [Analyzer] Model return values of container insert and delete operations

2020-03-31 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. It seems like we could model here `emplace` and `emplace_after` exactly the same way we do with `insert` and `insert_after`, couldn't we? Perhaps that could go into this patch too. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.

[PATCH] D77150: [Analyzer] New Option for ContainerModeling: AggressiveEraseModeling

2020-03-31 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Do you have a lit test as well? It would be useful to have one that is similar to the one you mention in the review's summary. Comment at: clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp:780 + if (AggressiveEraseModeling) { +if (const au

[PATCH] D77148: [analyzer] ApiModeling: Add buffer size arg constraint with multiplier involved

2020-04-01 Thread Gabor Marton via Phabricator via cfe-commits
martong marked 2 inline comments as done. martong added inline comments. Comment at: clang/test/Analysis/std-c-library-functions-arg-constraints.c:155 + __buf_size_arg_constraint_mul(buf, s, sizeof(short)); + clang_analyzer_eval(s * sizeof(short) <= 6); // \ + // report-warnin

[PATCH] D76790: [analyzer] StdLibraryFunctionsChecker: fix bug with arg constraints

2020-04-01 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Ping :) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76790/new/ https://reviews.llvm.org/D76790 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[PATCH] D77125: [Analyzer] Model return values of container insert and delete operations

2020-04-02 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D77125#1955245 , @baloghadamsoftware wrote: > In D77125#1952769 , @martong wrote: > > > It seems like we could model here `emplace` and `emplace_after` exactly the > > same way we do wi

[PATCH] D76790: [analyzer] StdLibraryFunctionsChecker: fix bug with arg constraints

2020-04-02 Thread Gabor Marton via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG1525232e2761: [analyzer] StdLibraryFunctionsChecker: fix bug with arg constraints (authored by martong). Changed prior to commit: https://reviews.llvm.org/D76790?vs=253595&id=254530#toc Repository: r

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-02-20 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 245651. martong marked 8 inline comments as done. martong added a comment. - Add new Checker that does the report - Refactor with negated RangeValues - Add overload to findFunctionSummary - Add tests for symbolic values - Add test file for bug path Repositor

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-02-20 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. I've done a major refactor with the handling of argument constraints. I am now reusing `ValueRange::apply` in `checkPreCall` on "negated" value ranges to check if the constraint is violated. Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunc

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-02-20 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 245652. martong added a comment. - Remove leftover call from test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73898/new/ https://reviews.llvm.org/D73898 Files: clang/include/clang/StaticAnalyzer/Checkers/C

[PATCH] D74973: [analyzer] StdLibraryFunctionsChecker refactor w/ inheritance

2020-02-21 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: NoQ, Szelethus, balazske, gamesh411, baloghadamsoftware, steakhal. Herald added subscribers: cfe-commits, Charusso, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, xazax.hun, whisperity. Herald added a project: clang. marto

[PATCH] D74973: [analyzer] StdLibraryFunctionsChecker refactor w/ inheritance

2020-02-21 Thread Gabor Marton via Phabricator via cfe-commits
martong marked an inline comment as done. martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:151 + + using ValueConstraintPtr = std::shared_ptr; + /// The complete list of constraints that defines a single branch. ---

[PATCH] D74720: [ASTImporter] Improved variable template redecl chain handling.

2020-02-24 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. LGTM! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D74720/new/ https://reviews.llvm.org/D74720

[PATCH] D71018: [ASTImporter] Improved import of TypeSourceInfo (TypeLoc)

2020-02-24 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. @shafik Ping :) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71018/new/ https://reviews.llvm.org/D71018 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-02-24 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:418 +if (FailureSt && !SuccessSt) { + C.addTransition(FailureSt); + if (ExplodedNode *N = C.generateErrorNode(FailureSt)) balazske wrote: > I

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-02-24 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 246193. martong marked 7 inline comments as done. martong added a comment. - Use StringRef for Msg - Remove superfluous addTransition Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73898/new/ https://reviews.llv

[PATCH] D74973: [analyzer] StdLibraryFunctionsChecker refactor w/ inheritance

2020-02-24 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. > Is really more kind of constraint needed than range constraint? Yes, there are other constraints I am planning to implement: - Size requirements E.g.: asctime_s(char *buf, rsize_t bufsz, const struct tm *time_ptr); `buf` size must be at least `bufsz`. - Not-null - Not

[PATCH] D75045: [analyzer] Improved check of `fgetc` in StreamChecker.

2020-02-24 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:356 +State = State->set( +StreamSym, StreamState{SS->K, false, SS->ShouldCallFerror}); + } Maybe adding a comment like `false /*Feof*/` could make this mor

[PATCH] D74973: [analyzer] StdLibraryFunctionsChecker refactor w/ inheritance

2020-02-24 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. In D74973#1889273 , @Szelethus wrote: > FYI I've been seeing your patches to this checker and I will respond to them, > but I need to do some learning on my own before having the confidence to > accept or request changes. Working

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-02-24 Thread Gabor Marton via Phabricator via cfe-commits
martong updated this revision to Diff 246229. martong added a comment. Rebase on top of https://reviews.llvm.org/D74973 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73898/new/ https://reviews.llvm.org/D73898 Files: clang/include/clang/StaticAna

[PATCH] D75063: [analyzer] StdLibraryFunctionsChecker: Add NotNull Arg Constraint

2020-02-24 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: NoQ, Szelethus, balazske, gamesh411, baloghadamsoftware, steakhal. Herald added subscribers: cfe-commits, Charusso, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, xazax.hun, whisperity. Herald added a project: clang. marto

[PATCH] D74973: [analyzer] StdLibraryFunctionsChecker refactor w/ inheritance

2020-02-24 Thread Gabor Marton via Phabricator via cfe-commits
martong marked an inline comment as done. martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:93 +ValueConstraint(ArgNo ArgN) : ArgN(ArgN) {} +virtual ProgramStateRef apply(ProgramStateRef State, const CallEvent &Cal

[PATCH] D74973: [analyzer] StdLibraryFunctionsChecker refactor w/ inheritance

2020-02-24 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. @balazske See https://reviews.llvm.org/D75063 about the simple independent implementation of the NotNull constraint. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D74973/new/ https://reviews.llvm.org/D74973 _

[PATCH] D73898: [analyzer] StdLibraryFunctionsChecker: Add argument constraints

2020-02-24 Thread Gabor Marton via Phabricator via cfe-commits
martong marked an inline comment as done. martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:152 +break; + default: +llvm_unreachable("Unknown RangeConstraint kind!"); This `default` br

[PATCH] D71018: [ASTImporter] Improved import of TypeSourceInfo (TypeLoc)

2020-02-25 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Thanks guys for the review and the comments! :) I am going to address all of them, but only during next week, I am on vacation for the rest of this week. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71018/new/ https://rev

[PATCH] D74735: [analyzer] Add support for CXXInheritedCtorInitExpr.

2020-03-02 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:932 + const CXXConstructExpr *getInheritingConstructor() const { +return cast(getInheritingStackFrame()->getCallSite()); + } This line causes a reg

[PATCH] D74735: [analyzer] Add support for CXXInheritedCtorInitExpr.

2020-03-03 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:932 + const CXXConstructExpr *getInheritingConstructor() const { +return cast(getInheritingStackFrame()->getCallSite()); + } martong wrote: > This

[PATCH] D75529: [analyzer] Limit UCharMax to min of max uchar or max int

2020-03-03 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. This revision is now accepted and ready to land. Looks good to me! Thanks! Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:514 + // Set UCharMax to min of int or uchar maximum value. + // Th

[PATCH] D74735: [analyzer] Add support for CXXInheritedCtorInitExpr.

2020-03-03 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. @NoQ I've found the following reproducer to crash in `CallAndMessageChecker`: class a { public: a(int); }; struct b : a { using a::a; }; void c() { int d; b x(d); //Crash!, Note, x(0) causes no crash } I am working on a fix, but any insight

[PATCH] D60499: [ASTImporter] Various source location and range import fixes.

2019-11-14 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Ping @shafik @balazske Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60499/new/ https://reviews.llvm.org/D60499 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[PATCH] D70439: [Analyzer][Docs][NFC] Add CodeChecker to the command line tools

2019-11-19 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: NoQ, Szelethus, xazax.hun, dkrupp. Herald added subscribers: cfe-commits, Charusso, gamesh411, donat.nagy, arphaman, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, whisperity. Herald added a project: clang. We add a new c

[PATCH] D70819: [ASTImporter] Support functions with placeholder return types ...

2019-11-28 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: balazske, a_sidorin. Herald added subscribers: cfe-commits, teemperor, gamesh411, Szelethus, dkrupp, rnkovacs. Herald added a reviewer: a.sidorin. Herald added a reviewer: shafik. Herald added a project: clang. Support functions with placeho

[PATCH] D70439: [Analyzer][Docs][NFC] Add CodeChecker to the command line tools

2019-11-28 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. @Szelethus, Kristof thanks for the review. @NoQ Ping. I'd like to have an approve from somebody who is outside the CodeChecker/E/// gang. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D70439/new/ https://reviews.llvm.org/D7

[PATCH] D69948: [Checkers] Added support for freopen to StreamChecker.

2019-11-28 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/test/Analysis/stream.c:160 +} else { + // Open failed, f1 points now to an invalid stream but this condition is currently not checked. + rewind(f1); This comment is confusing for me. Maybe there are

[PATCH] D70819: [ASTImporter] Support functions with placeholder return types ...

2019-12-02 Thread Gabor Marton via Phabricator via cfe-commits
martong marked 9 inline comments as done. martong added inline comments. Comment at: clang/lib/AST/ASTImporter.cpp:3008 +// which is equal to the given DC. +bool isAncestorDeclContextOf(DeclContext *DC, Decl *D) { + DeclContext *DCi = D->getDeclContext(); a_sido

<    14   15   16   17   18   19   20   21   22   23   >