[PATCH] D150411: [NFC][Clang][Coverity] Fix Static Code Analysis Concerns with copy without assign

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 11 19:37:38 PDT 2023


Manna added inline comments.


================
Comment at: clang/include/clang/Sema/Sema.h:1789-1791
+    SemaDiagnosticBuilder &operator=(SemaDiagnosticBuilder &&D) = delete;
     SemaDiagnosticBuilder(const SemaDiagnosticBuilder &) = default;
+    SemaDiagnosticBuilder &operator=(const SemaDiagnosticBuilder &) = delete;
----------------
@tahonermann This is follow-up comments from https://reviews.llvm.org/D149718?id=519331#inline-1452044. 

>>This change still declares a move assignment operator, but doesn't provide a definition. The move constructor is implemented in clang/lib/Sema/Sema.cpp, so I would expect to see the move assignment operator definition provided there as well.

I tried to define move assignment operator in ` clang/lib/Sema/Sema.cpp` but it failed because class Sema has deleted implicit copy assignment operator.

```
/// Sema - This implements semantic analysis and AST building for C.
class Sema final {
  Sema(const Sema &) = delete;
  void operator=(const Sema &) = delete;
```
It seems like support for assignment is not desired, We probably need deleted copy/move assignment operator.



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150411/new/

https://reviews.llvm.org/D150411



More information about the cfe-commits mailing list