This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Don't leak the TodoCommentHandler object
ClosedPublic

Authored by hans on Sep 18 2014, 10:56 AM.

Details

Summary

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

Repository
rL LLVM

Event Timeline

hans updated this revision to Diff 13839.Sep 18 2014, 10:56 AM
hans retitled this revision from to [clang-tidy] Don't leak the TodoCommentHandler object.
hans updated this object.
hans edited the test plan for this revision. (Show Details)
hans added a reviewer: bkramer.
hans added subscribers: Unknown Object (MLST), alexfh, hansw.
bkramer accepted this revision.Sep 18 2014, 11:46 AM
bkramer edited edge metadata.

Yikes, another API with non-obvious ownership semantics. Thanks for catching this.

Patch looks good.

This revision is now accepted and ready to land.Sep 18 2014, 11:46 AM
dblaikie added inline comments.
clang-tidy/google/TodoCommentCheck.cpp
58 ↗(On Diff #13839)

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.

60 ↗(On Diff #13839)

might be nice to have addCommentHandler take by reference... maybe, one day, etc.

hans closed this revision.Sep 18 2014, 12:09 PM
hans updated this revision to Diff 13842.

Closed by commit rL218068 (authored by @hans).