Thu, Oct 29

Who can confirm if this is correct or somewhere it needs fixes? Here is a generated result of evalCast from the origin branch(before the patch):

```void foo(int* x,  // &SymRegion{reg_\$0<int * x>}
int** y, // &SymRegion{reg_\$0<int ** y>}
int***z) // &SymRegion{reg_\$0<int *** z>}
{
(void*)x;    // &SymRegion{reg_\$0<int * x>}
(void*)y;    // &SymRegion{reg_\$0<int ** y>}
(void*)z;    // &SymRegion{reg_\$0<int *** z>}
(void**)x;   // &Element{SymRegion{reg_\$0<int * x>},0 S64b,void *}
(void**)y;   // &SymRegion{reg_\$0<int ** y>}
(void**)z;   // &SymRegion{reg_\$2<int *** z>}
(void***)x;  // &Element{SymRegion{reg_\$0<int * x>},0 S64b,void **}
(void***)y;  // &Element{SymRegion{reg_\$1<int ** y>},0 S64b,void **}
(void***)z;  // &SymRegion{reg_\$2<int *** z>}
(void****)x; // &Element{SymRegion{reg_\$0<int * x>},0 S64b,void ***}
(void****)y; // &Element{SymRegion{reg_\$1<int ** y>},0 S64b,void ***}
(void****)z; // &Element{SymRegion{reg_\$2<int *** z>},0 S64b,void ***}
}```
Thu, Oct 29, 6:12 AM · Restricted Project

Oct 26 2020

Oct 26 2020, 9:53 AM · Restricted Project
[analyzer] [NFC] Simplify SVal::getAsLocSymbol function using existing functions
In D89055#2336709, @NoQ wrote:

Ugh, sorry, no, that's evalCast(). Like evalBinOp() etc. My bad. Can we also use evalCast()?

Oct 26 2020, 7:58 AM · Restricted Project
Oct 26 2020, 7:54 AM · Restricted Project

Oct 23 2020

ASDenysPetrov added a comment to D89987: [analyzer] [NFC] Rename SymbolRef to SymExprRef.

@OikawaKirie

Different from ProgramStateRef which is an alias to IntrusiveRefCntPtr, or StoreRef which is a wrapper object, an alias to a const SymExpr * makes no sense to me.

Yes. I omit this, because in such case we should go further and rename all those which are not real Ref to Ptr or smth that would emphasise that it's just a pointer alias, not a wrapper or another class.
That's why I prefered to change the name a little in favor of complex approach of renaming all the rest.

And this is also where I have been confused for a long while.

So have been I. The patch is called to make it more clear :)

Oct 23 2020, 6:35 AM · Restricted Project

Oct 22 2020

ASDenysPetrov updated the summary of D89987: [analyzer] [NFC] Rename SymbolRef to SymExprRef.
Oct 22 2020, 2:47 PM · Restricted Project
ASDenysPetrov updated the summary of D89987: [analyzer] [NFC] Rename SymbolRef to SymExprRef.
Oct 22 2020, 2:46 PM · Restricted Project
ASDenysPetrov requested review of D89987: [analyzer] [NFC] Rename SymbolRef to SymExprRef.
Oct 22 2020, 2:44 PM · Restricted Project
Oct 22 2020, 1:04 PM · Restricted Project

Oct 19 2020

ASDenysPetrov updated the diff for D77062: [analyzer] [NFC] Simplify CStringChecke::assumeZero function.

Updated. Requalified this patch to non-functional changes.

Oct 19 2020, 5:32 AM · Restricted Project

Oct 17 2020

@NoQ

The new code should obviously be restricted into evalCastFromLoc() because if it's a region it's a Loc.

The first I tryed was evalCastFromLoc(), but it turned out that SVal which binds to a pointer can be NonLoc as well through violation of pointing levels.
Look here:

```void foo(int** p) { // here is a two-level pointer
*(int*)p = 42; // pretend as a one-level pointer, dereference it and assign a number
*p; // dereferencing once gives a `nonloc::ConcreteInt`, though it actually should be a one-level pointer aka Loc.
}```
Oct 17 2020, 4:20 PM · Restricted Project

Oct 15 2020

Actually it wasn't so hard as I thought :)
Would it be better to make this moving in a separate patch as [NFC]?

Oct 15 2020, 8:10 AM · Restricted Project

Oct 13 2020

@NoQ

Can we collapse this function further towards this goal? Say, why not pump every region unconditionally through castRegion()? Does dispatchCast() use castRegion() internally - and if it does, why are there so many branches in this function?

I've made some investigations. castRegion() does not use inside dispatchCast(), it belongs to StoreManager. Moving it to SimpleSValBuilder will be hard at least for now, since it is quite complex, but we can try. What do you think. Should I go further or we can apply this patch as is?

