diff options
author | Shilei Tian <tianshilei1992@gmail.com> | 2021-07-15 23:51:38 -0400 |
---|---|---|
committer | Shilei Tian <tianshilei1992@gmail.com> | 2021-07-15 23:51:46 -0400 |
commit | c23da666b5be4da631c2ff8db4d129a90f319777 (patch) | |
tree | 84806c982c211b6756922966ac773c89fa9571dd /llvm/unittests/Support/CommandLineTest.cpp | |
parent | 16b5e9d6a269913e8da0fa037e8af32eaf304c8f (diff) | |
download | llvm-c23da666b5be4da631c2ff8db4d129a90f319777.zip llvm-c23da666b5be4da631c2ff8db4d129a90f319777.tar.gz llvm-c23da666b5be4da631c2ff8db4d129a90f319777.tar.bz2 |
[Attributor] Add support for compound assignment for ChangeStatus
A common use of `ChangeStatus` is as follows:
```
ChangeStatus Changed = ChangeStatus::UNCHANGED;
Changed |= foo();
```
where `foo` returns `ChangeStatus` as well. Currently `ChangeStatus` doesn't
support compound assignment, we have to write as
```
Changed = Changed | foo();
```
which is not that convenient.
This patch add the support for compound assignment for `ChangeStatus`. Compound
assignment is usually implemented as a member function, and binary arithmetic
operator is therefore implemented using compound assignment. However, unlike
regular C++ class, enum class doesn't support member functions. As a result, they
can only be implemented in the way shown in the patch.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D106109
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
0 files changed, 0 insertions, 0 deletions