[clang] f887cb1 - [NFC][clang] Fix static analyzer concerns

via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 3 08:37:30 PDT 2023


Author: Podchishchaeva, Mariya
Date: 2023-08-03T08:36:49-07:00
New Revision: f887cb10acc9fb21e389703062398adf1331232f

URL: https://github.com/llvm/llvm-project/commit/f887cb10acc9fb21e389703062398adf1331232f
DIFF: https://github.com/llvm/llvm-project/commit/f887cb10acc9fb21e389703062398adf1331232f.diff

LOG: [NFC][clang] Fix static analyzer concerns

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

Added: 
    

Modified: 
    clang/include/clang/Tooling/Tooling.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Tooling/Tooling.h b/clang/include/clang/Tooling/Tooling.h
index 13c1b51bf85fbb..070706e8fa6d11 100644
--- a/clang/include/clang/Tooling/Tooling.h
+++ b/clang/include/clang/Tooling/Tooling.h
@@ -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) {


        


More information about the cfe-commits mailing list