This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy][#51939] Exempt placement-new expressions from 'bugprone-throw-keyword-missing'
ClosedPublic

Authored by zero9178 on Dec 11 2021, 3:36 AM.

Details

Summary

The purpose of this checker is to flag a missing throw keyword, and does so by checking for the construction of an exception class that is then unused.
This works great except that placement new expressions are also flagged as those lead to the construction of an object as well, even though they are not temporary (as that is dependent on the storage).
This patch fixes the issue by exempting the match if it is within a placement-new.

Fixes https://github.com/llvm/llvm-project/issues/51939

Diff Detail

Event Timeline

zero9178 created this revision.Dec 11 2021, 3:36 AM
zero9178 requested review of this revision.Dec 11 2021, 3:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 11 2021, 3:36 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaron.ballman accepted this revision.Dec 15 2021, 7:39 AM

LGTM! Can you also add a release note about the fix?

This revision is now accepted and ready to land.Dec 15 2021, 7:39 AM

LGTM! Can you also add a release note about the fix?

Addressed in the final commit