Skip to content

Commit

Permalink
[NFC][clang] Fix static analyzer concerns
Browse files Browse the repository at this point in the history
ToolInvocation frees resources in the destructor but doesn't
have user-written copy c'tor or assignment operator, so copying it using
default ones can cause double free.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D156896
  • Loading branch information
Fznamznon committed Aug 3, 2023
1 parent a8c502a commit f887cb1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/include/clang/Tooling/Tooling.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ class ToolInvocation {

~ToolInvocation();

ToolInvocation(const ToolInvocation &) = delete;
ToolInvocation &operator=(const ToolInvocation &) = delete;

/// Set a \c DiagnosticConsumer to use during driver command-line parsing and
/// the action invocation itself.
void setDiagnosticConsumer(DiagnosticConsumer *DiagConsumer) {
Expand Down

0 comments on commit f887cb1

Please sign in to comment.