[all-commits] [llvm/llvm-project] efe4a5: [Sema] Clean up ActionResult type a little. NFCI

Sam McCall via All-commits all-commits at lists.llvm.org
Fri Aug 18 04:31:01 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: efe4a54884cb1e5f1d6306f5e831d369c6fd6f54
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2023-08-18 (Fri, 18 Aug 2023)

  Changed paths:
    M clang/include/clang/Sema/Ownership.h

  Log Message:
  [Sema] Clean up ActionResult type a little. NFCI

* 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, in which an experienced clang dev was
confused about the possible states for ExprResult - and I vividly
remember getting very confused about this myself.

Differential Revision: https://reviews.llvm.org/D158093

More information about the All-commits mailing list