This is an archive of the discontinued LLVM Phabricator instance.

New SetOperations and unittesting for all SetOperations
ClosedPublic

Authored by tejohnson on Feb 16 2023, 2:44 PM.

Details

Summary

New set operations split out of D140908 as suggested, and I have added
unit testing for all set operations.

This adds a set_intersection, which returns the intersection instead of
updating the first set like set_intersect (using a different name
analogous to set_difference vs set_subtract).

Also adds a variant of set_subtract that updates two additional set
arguments to note which members of the subtrahend were removed from
the minuend and which were not.

Diff Detail

Event Timeline

tejohnson created this revision.Feb 16 2023, 2:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2023, 2:44 PM
tejohnson requested review of this revision.Feb 16 2023, 2:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2023, 2:44 PM
snehasish accepted this revision.Feb 16 2023, 2:59 PM

lgtm

llvm/include/llvm/ADT/SetOperations.h
91

extra empty comment line?

llvm/unittests/ADT/SetOperationsTest.cpp
88

For cases where the expected result is empty, if you use EXPECT_THAT(Result, IsEmpty()); you will get an appropriate error message on failure, wont have to call clear on ExpectedResult variables and the expectation is easily spelled out for the reader.

This revision is now accepted and ready to land.Feb 16 2023, 2:59 PM
davidxl accepted this revision.Feb 16 2023, 3:05 PM
tejohnson marked 2 inline comments as done.Feb 17 2023, 7:18 AM
tejohnson updated this revision to Diff 498362.Feb 17 2023, 7:18 AM

Address comments

This revision was landed with ongoing or failed builds.Feb 17 2023, 7:18 AM
This revision was automatically updated to reflect the committed changes.