[clang] [NFC][Clang][Sema] Apply rule of three to Sema helper classes (PR #193835)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 23 13:52:00 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Shafik Yaghmour (shafik)

<details>
<summary>Changes</summary>

Static analysis flagged these classes. They declared a destructor but not copy constructor or copy assignment. Since these classes don't need them, this change declares them deleted.

---
Full diff: https://github.com/llvm/llvm-project/pull/193835.diff


1 Files Affected:

- (modified) clang/include/clang/Sema/Sema.h (+5) 


``````````diff
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 78a9d726d33eb..a5e9348c4c88c 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -13684,6 +13684,9 @@ class Sema final : public SemaBase {
     }
 
     ~ScopedCodeSynthesisContext() { S.popCodeSynthesisContext(); }
+    ScopedCodeSynthesisContext(const ScopedCodeSynthesisContext &) = delete;
+    ScopedCodeSynthesisContext &
+    operator=(const ScopedCodeSynthesisContext &) = delete;
   };
 
   /// List of active code synthesis contexts.
@@ -14160,6 +14163,8 @@ class Sema final : public SemaBase {
   public:
     FPFeaturesStateRAII(Sema &S);
     ~FPFeaturesStateRAII();
+    FPFeaturesStateRAII(const FPFeaturesStateRAII &) = delete;
+    FPFeaturesStateRAII &operator=(const FPFeaturesStateRAII &) = delete;
     FPOptionsOverride getOverrides() { return OldOverrides; }
 
   private:

``````````

</details>


https://github.com/llvm/llvm-project/pull/193835


More information about the cfe-commits mailing list