[llvm-dev] IntrusiveRefCntPtr vs std::shared_ptr

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 19 08:13:55 PDT 2016


The easy answer is "it was there before shared_ptr was, and no one's
sufficiently motivated to remove it" - there may be varying levels of
complexity/cost in removing it (it may perform better in some
circumstances), though I'm not sure myself.

On Wed, Oct 19, 2016 at 4:32 AM Ivan Kush via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> why llvm contains IntrusiveRefCntPtr instead of using only
> std::shared_ptr? IntrusiveRefCntPtr widely used in llvm and clang source
> code.
> Due to better performance?
>
>
> for example in main func of clang frontend:
>
> int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void
> *MainAddr) {
>   ensureSufficientStack();
>
>   std::unique_ptr<CompilerInstance> Clang(new CompilerInstance());
>   IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
>
>   IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
> --
> Best wishes,
> Ivan Kush
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161019/33da191c/attachment.html>


More information about the llvm-dev mailing list