[PATCH] D113797: Support: Make VarStreamArrayIterator iterate over const values

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 12 14:34:20 PST 2021


dexonsmith updated this revision to Diff 386955.
dexonsmith edited the summary of this revision.
dexonsmith added a comment.

Just triggering CI after pushing 9a2b54af221717bf71040b530c4ac8043e1db23a <https://reviews.llvm.org/rG9a2b54af221717bf71040b530c4ac8043e1db23a>, which added `const` to some range-based for loops in lld.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113797/new/

https://reviews.llvm.org/D113797

Files:
  llvm/include/llvm/Support/BinaryStreamArray.h
  llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp


Index: llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp
===================================================================
--- llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp
+++ llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp
@@ -373,7 +373,7 @@
     ++Index;
   }
 
-  DbiModuleDescriptor &Descriptor = *Prev;
+  const DbiModuleDescriptor &Descriptor = *Prev;
   P.formatLine("which contains the descriptor for module {0} ({1}).", Index,
                Descriptor.getModuleName());
 }
Index: llvm/include/llvm/Support/BinaryStreamArray.h
===================================================================
--- llvm/include/llvm/Support/BinaryStreamArray.h
+++ llvm/include/llvm/Support/BinaryStreamArray.h
@@ -153,7 +153,7 @@
 template <typename ValueType, typename Extractor>
 class VarStreamArrayIterator
     : public iterator_facade_base<VarStreamArrayIterator<ValueType, Extractor>,
-                                  std::forward_iterator_tag, ValueType> {
+                                  std::forward_iterator_tag, const ValueType> {
   typedef VarStreamArrayIterator<ValueType, Extractor> IterType;
   typedef VarStreamArray<ValueType, Extractor> ArrayType;
 
@@ -197,11 +197,6 @@
     return ThisValue;
   }
 
-  ValueType &operator*() {
-    assert(Array && !HasError);
-    return ThisValue;
-  }
-
   IterType &operator+=(unsigned N) {
     for (unsigned I = 0; I < N; ++I) {
       // We are done with the current record, discard it so that we are


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113797.386955.patch
Type: text/x-patch
Size: 1464 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211112/a5e2c481/attachment.bin>


More information about the llvm-commits mailing list