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


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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to