[llvm-dev] IntrusiveRefCntPtr vs std::shared_ptr

Ivan Kush via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 19 02:43:50 PDT 2016


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


More information about the llvm-dev mailing list