Page MenuHomePhabricator

Replace uses of std::iterator with explicit using
AcceptedPublic

Authored by hamzasood on Sep 14 2019, 9:25 AM.

Details

Summary

This patch removes all uses of std::iterator, which was deprecated in C++17.
While this isn't currently an issue while compiling LLVM, it's useful for those using LLVM as a library.

For some reason there're a few places that were seemingly able to use std functions unqualified, which no longer works after this patch. I've updated those places, but I'm not really sure why it worked in the first place.

Diff Detail

Event Timeline

hamzasood created this revision.Sep 14 2019, 9:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 14 2019, 9:25 AM

I just realised that the unqualified calls worked because a base class of type std::iterator means that functions in namespace std will be found by ADL. So you can ignore the last paragraph in the patch summary.

MaskRay accepted this revision.Tue, Sep 24, 10:56 PM

Looks good!

// P0174
Update from Jacksonville, 2016:

Poll: Deprecate iterator for C++17??

SF	F	N	A	SA
6	10	1	0	0

I just realised that the unqualified calls worked because a base class of type std::iterator means that functions in namespace std will be found by ADL. So you can ignore the last paragraph in the patch summary.

You can edit the summary to mention that due to the loss of ADL you have to prepend std:: in a few places.

Have you done a check-all (llvm,clang,lldb,lld,etc) to ensure nothing else breaks?

This revision is now accepted and ready to land.Tue, Sep 24, 10:56 PM
MaskRay retitled this revision from Replace uses of std::iterator with explicit typedefs to Replace uses of std::iterator with explicit using.Tue, Sep 24, 10:58 PM