[clang-tidy] Don't leak the TodoCommentHandler object
Preprocessor:addCommentHandler() does not take ownership,
so we'd end up leaking the TodoCommentHandler.
This patch makes it owned by the Check object.
Differential Revision: http://reviews.llvm.org/D5402
llvm-svn: 218068
diff --git a/clang-tools-extra/clang-tidy/google/TodoCommentCheck.h b/clang-tools-extra/clang-tidy/google/TodoCommentCheck.h
index f694709..10e84a7 100644
--- a/clang-tools-extra/clang-tidy/google/TodoCommentCheck.h
+++ b/clang-tools-extra/clang-tidy/google/TodoCommentCheck.h
@@ -21,9 +21,13 @@
/// Corresponding cpplint.py check: readability/todo
class TodoCommentCheck : public ClangTidyCheck {
public:
- TodoCommentCheck(StringRef Name, ClangTidyContext *Context)
- : ClangTidyCheck(Name, Context) {}
+ TodoCommentCheck(StringRef Name, ClangTidyContext *Context);
+ ~TodoCommentCheck();
void registerPPCallbacks(CompilerInstance &Compiler) override;
+
+private:
+ class TodoCommentHandler;
+ std::unique_ptr<TodoCommentHandler> Handler;
};
} // namespace readability