-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[HLSL][NFC] Fix static analyzer concerns #120090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
@llvm/pr-subscribers-clang @llvm/pr-subscribers-hlsl Author: Mariya Podchishchaeva (Fznamznon) ChangesClass 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:
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.
|
BuiltinTypeMethodBuilder(BuiltinTypeMethodBuilder &Other) = delete; | ||
BuiltinTypeMethodBuilder &operator=(BuiltinTypeMethodBuilder &Other) = delete; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BuiltinTypeMethodBuilder(BuiltinTypeMethodBuilder &Other) = delete; | |
BuiltinTypeMethodBuilder &operator=(BuiltinTypeMethodBuilder &Other) = delete; | |
BuiltinTypeMethodBuilder(const BuiltinTypeMethodBuilder &Other) = delete; | |
BuiltinTypeMethodBuilder &operator=(const BuiltinTypeMethodBuilder &Other) = delete; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo nit
Thank you @Fznamznon ! |
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.