Preprocessor:addCommentHandler() does not take ownership, so we'd end up leaking the TodoCommentHandler.
This patch makes it owned by the Check object.
Differential D5402
[clang-tidy] Don't leak the TodoCommentHandler object hans on Sep 18 2014, 10:56 AM. Authored by
Details Preprocessor:addCommentHandler() does not take ownership, so we'd end up leaking the TodoCommentHandler. This patch makes it owned by the Check object.
Diff Detail Event TimelineComment Actions Yikes, another API with non-obvious ownership semantics. Thanks for catching this. Patch looks good.
|
FWIW I tend to use llvm::make_unique even in init lists like this - it reassures me when I go back to read it that the member is actually a unique_ptr, not a raw pointer I might need to pay attention to.