[clang] efb5831 - [Clang] Prevent Copying of LateParsedClass Instances (#109428)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 20 10:08:09 PDT 2024


Author: smanna12
Date: 2024-09-20T12:08:05-05:00
New Revision: efb583178d74b2174e8b9660b67ba7295527b09f

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

LOG: [Clang] Prevent Copying of LateParsedClass Instances (#109428)

Class clang::Parser::LateParsedClass owns resources that are freed in
its destructor but has no user-written assignment operator.
This commit explicitly deletes the copy constructor and copy assignment
operator for the LateParsedClass.

Added: 
    

Modified: 
    clang/include/clang/Parse/Parser.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index 47f72135c97cff..eb8a851da7e04e 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -1355,6 +1355,10 @@ class Parser : public CodeCompletionHandler {
     void ParseLexedAttributes() override;
     void ParseLexedPragmas() override;
 
+    // Delete copy constructor and copy assignment operator.
+    LateParsedClass(const LateParsedClass &) = delete;
+    LateParsedClass &operator=(const LateParsedClass &) = delete;
+
   private:
     Parser *Self;
     ParsingClass *Class;


        


More information about the cfe-commits mailing list