[PATCH] D158093: [Sema] Clean up ActionResult type a little. NFCI

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 16 08:18:32 PDT 2023


sammccall created this revision.
sammccall added reviewers: kadircet, aaron.ballman.
Herald added a project: All.
sammccall requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

- Document the valid states: invalid/unset/pointer (Currently both documentation and implementation strongly suggest that pointer+invalid is poissible, when it's not)
- Remove unused set() functions, which had different semantics between the compressed/uncompressed specialization! (The former allowing escaping the tristate into pointer+invalid)
- Make the compressed specialization's internals directly model the tristate, rather than pretending pointer + invalid were independent.
- Make members of each version identical where possible, remove repetition
- fix operator= accidentally returning a const reference
- Fix indentation :-)

This was motivated by D157868 <https://reviews.llvm.org/D157868>, in which an experienced clang dev was
confused about the possible states for ExprResult - and I vividly
remember getting very confused about this myself.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158093

Files:
  clang/include/clang/Sema/Ownership.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158093.550767.patch
Type: text/x-patch
Size: 11296 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230816/d7dca72f/attachment-0001.bin>


More information about the cfe-commits mailing list