From 0953a7887dc94fc7554381c511ecabbefece7e0d Mon Sep 17 00:00:00 2001 From: Chris Kitching Date: Sun, 15 Oct 2017 10:29:47 +0100 Subject: [PATCH] Remove unnecessary call to Retain() on a smart pointer The Preprocessor smart pointer is held by the CompilerInstance, and therefore its reference count cannot reach zero until the CompilerInstance itself is destroyed. If the CompilerInstance is destroyed, you have more to worry about than just the preprocessor being deallocated! Newer versions of the LLVM/Clang API migrated to using std::shared_ptr, so there is no `Retain()` function (by that name, anyway). Eliminating this redundant use is a neat and backward-compatible way to become compatible with newer versions of the LLVM/Clang API. --- hipify-clang/src/Cuda2Hip.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/hipify-clang/src/Cuda2Hip.cpp b/hipify-clang/src/Cuda2Hip.cpp index cf11dc9546..fc224adaf0 100644 --- a/hipify-clang/src/Cuda2Hip.cpp +++ b/hipify-clang/src/Cuda2Hip.cpp @@ -3029,7 +3029,6 @@ public: SourceManager &SM = CI.getSourceManager(); setSourceManager(&SM); PP.addPPCallbacks(std::unique_ptr(this)); - PP.Retain(); setPreprocessor(&PP); return true; }