[all-commits] [llvm/llvm-project] 75c86c: Support: Make VarStreamArrayIterator iterate over ...

Duncan P. N. Exon Smith via All-commits all-commits at lists.llvm.org
Fri Nov 12 20:38:03 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 75c86c9935925f841c1c4e0396b701210358489a
      https://github.com/llvm/llvm-project/commit/75c86c9935925f841c1c4e0396b701210358489a
  Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
  Date:   2021-11-12 (Fri, 12 Nov 2021)

  Changed paths:
    M llvm/include/llvm/Support/BinaryStreamArray.h
    M llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp

  Log Message:
  -----------
  Support: Make VarStreamArrayIterator iterate over const values

VarStreamArrayIterator returns a reference to a just-computed internal
value. Change it to iterate over `const ValueType` to avoid allowing
clients to mutate the internal state, and to drop the
non-`const`-qualified operator*().

The removed operator*() was from 175d70ee5c2f03f6 to get
iterator_facade_base::operator->() working, and this fixes the root
cause instead: setting `T` to `const ValueType` causes
iterator_facade_base to infer `PointerT` as `const ValueType*`.

Ironically, this is the last blocker for removing the const-incorrect
overload of `iterator_facade_base::operator->()`, whose presence
triggered adding the workaround in the first place :).

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




More information about the All-commits mailing list