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

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 16 06:33:49 PST 2024


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

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.

>From e85b64f919dc3b9e9590f9f344fcb9c277761789 Mon Sep 17 00:00:00 2001
From: "Podchishchaeva, Mariya" <mariya.podchishchaeva at intel.com>
Date: Mon, 16 Dec 2024 06:29:17 -0800
Subject: [PATCH] [HLSL][NFC] Fix static analyzer concerns

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.
---
 clang/lib/Sema/HLSLExternalSemaSource.cpp | 3 +++
 1 file changed, 3 insertions(+)

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.



More information about the cfe-commits mailing list