[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2022-01-13 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. > I took Denys' patch D105340 and created a > prototype on top of that to create the SymbolCast in > SValBuilder::evalCastSubKind(loc::MemRegionVal V, Here is the new (alternative) patch: https://reviews.llvm.org/D117229 Repository:

[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2022-01-12 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Ah, I forgot to mention one last point: 5. Revert D115149 . We should never reach that problematic assertion once we produce the `SymbolCast`s. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2022-01-12 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment. Thanks for the review guys. Artem, I agree, that we should remove `LocAsInteger`. `LocaAsInteger` is a primitive handling of a specific cast operation (when we cast a pointer to an integer). The integration of `LocaAsInteger` into the `SymExpr` hierarchy is

[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2022-01-10 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:420 + auto FromTy = symRHS->getType(); + auto ToTy = RLocAsInt->getType(this->Context); + symRHS = this->getSymbolManager().getCastSymbol(symRHS, FromTy, ToTy);

[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2022-01-10 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:420 + auto FromTy = symRHS->getType(); + auto ToTy = RLocAsInt->getType(this->Context); + symRHS = this->getSymbolManager().getCastSymbol(symRHS, FromTy, ToTy);

[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2022-01-10 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:415-423 + // FIXME This should be done in getAsSymbol. But then getAsSymbol should be + // the member function of SValBuilder (?) + if (symRHS) +if (auto RLocAsInt =

[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2022-01-10 Thread Denys Petrov via Phabricator via cfe-commits
ASDenysPetrov added a comment. Starting producing `SymbolCast` you should be careful. Please pay attention on my revision D105340 before doing this. I don't want you walk through the thing I fought. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2021-12-17 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. Oh nice, it's great to see these things moving. I have a couple observations for your specific approach: (1) Sounds like you're introducing a symbol `(long p)` that represents the exact same value as (and is used interchangeably with) `{$p} (as long)`. Ambiguity is

[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2021-12-17 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. Many thanks for digging into this @martong. I really enjoyed it! I also believe that this is the fix for the underlying issue. I also think the `getAsSymbol()` should be somewhere where we can create new symbols. Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2021-12-17 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments. Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:417 + // the member function of SValBuilder (?) + if (symRHS) +if (auto RLocAsInt = RHS.getAs()) { We should handle LHS as well. Repository: rG LLVM Github

[PATCH] D115932: [Analyzer] Create and handle SymbolCast for pointer to integral conversion

2021-12-17 Thread Gabor Marton via Phabricator via cfe-commits
martong created this revision. martong added reviewers: steakhal, NoQ, ASDenysPetrov. Herald added subscribers: manas, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun. Herald added a reviewer: Szelethus. martong requested