[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-05-08 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 262845. baloghadamsoftware added a comment. Added support for `ParamRegions` as original region for captured variables by blocks and lambdas. Only 2 failing tests left. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-05-08 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/Store.cpp:472 + break; +} + baloghadamsoftware wrote: > baloghadamsoftware wrote: > > Probably this loop could be

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-05-07 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/Store.cpp:472 + break; +} + baloghadamsoftware wrote: > Probably this loop could be written better, without `break`

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-05-06 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. I also tried to compare the exploded graphs, but unfortunately the rewriter Python script crashed on them. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/ https://reviews.llvm.org/D77229 ___

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-05-06 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added a comment. F11870916: correct.txt F11870922: incorrect.txt See the difference between the correct (master branch) and the incorrect (my

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-05-06 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 262430. baloghadamsoftware added a comment. Fixed and error in `call_once.cpp` but stuck with debugging of `objc-radar17039661.m`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/ https://reviews.llvm.org/D77229 Files:

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-05-04 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 261826. baloghadamsoftware added a comment. Only 4 tests failing, but still lot to do. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/ https://reviews.llvm.org/D77229 Files:

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-05-03 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/CallEvent.cpp:614 + SVB.makeLoc(MRMgr.getParamRegion(ICC->getInheritingConstructor(), + Idx, CalleeCtx)); +Bindings.push_back(std::make_pair(ParamLoc,

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-30 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 261218. baloghadamsoftware added a comment. Bug reporter visitors updated, failing tests reduced from 19 to 6. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/ https://reviews.llvm.org/D77229 Files:

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-29 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 260944. baloghadamsoftware added a comment. Now I made some good progress, thank you @NoQ for your suggestions. Not all of them are implemented yet (currently the +-1 with the indices seem to be working, thus I will fix that part later), but now

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-28 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked 5 inline comments as done. baloghadamsoftware added a comment. Very slow progress, but lots of open questions. @NoQ, please try to answer them. Comment at: clang/lib/StaticAnalyzer/Core/CallEvent.cpp:614 +

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-28 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 260659. baloghadamsoftware added a comment. Wrong diff uploaded previously. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/ https://reviews.llvm.org/D77229 Files: clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-28 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 260657. baloghadamsoftware added a comment. Getting the type of parameter regions has no crashes on the test suite. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/ https://reviews.llvm.org/D77229 Files:

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-28 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SymbolManager.cpp:601-603 +if (LCtx->getAnalysis()->isLive(Loc, +

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-28 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#2007125 , @NoQ wrote: > > Yes, indeed very poorly. A C++ operator call is either implemented as > > CXXOperatorCall or CXXMethodCall randomly. In the former case the this > > parameter is explicit at the

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-28 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. Oh, it is not only //Objective-C//. I have been programming in //C// for 25+ years and teaching it for 15+ years, but I never met such syntactical construction: dispatch_sync(queue, ^(void){ Here it is worse than at the //Objective-C// code above,

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-28 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. > Yes, indeed very poorly. A C++ operator call is either implemented as > CXXOperatorCall or CXXMethodCall randomly. In the former case the this > parameter is explicit at the beginning, in the latter case it is implicit. We have methods on `CallEvent` to handle this,

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-28 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#2006106 , @NoQ wrote: > If your change causes a crash, please debug it. That's a completely normal > thing that programmers do every day. Unfortunately, I can't afford to > spoon-feed you the solution

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-28 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#2007038 , @baloghadamsoftware wrote: > As I wrote, I debugged and analyzed it and I am facing a problem for which I > need help. Operator calls are very poorly implemented in the AST. Yes, indeed very

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-28 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#2006106 , @NoQ wrote: > If your change causes a crash, please debug it. That's a completely normal > thing that programmers do every day. Unfortunately, I can't afford to > spoon-feed you the solution

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. If your change causes a crash, please debug it. That's a completely normal thing that programmers do every day. Unfortunately, I can't afford to spoon-feed you the solution step-by-step. Comment at: clang/lib/StaticAnalyzer/Core/SymbolManager.cpp:601-603

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 260387. baloghadamsoftware added a comment. I implemented the basic `isLive()` and `getBinding()` functions which reduced the number of failing tests by `0`. I also implemented dynamic calculation of the type which increased the number of failing

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#2005413 , @baloghadamsoftware wrote: > llvm-project/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:333: > clang::ento::ProgramStateRef >

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#2005419 , @baloghadamsoftware wrote: > Furthermore, there are also problems with `CXXNewExpr`: > > llvm-project/clang/include/clang/AST/ExprCXX.h:2239: clang::Expr* >

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#2005033 , @NoQ wrote: > > How do we calculate the type then? > > Argument expression type + account for value kind (lvalue argument expression > means reference parameter, xvalue argument expression mean

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. And this one: 'Assume' not implemented for this NonLoc UNREACHABLE executed at /home/edmbalo/llvm-project/clang/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp:67! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. Furthermore, there are also problems with `CXXNewExpr`: llvm-project/clang/include/clang/AST/ExprCXX.h:2239: clang::Expr* clang::CXXNewExpr::getPlacementArg(unsigned int): Assertion `(I < getNumPlacementArgs()) && "Index out of range!"' failed. CHANGES

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. In D77229#2005218 , @baloghadamsoftware wrote: > In D77229#2005042 , @NoQ wrote: > > > > no crashes but 130 of 550 analyzer tests failing. > > > > You most likely need to fill in the

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. In D77229#2004964 , @baloghadamsoftware wrote: > This is not the proper way, `MemRegion`s for parameters in inlined functions > should remain `VarRegion`s because parameters **are** variables inside. On > the other hand, from

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#2005042 , @NoQ wrote: > > no crashes but 130 of 550 analyzer tests failing. > > You most likely need to fill in the reachibility and liveness code with the > behavior of the new region. I don't seem to see it

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#2005042 , @NoQ wrote: > > no crashes but 130 of 550 analyzer tests failing. > > You most likely need to fill in the reachibility and liveness code with the > behavior of the new region. I don't seem to see it

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. In D77229#2004964 , @baloghadamsoftware wrote: > Even if I put weeks or months of work into it the code will be worse at the > end because there will be lots of branches upon the nature of the variable > and alternative ways for

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. > How do we calculate the type then? Argument expression type + account for value kind (lvalue argument expression means reference parameter, xvalue argument expression mean rvalue reference parameter). Note that for C-style variadic functions, parameter declarations for

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. > no crashes but 130 of 550 analyzer tests failing. You most likely need to fill in the reachibility and liveness code with the behavior of the new region. I don't seem to see it in your current code but their default behavior is clearly incorrect; instead, they should

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. I spent some time on thinking about this during the weekend. It is no wonder that the tests fail. It seems that many parts of the Analyzer core exploit the fact that the `MemRegion`s of parameters are `VarRegion`s. This is no wonder because all

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-27 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 260265. baloghadamsoftware added a comment. All regions of parameters are `ParamRegions`, type stored explicitly, no crashes but 130 of 550 analyzer tests failing. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-24 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1044 +class ParamWithoutVarRegion : public TypedValueRegion { + friend class MemRegionManager;

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-24 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1044 +class ParamWithoutVarRegion : public TypedValueRegion { + friend class MemRegionManager;

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-23 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:438-442 + Optional getReturnValueUnderConstruction(unsigned BlockCount) const; + + Optional getArgObject(unsigned Index, unsigned BlockCount) const; + + Optional

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-23 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1044 +class ParamWithoutVarRegion : public TypedValueRegion { + friend class MemRegionManager;

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-23 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked 2 inline comments as done. baloghadamsoftware added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:1044 +class ParamWithoutVarRegion : public TypedValueRegion { + friend class MemRegionManager;

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-22 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware marked 7 inline comments as done. baloghadamsoftware added a comment. Thank you for your comments. Of course I plan to upload all these changes in at least three different patches. But first I needed a version that is working. However if I split this up I will have to write

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-22 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 259272. baloghadamsoftware added a comment. First version that seems to be working :-) CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/ https://reviews.llvm.org/D77229 Files:

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-21 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. In D77229#1995079 , @baloghadamsoftware wrote: > My first attempt for a new special kind of region for parameters of functions > without definitions. Currently it causes more failed tests and assertions > than ignoring the problem

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-21 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 259060. baloghadamsoftware added a comment. My first attempt for a new special kind of region for parameters of functions without definitions. Currently it causes more failed tests and assertions than ignoring the problem of different `Decl`s. I

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-20 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 258798. baloghadamsoftware added a comment. I commented out lines which prevent creation of `StackFrameContext` for non-inlined functions. Now everything works regarding the iterator checkers. I also simplified things and created new methods for

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-15 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. In D77229#1983693 , @baloghadamsoftware wrote: > I am trying to understand where I have to implement this but I have some > problems. The first is that when a function is not inlined it does not have a > `StackFrameContext`. What

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-15 Thread Balogh , Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#1980665 , @NoQ wrote: > Aha, ok, sounds like i thought that it's not worth it to inline the > constructor for an argument when the call itself is not inlined, therefore i > didn't model the construction

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-14 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. Aha, ok, sounds like i thought that it's not worth it to inline the constructor for an argument when the call itself is not inlined, therefore i didn't model the construction context for this call. See also D49443#1193290 . Your

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-14 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. OK, I made some experiments. In function `vector_insert_begin()` of test file `iterator-modeling.cpp`, line `960` we pass `i0` to `std::vector::insert()`. This function has no body at all so regardless of inlining of STL functions is enabled, this function

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-09 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 256310. baloghadamsoftware added a comment. OK. I solved almost every problem except that `checkDeadSymbols()` removes the iterator position keyed by the temporary region representing the argument from the map before it is needed. Either I must

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-09 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#1969524 , @NoQ wrote: > In D77229#1969455 , > @baloghadamsoftware wrote: > > > The problem is that the `CFGElement` for function `iterator begin() { > > return

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-08 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added a comment. In D77229#1969524 , @NoQ wrote: > In D77229#1969455 , > @baloghadamsoftware wrote: > > > The problem is that the

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-08 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. In D77229#1969455 , @baloghadamsoftware wrote: > The problem is that the `CFGElement` for function `iterator begin() { return > iterator(_start); }` is just a `CFGStmt` and not `CFGCXXRecordTypedCall`. In which code? It's not

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-08 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. > I am totally lost here. What is wrong? Looks like a bug. Every constructor and every function that returns an object by value should have a construction context. Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:231-235 +if

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-08 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. Another showstopper: the test `container_modeling.cpp` passed with analyzer option `container-inlining=false`. However it faild with `container-inlining=true -DINLINE=1`. The problem is that the `CFGElement` for function `iterator begin() { return

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-08 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:231-235 +if (dyn_cast_or_null(LCtx->getParentMap().getParent(E))) { + MemRegionManager =

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-08 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 255922. baloghadamsoftware added a comment. Next attempt. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/ https://reviews.llvm.org/D77229 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-07 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added a comment. In D77229#1967269 , @NoQ wrote: > In D77229#1966888 , > @baloghadamsoftware wrote: > > > Not so strange, of course, they are

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-07 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. In D77229#1966888 , @baloghadamsoftware wrote: > Not so strange, of course, they are destructed before the `postCall()` as > they should be, but the question still remains: how to keep them alive for > post-checking the call, but

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-07 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#1966885 , @baloghadamsoftware wrote: > OK, I can reach them from the `ConstructionContext` of the arguments. > However, they are temporaries and for some strange reason not alive which > means that

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-07 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#1966711 , @baloghadamsoftware wrote: > Any idea for `LazyCompoundVal` parameters of functions not inlined? OK, I can reach them from the `ConstructionContext` of the arguments. However, they are

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-07 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added a comment. Any idea for `LazyCompoundVal` parameters of functions not inlined? Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:231-235 +if

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-07 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 255641. baloghadamsoftware added a comment. Experimenting... CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/ https://reviews.llvm.org/D77229 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-06 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:127 + const auto *Init = ICC->getCXXCtorInitializer(); + return getObjectUnderConstruction(State, Init, LCtx); +} NoQ wrote: > baloghadamsoftware wrote: > > This

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-06 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:127 + const auto *Init = ICC->getCXXCtorInitializer(); + return getObjectUnderConstruction(State, Init, LCtx); +} baloghadamsoftware wrote: > This does not find

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-06 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. Another problem: parameters can also be `LazyCompoundVal`s, but `CallEvent::getParameterLocation()` does not handle non-inlined calls. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/ https://reviews.llvm.org/D77229

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-06 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. In D77229#1963485 , @NoQ wrote: > Uh-oh, it's annoying indeed that you can't easily obtain the current CFG > element from inside a `CallEvent`. > > Given that every `CallEvent` is in fact associated with a `CFGElement`

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-06 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. Uh-oh, it's annoying indeed that you can't easily obtain the current CFG element from inside a `CallEvent`. Given that every `CallEvent` is in fact associated with a `CFGElement` (but not every `CallEvent` is associated with an `Expr` or have a `Decl`), can we modify the

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-06 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware marked 3 inline comments as done. baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:127 + const auto *Init = ICC->getCXXCtorInitializer(); + return getObjectUnderConstruction(State, Init, LCtx); +

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-06 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 255279. baloghadamsoftware added a comment. More progress... CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77229/new/ https://reviews.llvm.org/D77229 Files: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-03 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. Output of /home/edmbalo/llvm-project/build/bin/clang -cc1 -internal-isystem /mnt/ssd/edmbalo/llvm-project/build/lib/clang/11.0.0/include -nostdsysteminc -analyze -analyzer-constraints=range -setup-static-analyzer -std=c++11

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-03 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware updated this revision to Diff 254765. baloghadamsoftware added a comment. Lots of things seem to work now. However, I have a question: what to do with the return values of non-inlined calls? It may also be a `LazyCompoundVal`, but non-inlined calls do not have

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-03 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware marked an inline comment as done. baloghadamsoftware added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:112 +Optional ExprEngine::retrieveFromConstructionContext( +ProgramStateRef State, const LocationContext *LCtx,

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-03 Thread Endre Fülöp via Phabricator via cfe-commits
gamesh411 added inline comments. Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h:436 + /// context from where the region of its return value can be retrieved. + const ConstructionContext *getConstructionContext(unsigned BlockCount) const; +

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-01 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. The assert points out that the object under construction is already tracked and you're trying to add it twice. You don't want to add it tho, you just want to find the region. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-01 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware created this revision. baloghadamsoftware added a reviewer: NoQ. baloghadamsoftware added a project: clang. Herald added subscribers: ASDenysPetrov, martong, steakhal, Charusso, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, xazax.hun,

[PATCH] D77229: [Analyzer][WIP] Avoid handling of LazyCompundVals in IteratorModeling

2020-04-01 Thread Balogh, Ádám via Phabricator via cfe-commits
baloghadamsoftware added a comment. Testing this patch on `test/Analysis/iterator-modeling.cpp` crashes with the following output: Handling operator++() Return Value: lazyCompoundVal{0x55655390c9d8,i1} Bingo! State->get(Key): Key.getItem().getKind(): 0 clang: