Page MenuHomePhabricator
Feed Advanced Search

Today

RedDocMD updated the diff for D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.

Put in a TODO

Thu, Jul 29, 5:56 AM · Restricted Project
RedDocMD added inline comments to D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.
Thu, Jul 29, 5:55 AM · Restricted Project
RedDocMD updated the diff for D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.

Bug fixes, some cleanup

Thu, Jul 29, 5:50 AM · Restricted Project
RedDocMD added inline comments to D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.
Thu, Jul 29, 5:49 AM · Restricted Project
RedDocMD added inline comments to D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.
Thu, Jul 29, 5:45 AM · Restricted Project

Yesterday

RedDocMD added a comment to D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.

Ah I see.
As a side note, without the "redundant" invalidation that is being done, the analyzer crashes on shared_ptr. (Because the State essentially remains the same and that's what causes the crash).

Wed, Jul 28, 9:39 AM · Restricted Project
RedDocMD updated the diff for D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.

Invalidating via the CallEvent

Wed, Jul 28, 2:37 AM · Restricted Project

Sun, Jul 25

RedDocMD updated the diff for D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.

Removed a fatal bug

Sun, Jul 25, 10:09 PM · Restricted Project
RedDocMD added a comment to D106739: [analyzer] Add option to SATest.py for extra checkers.

@vsavchenko is this okay?

Sun, Jul 25, 10:03 PM · Restricted Project
RedDocMD added a comment to D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.

the following code doesn't emit any warnings

This code doesn't seem to have any unique_ptrs in it? It's not like you're modeling this custom class as well? Can you try the same with the actual unique_ptr?

Sun, Jul 25, 10:00 PM · Restricted Project

Fri, Jul 23

RedDocMD added a comment to D106739: [analyzer] Add option to SATest.py for extra checkers.

It turns out that there is already an option called extra-analyzer-config to pass analyzer configs, like setting ModelSmartPtrDereference to true

Fri, Jul 23, 10:44 PM · Restricted Project
RedDocMD requested review of D106739: [analyzer] Add option to SATest.py for extra checkers.
Fri, Jul 23, 10:41 PM · Restricted Project

Thu, Jul 22

RedDocMD added a comment to D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.

But before we go there we should decide whether we want to actually go for inlining (or otherwise default-evaluating) these destructors. If we do, we should probably not spend too much time on improving invalidation in the checker, because default evaluation would do that properly for us anyway (well, it doesn't really dodge any problems such as the absence of the necessary AST so we'll probably have to solve all these problems anyway, just in a different setting). So it's great that we've fixed evalCall for destructors, this could definitely land as a separate patch (tested via debug.AnalysisOrder), but we really need to think what to do next here. So I recommend gathering some data to see if proper destructor evaluation is actually a real problem.

Thu, Jul 22, 6:38 AM · Restricted Project

Wed, Jul 21

RedDocMD added inline comments to D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling.
Wed, Jul 21, 5:57 AM · Restricted Project
RedDocMD committed rG80068ca6232b: [analyzer] Fix for faulty namespace test in SmartPtrModelling (authored by RedDocMD).
[analyzer] Fix for faulty namespace test in SmartPtrModelling
Wed, Jul 21, 5:54 AM
RedDocMD closed D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling.
Wed, Jul 21, 5:54 AM · Restricted Project

Tue, Jul 20

RedDocMD added a comment to D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.

This is a minimal model of destructors in smart-ptr.
Other than the need to probably model the destructor of the pointee, is there anything else to do?

Tue, Jul 20, 11:22 AM · Restricted Project
RedDocMD updated the diff for D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.

Minimal modelling of destructor

Tue, Jul 20, 11:21 AM · Restricted Project
RedDocMD updated the diff for D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.

Reformat

Tue, Jul 20, 10:37 AM · Restricted Project
RedDocMD updated the diff for D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.

Retrieving patch

Tue, Jul 20, 10:33 AM · Restricted Project
RedDocMD updated the diff for D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling.

Removed unnecessary white space

Tue, Jul 20, 2:56 AM · Restricted Project
RedDocMD added inline comments to D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling.
Tue, Jul 20, 2:54 AM · Restricted Project
RedDocMD added inline comments to D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling.
Tue, Jul 20, 2:48 AM · Restricted Project
RedDocMD updated the diff for D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling.

More refactor

Tue, Jul 20, 2:48 AM · Restricted Project
RedDocMD updated the diff for D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling.

Refactored out check

Tue, Jul 20, 1:42 AM · Restricted Project

Mon, Jul 19

RedDocMD added a comment to D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling.

Would this test do?

Mon, Jul 19, 11:36 PM · Restricted Project
RedDocMD updated the diff for D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling.

Added a simple test

Mon, Jul 19, 11:35 PM · Restricted Project
RedDocMD added inline comments to D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling.
Mon, Jul 19, 11:21 PM · Restricted Project
RedDocMD retitled D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling from [analyer] Fix for faulty namespace test in SmartPtrModelling to [analyzer] Fix for faulty namespace test in SmartPtrModelling.
Mon, Jul 19, 11:54 AM · Restricted Project
RedDocMD updated the diff for D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling.

Reformatted patch

Mon, Jul 19, 11:51 AM · Restricted Project
RedDocMD requested review of D106296: [analyzer] Fix for faulty namespace test in SmartPtrModelling.
Mon, Jul 19, 11:49 AM · Restricted Project

Sun, Jul 18

RedDocMD closed D105421: [analyzer] Handle << operator for std::unique_ptr.

For some reason this revision did not get automatically closed after commit, manually merging it.

Sun, Jul 18, 7:28 AM · Restricted Project
RedDocMD committed rGd825309352b4: [analyzer] Handle std::make_unique (authored by RedDocMD).
[analyzer] Handle std::make_unique
Sun, Jul 18, 7:25 AM
RedDocMD closed D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.
Sun, Jul 18, 7:25 AM · Restricted Project
RedDocMD updated the diff for D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.

Marked test with FIXME notes

Sun, Jul 18, 7:21 AM · Restricted Project
RedDocMD updated the diff for D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.

Fixed up tests

Sun, Jul 18, 7:16 AM · Restricted Project
RedDocMD updated the diff for D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.

Post-rebase cleanup

Sun, Jul 18, 2:23 AM · Restricted Project
RedDocMD committed rG0cd98bef1b6f: [analyzer] Handle std::swap for std::unique_ptr (authored by RedDocMD).
[analyzer] Handle std::swap for std::unique_ptr
Sun, Jul 18, 2:10 AM
RedDocMD closed D104300: [analyzer] Handle std::swap for std::unique_ptr.
Sun, Jul 18, 2:10 AM · Restricted Project
RedDocMD updated the diff for D104300: [analyzer] Handle std::swap for std::unique_ptr.

Post rebase cleanup

Sun, Jul 18, 1:11 AM · Restricted Project

Fri, Jul 16

RedDocMD committed rG13fe78212fe7: [analyzer] Handle << operator for std::unique_ptr (authored by RedDocMD).
[analyzer] Handle << operator for std::unique_ptr
Fri, Jul 16, 12:05 AM

Thu, Jul 15

RedDocMD updated the diff for D105421: [analyzer] Handle << operator for std::unique_ptr.

Post rebase cleanup

Thu, Jul 15, 9:43 PM · Restricted Project
RedDocMD committed rG48688257c52d: [analyzer] Model comparision methods of std::unique_ptr (authored by RedDocMD).
[analyzer] Model comparision methods of std::unique_ptr
Thu, Jul 15, 9:25 PM
RedDocMD closed D104616: [analyzer] Model comparision methods of std::unique_ptr.
Thu, Jul 15, 9:25 PM · Restricted Project
RedDocMD updated the diff for D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.

Removed one bug, many more to go

Thu, Jul 15, 8:54 AM · Restricted Project

Wed, Jul 14

RedDocMD updated the diff for D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.

Cleanup, still doesn't work

Wed, Jul 14, 9:23 PM · Restricted Project

Tue, Jul 13

RedDocMD added a comment to D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.

Is the syntax of specifying expected notes and warnings documented somewhere? I could not find the note-specific syntax.

Tue, Jul 13, 8:01 AM · Restricted Project
RedDocMD updated the diff for D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.

Fixing up tests

Tue, Jul 13, 7:58 AM · Restricted Project
RedDocMD updated the diff for D105421: [analyzer] Handle << operator for std::unique_ptr.

Removed stupid mistakes

Tue, Jul 13, 2:31 AM · Restricted Project

Mon, Jul 12

RedDocMD requested review of D105821: [analyzer] [WIP] Model destructor for std::unique_ptr.
Mon, Jul 12, 8:37 AM · Restricted Project

Sat, Jul 10

RedDocMD updated the diff for D105421: [analyzer] Handle << operator for std::unique_ptr.

Little refactors, one more test

Sat, Jul 10, 8:08 AM · Restricted Project
RedDocMD added inline comments to D105421: [analyzer] Handle << operator for std::unique_ptr.
Sat, Jul 10, 7:50 AM · Restricted Project

Fri, Jul 9

RedDocMD updated the diff for D105421: [analyzer] Handle << operator for std::unique_ptr.

Tests implemented

Fri, Jul 9, 12:11 AM · Restricted Project

Thu, Jul 8

RedDocMD added a comment to D105421: [analyzer] Handle << operator for std::unique_ptr.

I will be figuring out some tests tomorrow morning.

Thu, Jul 8, 11:48 AM · Restricted Project
RedDocMD updated the diff for D105421: [analyzer] Handle << operator for std::unique_ptr.

Little refactors

Thu, Jul 8, 11:43 AM · Restricted Project

Wed, Jul 7

RedDocMD added inline comments to D105421: [analyzer] Handle << operator for std::unique_ptr.
Wed, Jul 7, 11:50 AM · Restricted Project
RedDocMD updated the diff for D105421: [analyzer] Handle << operator for std::unique_ptr.

Invalidating regions

Wed, Jul 7, 11:49 AM · Restricted Project

Mon, Jul 5

RedDocMD updated the diff for D104616: [analyzer] Model comparision methods of std::unique_ptr.

Major bug fix

Mon, Jul 5, 10:24 AM · Restricted Project
RedDocMD requested review of D105421: [analyzer] Handle << operator for std::unique_ptr.
Mon, Jul 5, 1:50 AM · Restricted Project

Sun, Jul 4

RedDocMD updated the diff for D104616: [analyzer] Model comparision methods of std::unique_ptr.

Little refactors

Sun, Jul 4, 1:35 AM · Restricted Project
RedDocMD added inline comments to D104616: [analyzer] Model comparision methods of std::unique_ptr.
Sun, Jul 4, 1:32 AM · Restricted Project

Fri, Jul 2

RedDocMD updated the diff for D104616: [analyzer] Model comparision methods of std::unique_ptr.

Simplify SVal on state split, other refactors

Fri, Jul 2, 11:12 AM · Restricted Project
RedDocMD added inline comments to D104616: [analyzer] Model comparision methods of std::unique_ptr.
Fri, Jul 2, 11:08 AM · Restricted Project
RedDocMD updated the diff for D104616: [analyzer] Model comparision methods of std::unique_ptr.

Performing state split on normal comparision ops

Fri, Jul 2, 1:29 AM · Restricted Project

Wed, Jun 30

RedDocMD added inline comments to D104616: [analyzer] Model comparision methods of std::unique_ptr.
Wed, Jun 30, 12:32 AM · Restricted Project
RedDocMD updated the diff for D104616: [analyzer] Model comparision methods of std::unique_ptr.

Refactored out common block

Wed, Jun 30, 12:24 AM · Restricted Project

Tue, Jun 29

RedDocMD updated the diff for D104616: [analyzer] Model comparision methods of std::unique_ptr.

Fixed bug in enum conversion

Tue, Jun 29, 10:16 PM · Restricted Project
RedDocMD added a comment to D104616: [analyzer] Model comparision methods of std::unique_ptr.

Sorry for not updating. Was down with fever.
This patch does *not* work now. operationKindFromOverloadedOperator is broken because the maps don't get populated. I am not entirely sure why this is happening.
Will try to fix tomorrow. @NoQ, @vsavchenko, @xazax.hun, @teemperor do you have a hunch as to why this may be happening?

Tue, Jun 29, 10:35 AM · Restricted Project
RedDocMD retitled D104616: [analyzer] Model comparision methods of std::unique_ptr from [analyzer][WIP] Model comparision methods of std::unique_ptr to [analyzer] Model comparision methods of std::unique_ptr.
Tue, Jun 29, 10:28 AM · Restricted Project

Jun 26 2021

RedDocMD updated the diff for D104616: [analyzer] Model comparision methods of std::unique_ptr.

First try at implementing conversion function from OverloadedOperatorKind to BinaryOperatorKind

Jun 26 2021, 10:49 AM · Restricted Project
RedDocMD added inline comments to D104616: [analyzer] Model comparision methods of std::unique_ptr.
Jun 26 2021, 2:27 AM · Restricted Project

Jun 25 2021

RedDocMD updated the diff for D104616: [analyzer] Model comparision methods of std::unique_ptr.

Removed dump statement

Jun 25 2021, 3:19 AM · Restricted Project
RedDocMD added inline comments to D104616: [analyzer] Model comparision methods of std::unique_ptr.
Jun 25 2021, 3:19 AM · Restricted Project
RedDocMD updated the diff for D104616: [analyzer] Model comparision methods of std::unique_ptr.

Refactored code, removed duplications, fixed tests, added some more

Jun 25 2021, 3:16 AM · Restricted Project
RedDocMD added inline comments to D104616: [analyzer] Model comparision methods of std::unique_ptr.
Jun 25 2021, 2:42 AM · Restricted Project

Jun 24 2021

RedDocMD added a comment to D104616: [analyzer] Model comparision methods of std::unique_ptr.

We have a failing test here (test at line 473).
Which makes me wonder if the handleComparision function is at all called. This is something I need to check.

Jun 24 2021, 11:45 AM · Restricted Project
RedDocMD updated the diff for D104616: [analyzer] Model comparision methods of std::unique_ptr.

Removed re-invention, added tests

Jun 24 2021, 11:43 AM · Restricted Project
RedDocMD added a comment to D104616: [analyzer] Model comparision methods of std::unique_ptr.

Looks like I have wasted a good deal of effort. :(

Sorry about that! :( If we learned anything new in the process it was not wasted effort though.

Jun 24 2021, 6:42 AM · Restricted Project

Jun 22 2021

RedDocMD added a comment to D104616: [analyzer] Model comparision methods of std::unique_ptr.

Why not simply delegate this job to assume(evalBinOp(...)) over raw pointer values, which already has all this logic written down nicely?

This is what I had in mind, I just did not want to spoil it :)

Jun 22 2021, 8:08 PM · Restricted Project
RedDocMD updated the diff for D104616: [analyzer] Model comparision methods of std::unique_ptr.

Logic for handling special cases, when both are unique_ptr

Jun 22 2021, 10:50 AM · Restricted Project

Jun 20 2021

RedDocMD added a comment to D104616: [analyzer] Model comparision methods of std::unique_ptr.

The only method that I think can be realistically modelled is == (and thus !=). If both the operands refer to the same unique_ptr, we know == returns true. If they are not the same, the only way == can return true if the two smart pointers were initialized from the same raw pointer. This is of course a fatal bug in itself. So perhaps we can ignore this case and only consider the first case.
The ordering operators I guess can't be handled because there is no way to statically tell in general the address of some value. We have the following deductions, nevertheless, mathematically:
Let ptr1 and ptr2 be two std::unique_ptr objects.
If (ptr1 == ptr2) is true:

  • ptr1 < ptr2 is false
  • ptr1 > ptr2 is false
  • ptr1 <= ptr2 is true
  • ptr1 >= ptr2 is true

If (ptr1 == ptr2) is false, we can't say anything really.

Jun 20 2021, 11:24 PM · Restricted Project
RedDocMD requested review of D104616: [analyzer] Model comparision methods of std::unique_ptr.
Jun 20 2021, 11:10 PM · Restricted Project

Jun 19 2021

RedDocMD added a comment to D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.

Do the above tests pass when your new evalCall modeling is enabled?

The analyzer doesn't seem to be able to make up its mind.

member-constructor.cpp:15:5: warning: FALSE [debug.ExprInspection]
    clang_analyzer_eval(*P->p == 0);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
member-constructor.cpp:15:25: note: Assuming the condition is false
    clang_analyzer_eval(*P->p == 0);
                        ^~~~~~~~~~
member-constructor.cpp:15:5: note: FALSE
    clang_analyzer_eval(*P->p == 0);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
member-constructor.cpp:15:5: warning: TRUE [debug.ExprInspection]
    clang_analyzer_eval(*P->p == 0);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
member-constructor.cpp:15:25: note: Assuming the condition is true
    clang_analyzer_eval(*P->p == 0);
                        ^~~~~~~~~~
member-constructor.cpp:15:5: note: TRUE
    clang_analyzer_eval(*P->p == 0);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
Jun 19 2021, 11:11 AM · Restricted Project

Jun 18 2021

RedDocMD abandoned D103434: [analyzer] Allow visitors to run callbacks on completion.

I am closing this since it has been addressed much better by the patches from @vsavchenko.

Jun 18 2021, 11:51 AM · Restricted Project
RedDocMD updated the diff for D104300: [analyzer] Handle std::swap for std::unique_ptr.

Some more refactoring

Jun 18 2021, 11:49 AM · Restricted Project
RedDocMD added inline comments to D104300: [analyzer] Handle std::swap for std::unique_ptr.
Jun 18 2021, 11:47 AM · Restricted Project
RedDocMD added a comment to D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.

I believe there are a couple of comments that are done but not marked accordingly.
I agree with Artem, if we could craft code that fails due to not calling ctors, we should probably include them in the tests, even if they don't reflect the desired behavior they are a great source of documentation what is missing.

Jun 18 2021, 10:52 AM · Restricted Project
RedDocMD updated the diff for D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.

Little changes, a failing test

Jun 18 2021, 10:51 AM · Restricted Project
RedDocMD added a comment to D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.

I would suppose that constructor calls are properly handled. (ie, member constructors are called properly).

Do the above tests pass when your new evalCall modeling is enabled?

Jun 18 2021, 10:45 AM · Restricted Project
RedDocMD added inline comments to D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.
Jun 18 2021, 10:34 AM · Restricted Project

Jun 17 2021

RedDocMD updated the diff for D104300: [analyzer] Handle std::swap for std::unique_ptr.

Marking and un-marking interestingness

Jun 17 2021, 12:14 AM · Restricted Project

Jun 16 2021

RedDocMD added a comment to D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.

I would suppose that constructor calls are properly handled. (ie, member constructors are called properly).
As for modelling destructors, there is a separate problem - since we don't have a Stmt, the postCall handler keeps on crashing.

Jun 16 2021, 10:04 PM · Restricted Project
RedDocMD added inline comments to D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.
Jun 16 2021, 9:57 PM · Restricted Project
RedDocMD updated the diff for D103750: [analyzer] Handle std::make_unique for SmartPtrModeling.

Added more info to the TODO

Jun 16 2021, 8:57 PM · Restricted Project

Jun 15 2021

RedDocMD added a comment to D104300: [analyzer] Handle std::swap for std::unique_ptr.

I have gotten rid of notes for the time being.
The trouble is that, we were not figuring out whether the null-pointer de-reference was occurring due to the null value being swapped with the current pointer.
We just assumed that. So I am guessing we would need a visitor to figure that out? (Hooray for Valeriy!)
Or is there a simpler solution?

Jun 15 2021, 11:38 AM · Restricted Project
RedDocMD updated the diff for D104300: [analyzer] Handle std::swap for std::unique_ptr.

Refactored common code, removed note emission

Jun 15 2021, 11:34 AM · Restricted Project
RedDocMD added a comment to D104300: [analyzer] Handle std::swap for std::unique_ptr.

The current implementation of how notes are emitted in handleSwap is broken. Consider the following code:

#include <memory>
Jun 15 2021, 11:23 AM · Restricted Project
RedDocMD added inline comments to D104300: [analyzer] Handle std::swap for std::unique_ptr.
Jun 15 2021, 11:21 AM · Restricted Project
RedDocMD retitled D104300: [analyzer] Handle std::swap for std::unique_ptr from [analyzer] Handle `std::swap` for std::unique_ptr to [analyzer] Handle std::swap for std::unique_ptr.
Jun 15 2021, 10:49 AM · Restricted Project
RedDocMD retitled D104300: [analyzer] Handle std::swap for std::unique_ptr from [analyzer] Handle `std::swap` to [analyzer] Handle `std::swap` for std::unique_ptr.
Jun 15 2021, 10:48 AM · Restricted Project