[PATCH] D91158: Fix the DeclContextLookupResult::iterator non-copyable.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 10 06:31:05 PST 2020


hokein created this revision.
hokein added a reviewer: sammccall.
Herald added a project: clang.
hokein requested review of this revision.

The value_type is a const pointer, which makes the iteator non-copyable.
Before the patch, the normal usage like below was illegal:

  auto It = lookupresult.begin();
  ...
  It = lookupresult.end(); // the copy is not allowed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91158

Files:
  clang/include/clang/AST/DeclBase.h


Index: clang/include/clang/AST/DeclBase.h
===================================================================
--- clang/include/clang/AST/DeclBase.h
+++ clang/include/clang/AST/DeclBase.h
@@ -1246,8 +1246,7 @@
 
   using IteratorBase =
       llvm::iterator_adaptor_base<iterator, ResultTy::iterator,
-                                  std::random_access_iterator_tag,
-                                  NamedDecl *const>;
+                                  std::random_access_iterator_tag, NamedDecl *>;
 
   class iterator : public IteratorBase {
     value_type SingleElement;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91158.304169.patch
Type: text/x-patch
Size: 580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201110/684c6b53/attachment.bin>


More information about the cfe-commits mailing list