[clang] [HLSL][NFC] Fix static analyzer concerns (PR #120090)

via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 16 06:34:24 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-hlsl

Author: Mariya Podchishchaeva (Fznamznon)

<details>
<summary>Changes</summary>

Class BuiltinTypeMethodBuilder has a user-defined destructor so likely compiler generated special functions may behave incorrectly. Delete explicitly copy constructor and copy assignment operator to avoid potential errors.

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


1 Files Affected:

- (modified) clang/lib/Sema/HLSLExternalSemaSource.cpp (+3) 


``````````diff
diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp
index 79fc2751b73812..f21069d7d64ee4 100644
--- a/clang/lib/Sema/HLSLExternalSemaSource.cpp
+++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp
@@ -546,6 +546,9 @@ struct BuiltinTypeMethodBuilder {
 public:
   ~BuiltinTypeMethodBuilder() { finalizeMethod(); }
 
+  BuiltinTypeMethodBuilder(BuiltinTypeMethodBuilder &Other) = delete;
+  BuiltinTypeMethodBuilder &operator=(BuiltinTypeMethodBuilder &Other) = delete;
+
   Expr *getResourceHandleExpr() {
     // The first statement added to a method or access to 'this' creates the
     // declaration.

``````````

</details>


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


More information about the cfe-commits mailing list