Oct 13 2020, 3:29 PM · Restricted Project

Updated. Removed a new test file, moved the test to an existing file instead.

Oct 13 2020, 5:15 AM · Restricted Project

Oct 12 2020

Updat patch due to suggestions and fixed formating.

Oct 12 2020, 7:17 AM · Restricted Project

It works for me. Well done!

Oct 12 2020, 4:33 AM · Restricted Project

Oct 9 2020

ASDenysPetrov added a comment to D87547: [MinGW][clang-shlib] Build by default on MinGW.

@ASDenysPetrov what CMake options do you use?
I'm unable to reproduce this error with Clang+LLD and GCC+Binutils from MSYS2.

Oct 9 2020, 12:26 PM · Restricted Project

@NoQ
BTW, what do you think we should do with D77062 and D88477 then?

Oct 9 2020, 8:37 AM · Restricted Project

@NoQ

Can we collapse this function further towards this goal? Say, why not pump every region unconditionally through castRegion()? Does dispatchCast() use castRegion() internally - and if it does, why are there so many branches in this function?

Oct 9 2020, 8:21 AM · Restricted Project
ASDenysPetrov requested changes to D87547: [MinGW][clang-shlib] Build by default on MinGW.
Oct 9 2020, 7:01 AM · Restricted Project

Hi, @mati865
Currently I got an error while building with GCC10 on Win10.

```[2325/2656] Linking CXX shared library bin\libclang-cpp.dll
FAILED: bin/libclang-cpp.dll lib/libclang-cpp.dll.a
cmd.exe /C "cd . && D:\WORK\Utilities\MSYS2\mingw64\bin\c++.exe -Wa,-mbig-obj -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -fno-common -Woverloaded-virtual -fno-strict-aliasing  -O2   -shared -o bin\libclang-cpp.dll -Wl,--out-implib,lib\libclang-cpp.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @tools\clang\tools\clang-shlib\CMakeFiles\clang-cpp.rsp  && cd ."
D:/WORK/Utilities/MSYS2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: error: export ordinal too large: 66444
collect2.exe: error: ld returned 1 exit status
[2328/2656] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndex.cpp.obj
ninja: build stopped: subcommand failed.```

I've tryed this on two PCs. Could you, please, revise you solution. I'm not familiar with this part but this affects me (and I think other Win-people).

Oct 9 2020, 7:01 AM · Restricted Project

Oct 8 2020

I've just uploaded a patch for solving this and related D77062. Welcome to review D89055.

Oct 8 2020, 12:03 PM · Restricted Project
Oct 8 2020, 9:48 AM · Restricted Project

Oct 2 2020

@steakhal

Till then, I recommend you to follow my effort at D88477.

Oct 2 2020, 3:35 AM · Restricted Project

Oct 1 2020

@ASDenysPetrov Do you still want to rework the API of the assumeZero?

Oct 1 2020, 5:47 AM · Restricted Project

Sep 28 2020

@steakhal

If we get the value of **b, we get a NonLoc of type unsigned char.
The dump of **b confirms this: reg_\$4<unsigned char Element{SymRegion{reg_\$0<int * a>},0 S64b,unsigned char}>, which is a NonLoc in deed.

Sep 28 2020, 10:39 AM · Restricted Project

Sorry, absolutely no competence.

Sep 28 2020, 8:51 AM · Restricted Project
Sep 28 2020, 8:50 AM · Restricted Project

Sep 25 2020

It would be nice if someone had time to look at this. Thanks.

Sep 25 2020, 1:30 AM · Restricted Project

Sep 24 2020

@NoQ

Sep 24 2020, 6:16 AM · Restricted Project

@steakhal

I would not accept this patch unless this investigation is done. However, I'm not inherently against this change.

Actually I've done the investigation. You can find it here https://reviews.llvm.org/D77062#1977613

Sep 24 2020, 6:09 AM · Restricted Project

Sep 10 2020

Here is my five cents. I haven't done with the review yet. I'm gonna return to it a bit later.

Sep 10 2020, 8:04 AM · Restricted Project

Sep 9 2020

Sep 9 2020, 11:05 PM · Restricted Project

Sep 9 2020, 11:04 PM · Restricted Project

Sep 8 2020

[analyzer] [NFC] Introduce refactoring of PthreadLockChecker
Sep 8 2020, 6:04 AM · Restricted Project

@steakhal

the readability of the reports should be improved.

Absolutely agree. Let's do this in the next patches :)

Sep 8 2020, 5:49 AM · Restricted Project

Sep 6 2020

ASDenysPetrov updated the diff for D85984: [analyzer] Add a new checker alpha.cplusplus.CPlusPlus11Lock.
Sep 6 2020, 4:14 AM · Restricted Project

