This is an archive of the discontinued LLVM Phabricator instance.

Fix the DeclContextLookupResult::iterator non-copyable.
ClosedPublic

Authored by hokein on Nov 10 2020, 6:31 AM.

Details

Summary

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.

Diff Detail

Event Timeline

hokein created this revision.Nov 10 2020, 6:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2020, 6:31 AM
hokein requested review of this revision.Nov 10 2020, 6:31 AM
sammccall accepted this revision.Nov 10 2020, 9:17 AM
sammccall added inline comments.
clang/include/clang/AST/DeclBase.h
1249

I wonder if this was meant to be const NamedDecl * - note that begin()/end() are const.

However I'm not sure (clang AST is always funny about const) and that would be a breaking change.

This revision is now accepted and ready to land.Nov 10 2020, 9:17 AM
This revision was landed with ongoing or failed builds.Nov 10 2020, 11:24 AM
This revision was automatically updated to reflect the committed changes.