[clang] 7d85f73 - Fix the DeclContextLookupResult::iterator non-copyable.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 10 11:23:48 PST 2020


Author: Haojian Wu
Date: 2020-11-10T20:22:45+01:00
New Revision: 7d85f732b13a3434bbb6a9054b8ede0e903961da

URL: https://github.com/llvm/llvm-project/commit/7d85f732b13a3434bbb6a9054b8ede0e903961da
DIFF: https://github.com/llvm/llvm-project/commit/7d85f732b13a3434bbb6a9054b8ede0e903961da.diff

LOG: Fix the DeclContextLookupResult::iterator non-copyable.

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.
```

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h
index 4f33ff104ffd..15eb29f72539 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -1246,8 +1246,7 @@ class DeclContextLookupResult {
 
   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;


        


More information about the cfe-commits mailing list