[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

2021-04-07 Thread Balázs Benics via Phabricator via cfe-commits
steakhal abandoned this revision. steakhal added a comment. In D99658#2671747 , @NoQ wrote: > I mean, the extent of an `ElementRegion` //is// the size of a single element. > The reason why our intrinsic isn't doing what you expect is because we > represe

[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

2021-04-06 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision. NoQ added a comment. I mean, the extent of an `ElementRegion` //is// the size of a single element. The reason why our intrinsic isn't doing what you expect is because we represent the pointer with offset as `ElementRegion` regardless of whether operator `[]` was used

[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

2021-04-06 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. In D99658#2665730 , @NoQ wrote: > What about `clang_analyzer_getExtent(&x[2])` then? I guess `(extent of heap segment that starts at symbol of type 'int *' conjured at statement 'new int [ext]') - 8` is the value I expect - whic

[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

2021-04-01 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. What about `clang_analyzer_getExtent(&x[2])` then? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99658/new/ https://reviews.llvm.org/D99658 ___ cfe-commits mailing list cfe-commits@l

[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

2021-04-01 Thread Gabor Marton via Phabricator via cfe-commits
martong accepted this revision. martong added a comment. LG! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99658/new/ https://reviews.llvm.org/D99658 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

2021-03-31 Thread Balázs Benics via Phabricator via cfe-commits
steakhal updated this revision to Diff 334470. steakhal marked 3 inline comments as done. steakhal added a comment. This revision is now accepted and ready to land. Fix comments. I could not manage to create an `unknown` extent, where the behavior would diverge. Repository: rG LLVM Github Mon

[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

2021-03-31 Thread Balázs Benics via Phabricator via cfe-commits
steakhal planned changes to this revision. steakhal added a comment. In D99658#2661452 , @martong wrote: > Ah, I see you need `nonloc::SymbolVal` in your next patch, and > `getDynamicSizeWithOffset` returns an Unknown if the extend is symbolic. > > Anyway

[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

2021-03-31 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Ah, I see you need `nonloc::SymbolVal` in your next patch, and `getDynamicSizeWithOffset` returns an Unknown if the extend is symbolic. Anyway, I still feel misleading that `clang_analyzer_getExtent` does not handle the offset. Could we change `getDynamicSizeWithOffset`

[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

2021-03-31 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp:258 + DefinedOrUnknownSVal Size = + getDynamicSize(State, MR->getBaseRegion(), C.getSValBuilder()); martong wrote: > Wait a bit, I think it should consi

[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

2021-03-31 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp:258 + DefinedOrUnknownSVal Size = + getDynamicSize(State, MR->getBaseRegion(), C.getSValBuilder()); Wait a bit, I think it should consider the offset to

[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

2021-03-31 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko added inline comments. Comment at: clang/test/Analysis/explain-svals.cpp:56 clang_analyzer_explain(x); // expected-warning-re^pointer to element of type 'int' with index 0 of heap segment that starts at symbol of type 'int \*' conjured at statement 'new int \[

[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

2021-03-31 Thread Valeriy Savchenko via Phabricator via cfe-commits
vsavchenko accepted this revision. vsavchenko added a comment. This revision is now accepted and ready to land. Looking great! Thanks! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99658/new/ https://reviews.llvm.org/D99658 ___

[PATCH] D99658: [analyzer] Fix clang_analyzer_getExtent for heap regions

2021-03-31 Thread Balázs Benics via Phabricator via cfe-commits
steakhal created this revision. steakhal added reviewers: NoQ, vsavchenko, martong, xazax.hun, balazske, Szelethus. Herald added subscribers: ASDenysPetrov, Charusso, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, whisperity. steakhal requested review of thi