Test fix.

Sep 6 2020, 3:56 AM · Restricted Project

Minor fixes.

Sep 6 2020, 3:51 AM · Restricted Project

Fixed some missed conditions. Added more tests.

Sep 6 2020, 3:46 AM · Restricted Project

Sep 4 2020

The change LGTM! If it really can speed up performance or improve memory organization, let's load this patch.

Sep 4 2020, 8:39 AM · Restricted Project
Sep 4 2020, 8:25 AM · Restricted Project

This seems to be a total non-functional-change. Please include [NFC] next time with a similar refactoring. Otherwise, Looks good to me, thanks!

Sep 4 2020, 8:14 AM · Restricted Project
ASDenysPetrov retitled D87138: [analyzer][NFC] Introduce refactoring of PthreadLockChecker from [analyzer] Introduce refactoring of PthreadLockChecker to [analyzer][NFC] Introduce refactoring of PthreadLockChecker.
Sep 4 2020, 8:14 AM · Restricted Project
ASDenysPetrov requested review of D87138: [analyzer][NFC] Introduce refactoring of PthreadLockChecker.
Sep 4 2020, 5:33 AM · Restricted Project

Sep 3 2020

Sep 3 2020, 5:29 AM · Restricted Project

Sep 1 2020

ASDenysPetrov updated the diff for D85984: [analyzer] Add a new checker alpha.cplusplus.CPlusPlus11Lock.

Added timed functions support and tests for them.

Sep 1 2020, 9:02 AM · Restricted Project
Sep 1 2020, 7:54 AM · Restricted Project
Sep 1 2020, 7:48 AM · Restricted Project

Aug 31 2020

ASDenysPetrov updated the summary of D85984: [analyzer] Add a new checker alpha.cplusplus.CPlusPlus11Lock.
Aug 31 2020, 6:08 AM · Restricted Project
ASDenysPetrov updated the summary of D85984: [analyzer] Add a new checker alpha.cplusplus.CPlusPlus11Lock.
Aug 31 2020, 6:05 AM · Restricted Project
ASDenysPetrov updated the diff for D85984: [analyzer] Add a new checker alpha.cplusplus.CPlusPlus11Lock.

Added shared semantics checks and correspondent tests.

Aug 31 2020, 6:02 AM · Restricted Project

Aug 26 2020

Guys!
I've moved my work to PthreadLockChecker https://reviews.llvm.org/D85984. You are welcome to look at it.

Aug 26 2020, 9:29 AM · Restricted Project
ASDenysPetrov updated the diff for D85984: [analyzer] Add a new checker alpha.cplusplus.CPlusPlus11Lock.

• std::timed_mutex
• std::recursive_timed_mutex
• std::shared_mutex
• std::shared_timed_mutex
Aug 26 2020, 9:00 AM · Restricted Project

One more ping

Aug 26 2020, 2:57 AM · Restricted Project

LGTM!

Aug 26 2020, 2:34 AM · Restricted Project

@NoQ

That's completely different checker logic.

Aug 26 2020, 12:23 AM · Restricted Project

Aug 25 2020

ASDenysPetrov updated the summary of D85984: [analyzer] Add a new checker alpha.cplusplus.CPlusPlus11Lock.
Aug 25 2020, 10:04 AM · Restricted Project
ASDenysPetrov updated the summary of D85984: [analyzer] Add a new checker alpha.cplusplus.CPlusPlus11Lock.
Aug 25 2020, 10:04 AM · Restricted Project
ASDenysPetrov updated the diff for D85984: [analyzer] Add a new checker alpha.cplusplus.CPlusPlus11Lock.

Aug 25 2020, 8:04 AM · Restricted Project

Aug 14 2020

ASDenysPetrov added a comment to D81254: [analyzer] Produce symbolic values for C-array elements.

Hey, folk, welcome to https://reviews.llvm.org/D85984
I've moved the logic of this checker in PthreadLockChecker

Aug 14 2020, 11:25 AM · Restricted Project
Aug 14 2020, 11:22 AM · Restricted Project
ASDenysPetrov added a comment to D81254: [analyzer] Produce symbolic values for C-array elements.

@steakhal

If index1 and index2 has the same value, we should not be confident that the x == y holds.

Thanks! Now I see. Shame on me =)

Aug 14 2020, 7:42 AM · Restricted Project

Aug 11 2020

@NoQ

You're on the right track but your checker repeats PthreadLockChecker word-by-word. Like, you can find answers to all your questions (eg., "how to use isLiveRegion?") by reading that checker. C++ functions aren't any different from C functions; that's an extremely minor difference that doesn't justify developing a new checker from scratch.

