[PATCH] D156900: [NFC][clang] Fix static analyzer concerns

Mariya Podchishchaeva via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 2 07:31:10 PDT 2023


Fznamznon created this revision.
Herald added subscribers: manas, ASDenysPetrov, dkrupp, donat.nagy, Szelethus, a.sidorin, baloghadamsoftware.
Herald added a project: All.
Fznamznon requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

InterpState 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156900

Files:
  clang/lib/AST/Interp/InterpState.h


Index: clang/lib/AST/Interp/InterpState.h
===================================================================
--- clang/lib/AST/Interp/InterpState.h
+++ clang/lib/AST/Interp/InterpState.h
@@ -39,6 +39,9 @@
 
   ~InterpState();
 
+  InterpState(const InterpState &) = delete;
+  InterpState &operator=(const InterpState &) = delete;
+
   // Stack frame accessors.
   Frame *getSplitFrame() { return Parent.getCurrentFrame(); }
   Frame *getCurrentFrame() override;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156900.546464.patch
Type: text/x-patch
Size: 464 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230802/3f11bc2d/attachment.bin>


More information about the cfe-commits mailing list