r215856 - Update for llvm api changes.

Sean Silva chisophugis at gmail.com
Tue Aug 19 10:50:48 PDT 2014


On Sun, Aug 17, 2014 at 4:25 PM, David Blaikie <dblaikie at gmail.com> wrote:

> On Sun, Aug 17, 2014 at 3:20 PM, Rafael Espindola
> <rafael.espindola at gmail.com> wrote:
> > Author: rafael
> > Date: Sun Aug 17 17:20:41 2014
> > New Revision: 215856
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=215856&view=rev
> > Log:
> > Update for llvm api changes.
> >
> > Modified:
> >     cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
> >     cfe/trunk/lib/Basic/VirtualFileSystem.cpp
> >
> > Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=215856&r1=215855&r2=215856&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
> > +++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Sun Aug 17 17:20:41 2014
> > @@ -1939,7 +1939,7 @@ public:
> >        return true;
> >
> >      llvm::SourceMgr SM;
> > -    Stream YAMLStream(FileBufOrErr.get().release(), SM);
> > +    Stream YAMLStream(std::move(FileBufOrErr.get()), SM);
>
> Thought: this is actually one place where I more strongly prefer using
> the pointer-like API of ErrorOr. Seeing "move(x.get())" makes me
> twitch and think "is that moving a raw pointer? some mistake where the
> user was trying to indicate transfer of ownership from a unique_ptr
> and clearly failing". Whereas move(*x) seems clear/sort of better.
>
> Not an ironclad argument - but just a thought I've been pondering.
>

I agree. Generally I imagine this would apply for anything (that is not
smart pointer-like) with a .get().

As a side note, given this .get() potential for confusion, is there a
reason ErrorOr has both .get() and operator*?

-- Sean Silva


>
> >      document_iterator I = YAMLStream.begin();
> >      if (I == YAMLStream.end())
> >        return true;
> >
> > Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=215856&r1=215855&r2=215856&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)
> > +++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Sun Aug 17 17:20:41 2014
> > @@ -869,7 +869,7 @@ VFSFromYAML *VFSFromYAML::create(std::un
> >                                   IntrusiveRefCntPtr<FileSystem>
> ExternalFS) {
> >
> >    SourceMgr SM;
> > -  yaml::Stream Stream(Buffer.release(), SM);
> > +  yaml::Stream Stream(std::move(Buffer), SM);
> >
> >    SM.setDiagHandler(DiagHandler, DiagContext);
> >    yaml::document_iterator DI = Stream.begin();
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140819/e00349fe/attachment.html>


More information about the cfe-commits mailing list