Aug 11 2020, 11:27 AM · Restricted Project

@NoQ

Aug 11 2020, 1:39 AM · Restricted Project

Aug 10 2020

@NoQ just one more ping. You accepted it and then I just revised it again. Could you, please, take a minute and look at it.
I'd close it with a great pleasure. It's been hanging too long.

Aug 10 2020, 8:12 AM · Restricted Project
ASDenysPetrov updated the diff for D85431: [analyzer] Implement a new checker ThreadPrimitivesChecker.

Aug 10 2020, 8:06 AM · Restricted Project
ASDenysPetrov updated the diff for D85431: [analyzer] Implement a new checker ThreadPrimitivesChecker.

Aded enum FuncIdKind to define function Ids.

Aug 10 2020, 7:09 AM · Restricted Project
Aug 10 2020, 1:09 AM · Restricted Project

Aug 7 2020

ASDenysPetrov updated the diff for D85431: [analyzer] Implement a new checker ThreadPrimitivesChecker.

@vsavchenko

Aug 7 2020, 8:50 AM · Restricted Project

Aug 6 2020

ASDenysPetrov requested review of D85431: [analyzer] Implement a new checker ThreadPrimitivesChecker.
Aug 6 2020, 6:28 AM · Restricted Project

Aug 4 2020

Ping!

Aug 4 2020, 6:12 AM · Restricted Project

Aug 3 2020

[analyzer] Introduce minor refactoring of SVal::getSubKind function
Aug 3 2020, 5:05 AM · Restricted Project
[analyzer] Simplify function SVal::getAsSymbolicExpression and similar ones
Aug 3 2020, 5:03 AM · Restricted Project

Aug 2 2020

However, I'm going to complain about commit messages again 😅 I would prefer having imperative mood in the message, something like "Refactor ..." or "Introduce minor refactoring..."

Changed title.

Aug 2 2020, 4:23 PM · Restricted Project
ASDenysPetrov retitled D85026: [analyzer] Introduce minor refactoring of SVal::getSubKind function from [analyzer] Minor refactoring of SVal::getSubKind function to [analyzer] Introduce minor refactoring of SVal::getSubKind function.
Aug 2 2020, 4:22 PM · Restricted Project
Aug 2 2020, 4:13 PM · Restricted Project

@vsavchenko

I again have to nitpick about the commit message, can you please change it to "Simplify ..."?

Aug 2 2020, 4:13 PM · Restricted Project
ASDenysPetrov retitled D85034: [analyzer] Simplify functions SVal::getAsSymbolicExpression and similar ones from [analyzer] Simplified functions SVal::getAsSymbolicExpression and similar ones to [analyzer] Simplify functions SVal::getAsSymbolicExpression and similar ones.
Aug 2 2020, 4:10 PM · Restricted Project

Jul 31 2020

Jul 31 2020, 9:39 AM · Restricted Project
Jul 31 2020, 9:39 AM · Restricted Project
Jul 31 2020, 9:10 AM · Restricted Project
Jul 31 2020, 9:10 AM · Restricted Project
Jul 31 2020, 6:02 AM · Restricted Project

Jul 16 2020

ASDenysPetrov updated the summary of D77062: [analyzer] [NFC] Simplify CStringChecke::assumeZero function.
Jul 16 2020, 5:44 AM · Restricted Project
ASDenysPetrov updated the diff for D77062: [analyzer] [NFC] Simplify CStringChecke::assumeZero function.

Changed naming due to LLVM rules.
I decided not to change names everywhere to leave the patch more readable.

Jul 16 2020, 5:44 AM · Restricted Project

Jul 15 2020

Jul 15 2020, 3:12 AM · Restricted Project

One more :-)

Jul 15 2020, 3:10 AM · Restricted Project
ASDenysPetrov added inline comments to D82381: [analyzer] Introduce small improvements to the solver infra.
Jul 15 2020, 3:10 AM · Restricted Project

Jul 8 2020

Jul 8 2020, 9:19 AM · Restricted Project

@vsavchenko
OK, let it be. )

Jul 8 2020, 9:14 AM · Restricted Project

@vsavchenko
Thank you.
Despite of all of my nits, LGTM!

Jul 8 2020, 8:32 AM · Restricted Project
ASDenysPetrov added a comment to D83286: [analyzer][solver] Track symbol disequalities.

@vsavchenko

if a != b and b == C where C is a constant, a != C

Did you take into account that e.g. a > b also is a disequality.

Jul 8 2020, 5:14 AM · Restricted Project

Hi @vsavchenko , sorry for the late review.

Jul 8 2020, 4:30 AM · Restricted Project

Jul 2 2020

@NoQ , just one another ping, since it is near to be closed.

Jul 2 2020, 4:15 AM · Restricted Project