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

Mariya Podchishchaeva via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 20 07:48:58 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.

Preprocessor class can own and free resources in its destructor, but
doesn't have user-written copy constructor or assignment operator, hence
any copy attempt will use compiler-generated copy constructor and may
cause use-after-free problems.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155846

Files:
  clang/include/clang/Lex/Preprocessor.h


Index: clang/include/clang/Lex/Preprocessor.h
===================================================================
--- clang/include/clang/Lex/Preprocessor.h
+++ clang/include/clang/Lex/Preprocessor.h
@@ -1166,6 +1166,9 @@
 
   ~Preprocessor();
 
+  Preprocessor(const Preprocessor &) = delete;
+  Preprocessor &operator=(const Preprocessor &) = delete;
+
   /// Initialize the preprocessor using information about the target.
   ///
   /// \param Target is owned by the caller and must remain valid for the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155846.542522.patch
Type: text/x-patch
Size: 507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230720/f4b358a3/attachment.bin>


More information about the cfe-commits mailing list