[PATCH] D130476: [NFC] Fix some C++20 warnings
Godin added a comment. @aaron.ballman thanks for the review! could you please commit this on my behalf since I do not have commit rights? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D130476/new/ https://reviews.llvm.org/D130476 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D130476: [NFC] Fix some C++20 warnings
Godin created this revision. Herald added a project: All. Godin requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Without this patch when using CMAKE_CXX_STANDARD=20 Microsoft compiler produces following warnings clang\include\clang/Basic/DiagnosticIDs.h(48): warning C5054: operator '+': deprecated between enumerations of different types clang\include\clang/Basic/DiagnosticIDs.h(49): warning C5054: operator '+': deprecated between enumerations of different types clang\include\clang/Basic/DiagnosticIDs.h(50): warning C5054: operator '+': deprecated between enumerations of different types clang\include\clang/Basic/DiagnosticIDs.h(51): warning C5054: operator '+': deprecated between enumerations of different types clang\include\clang/Basic/DiagnosticIDs.h(52): warning C5054: operator '+': deprecated between enumerations of different types clang\include\clang/Basic/DiagnosticIDs.h(53): warning C5054: operator '+': deprecated between enumerations of different types clang\include\clang/Basic/DiagnosticIDs.h(54): warning C5054: operator '+': deprecated between enumerations of different types clang\include\clang/Basic/DiagnosticIDs.h(55): warning C5054: operator '+': deprecated between enumerations of different types clang\include\clang/Basic/DiagnosticIDs.h(56): warning C5054: operator '+': deprecated between enumerations of different types clang\include\clang/Basic/DiagnosticIDs.h(57): warning C5054: operator '+': deprecated between enumerations of different types clang\include\clang/Basic/DiagnosticIDs.h(58): warning C5054: operator '+': deprecated between enumerations of different types clang\include\clang/Basic/DiagnosticIDs.h(59): warning C5054: operator '+': deprecated between enumerations of different types Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D130476 Files: clang/include/clang/Basic/DiagnosticIDs.h Index: clang/include/clang/Basic/DiagnosticIDs.h === --- clang/include/clang/Basic/DiagnosticIDs.h +++ clang/include/clang/Basic/DiagnosticIDs.h @@ -45,18 +45,18 @@ // Start position for diagnostics. enum { DIAG_START_COMMON= 0, - DIAG_START_DRIVER= DIAG_START_COMMON+ DIAG_SIZE_COMMON, - DIAG_START_FRONTEND = DIAG_START_DRIVER+ DIAG_SIZE_DRIVER, - DIAG_START_SERIALIZATION = DIAG_START_FRONTEND + DIAG_SIZE_FRONTEND, - DIAG_START_LEX = DIAG_START_SERIALIZATION + DIAG_SIZE_SERIALIZATION, - DIAG_START_PARSE = DIAG_START_LEX + DIAG_SIZE_LEX, - DIAG_START_AST = DIAG_START_PARSE + DIAG_SIZE_PARSE, - DIAG_START_COMMENT = DIAG_START_AST + DIAG_SIZE_AST, - DIAG_START_CROSSTU = DIAG_START_COMMENT + DIAG_SIZE_COMMENT, - DIAG_START_SEMA = DIAG_START_CROSSTU + DIAG_SIZE_CROSSTU, - DIAG_START_ANALYSIS = DIAG_START_SEMA + DIAG_SIZE_SEMA, - DIAG_START_REFACTORING = DIAG_START_ANALYSIS + DIAG_SIZE_ANALYSIS, - DIAG_UPPER_LIMIT = DIAG_START_REFACTORING + DIAG_SIZE_REFACTORING + DIAG_START_DRIVER= DIAG_START_COMMON+ static_cast(DIAG_SIZE_COMMON), + DIAG_START_FRONTEND = DIAG_START_DRIVER+ static_cast(DIAG_SIZE_DRIVER), + DIAG_START_SERIALIZATION = DIAG_START_FRONTEND + static_cast(DIAG_SIZE_FRONTEND), + DIAG_START_LEX = DIAG_START_SERIALIZATION + static_cast(DIAG_SIZE_SERIALIZATION), + DIAG_START_PARSE = DIAG_START_LEX + static_cast(DIAG_SIZE_LEX), + DIAG_START_AST = DIAG_START_PARSE + static_cast(DIAG_SIZE_PARSE), + DIAG_START_COMMENT = DIAG_START_AST + static_cast(DIAG_SIZE_AST), + DIAG_START_CROSSTU = DIAG_START_COMMENT + static_cast(DIAG_SIZE_COMMENT), + DIAG_START_SEMA = DIAG_START_CROSSTU + static_cast(DIAG_SIZE_CROSSTU), + DIAG_START_ANALYSIS = DIAG_START_SEMA + static_cast(DIAG_SIZE_SEMA), + DIAG_START_REFACTORING = DIAG_START_ANALYSIS + static_cast(DIAG_SIZE_ANALYSIS), + DIAG_UPPER_LIMIT = DIAG_START_REFACTORING + static_cast(DIAG_SIZE_REFACTORING) }; class CustomDiagInfo; Index: clang/include/clang/Basic/DiagnosticIDs.h === --- clang/include/clang/Basic/DiagnosticIDs.h +++ clang/include/clang/Basic/DiagnosticIDs.h @@ -45,18 +45,18 @@ // Start position for diagnostics. enum { DIAG_START_COMMON= 0, - DIAG_START_DRIVER= DIAG_START_COMMON+ DIAG_SIZE_COMMON, - DIAG_START_FRONTEND = DIAG_START_DRIVER+ DIAG_SIZE_DRIVER, - DIAG_START_SERIALIZATION = DIAG_START_FRONTEND + DIAG_SIZE_FRONTEND, - DIAG_START
[PATCH] D115355: Fix build failure with GCC 11 in C++20 mode
Godin added a comment. ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115355/new/ https://reviews.llvm.org/D115355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116904: Fix build failure with MSVC in C++20 mode
Godin created this revision. Godin requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Without this patch when using CMAKE_CXX_STANDARD=20 and MSVC 19.30.30705.0 compilation fails with clang\lib\Tooling\Syntax\Tree.cpp(347): error C2666: 'clang::syntax::Tree::ChildIteratorBase::operator ==': 4 overloads have similar conversions clang\lib\Tooling\Syntax\Tree.cpp(392): error C2666: 'clang::syntax::Tree::ChildIteratorBase::operator ==': 4 overloads have similar conversions Note that removed comment that "iterator_facade_base requires == to be a member" was made obsolete by change https://reviews.llvm.org/D78938 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D116904 Files: clang/include/clang/Tooling/Syntax/Tree.h Index: clang/include/clang/Tooling/Syntax/Tree.h === --- clang/include/clang/Tooling/Syntax/Tree.h +++ clang/include/clang/Tooling/Syntax/Tree.h @@ -181,7 +181,10 @@ ChildIteratorBase() = default; explicit ChildIteratorBase(NodeT *N) : N(N) {} -bool operator==(const DerivedT &O) const { return O.N == N; } +friend bool operator==(const DerivedT &LHS, const DerivedT &RHS) { + return LHS.N == RHS.N; +} + NodeT &operator*() const { return *N; } DerivedT &operator++() { N = N->getNextSibling(); @@ -269,14 +272,6 @@ Node *LastChild = nullptr; }; -// Provide missing non_const == const overload. -// iterator_facade_base requires == to be a member, but implicit conversions -// don't work on the LHS of a member operator. -inline bool operator==(const Tree::ConstChildIterator &A, - const Tree::ConstChildIterator &B) { - return A.operator==(B); -} - /// A list of Elements separated or terminated by a fixed token. /// /// This type models the following grammar construct: Index: clang/include/clang/Tooling/Syntax/Tree.h === --- clang/include/clang/Tooling/Syntax/Tree.h +++ clang/include/clang/Tooling/Syntax/Tree.h @@ -181,7 +181,10 @@ ChildIteratorBase() = default; explicit ChildIteratorBase(NodeT *N) : N(N) {} -bool operator==(const DerivedT &O) const { return O.N == N; } +friend bool operator==(const DerivedT &LHS, const DerivedT &RHS) { + return LHS.N == RHS.N; +} + NodeT &operator*() const { return *N; } DerivedT &operator++() { N = N->getNextSibling(); @@ -269,14 +272,6 @@ Node *LastChild = nullptr; }; -// Provide missing non_const == const overload. -// iterator_facade_base requires == to be a member, but implicit conversions -// don't work on the LHS of a member operator. -inline bool operator==(const Tree::ConstChildIterator &A, - const Tree::ConstChildIterator &B) { - return A.operator==(B); -} - /// A list of Elements separated or terminated by a fixed token. /// /// This type models the following grammar construct: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116904: Fix build failure with MSVC in C++20 mode
Godin added a comment. Thank you for the review @sammccall ! Can someone please commit this on my behalf since I do not have commit rights? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116904/new/ https://reviews.llvm.org/D116904 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D115355: Fix build failure with GCC 11 in C++20 mode
Godin created this revision. Herald added subscribers: dexonsmith, martong, hiraditya, MatzeB. Herald added a reviewer: shafik. Godin requested review of this revision. Herald added projects: clang, LLVM. Herald added subscribers: llvm-commits, cfe-commits. See https://wg21.link/cwg2237 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D115355 Files: clang/lib/AST/ASTImporter.cpp llvm/include/llvm/CodeGen/LiveInterval.h llvm/include/llvm/Support/BinaryStreamArray.h llvm/lib/Passes/StandardInstrumentations.cpp Index: llvm/lib/Passes/StandardInstrumentations.cpp === --- llvm/lib/Passes/StandardInstrumentations.cpp +++ llvm/lib/Passes/StandardInstrumentations.cpp @@ -441,7 +441,7 @@ } // namespace -template ChangeReporter::~ChangeReporter() { +template ChangeReporter::~ChangeReporter() { assert(BeforeStack.empty() && "Problem with Change Printer stack."); } Index: llvm/include/llvm/Support/BinaryStreamArray.h === --- llvm/include/llvm/Support/BinaryStreamArray.h +++ llvm/include/llvm/Support/BinaryStreamArray.h @@ -323,7 +323,7 @@ FixedStreamArrayIterator(const FixedStreamArray &Array, uint32_t Index) : Array(Array), Index(Index) {} - FixedStreamArrayIterator(const FixedStreamArrayIterator &Other) + FixedStreamArrayIterator(const FixedStreamArrayIterator &Other) : Array(Other.Array), Index(Other.Index) {} FixedStreamArrayIterator & operator=(const FixedStreamArrayIterator &Other) { Index: llvm/include/llvm/CodeGen/LiveInterval.h === --- llvm/include/llvm/CodeGen/LiveInterval.h +++ llvm/include/llvm/CodeGen/LiveInterval.h @@ -724,7 +724,7 @@ T *P; public: - SingleLinkedListIterator(T *P) : P(P) {} + SingleLinkedListIterator(T *P) : P(P) {} SingleLinkedListIterator &operator++() { P = P->Next; Index: clang/lib/AST/ASTImporter.cpp === --- clang/lib/AST/ASTImporter.cpp +++ clang/lib/AST/ASTImporter.cpp @@ -8397,8 +8397,8 @@ // and destructed after it is created. The construction already performs the // import of the data. template struct AttrArgImporter { - AttrArgImporter(const AttrArgImporter &) = delete; - AttrArgImporter(AttrArgImporter &&) = default; + AttrArgImporter(const AttrArgImporter &) = delete; + AttrArgImporter(AttrArgImporter &&) = default; AttrArgImporter &operator=(const AttrArgImporter &) = delete; AttrArgImporter &operator=(AttrArgImporter &&) = default; @@ -8417,8 +8417,8 @@ // is used by the attribute classes. This object should be created once for the // array data to be imported (the array size is not imported, just copied). template struct AttrArgArrayImporter { - AttrArgArrayImporter(const AttrArgArrayImporter &) = delete; - AttrArgArrayImporter(AttrArgArrayImporter &&) = default; + AttrArgArrayImporter(const AttrArgArrayImporter &) = delete; + AttrArgArrayImporter(AttrArgArrayImporter &&) = default; AttrArgArrayImporter &operator=(const AttrArgArrayImporter &) = delete; AttrArgArrayImporter &operator=(AttrArgArrayImporter &&) = default; Index: llvm/lib/Passes/StandardInstrumentations.cpp === --- llvm/lib/Passes/StandardInstrumentations.cpp +++ llvm/lib/Passes/StandardInstrumentations.cpp @@ -441,7 +441,7 @@ } // namespace -template ChangeReporter::~ChangeReporter() { +template ChangeReporter::~ChangeReporter() { assert(BeforeStack.empty() && "Problem with Change Printer stack."); } Index: llvm/include/llvm/Support/BinaryStreamArray.h === --- llvm/include/llvm/Support/BinaryStreamArray.h +++ llvm/include/llvm/Support/BinaryStreamArray.h @@ -323,7 +323,7 @@ FixedStreamArrayIterator(const FixedStreamArray &Array, uint32_t Index) : Array(Array), Index(Index) {} - FixedStreamArrayIterator(const FixedStreamArrayIterator &Other) + FixedStreamArrayIterator(const FixedStreamArrayIterator &Other) : Array(Other.Array), Index(Other.Index) {} FixedStreamArrayIterator & operator=(const FixedStreamArrayIterator &Other) { Index: llvm/include/llvm/CodeGen/LiveInterval.h === --- llvm/include/llvm/CodeGen/LiveInterval.h +++ llvm/include/llvm/CodeGen/LiveInterval.h @@ -724,7 +724,7 @@ T *P; public: - SingleLinkedListIterator(T *P) : P(P) {} + SingleLinkedListIterator(T *P) : P(P) {} SingleLinkedListIterator &operator++() { P = P->Next; Index: clang/lib/AST/ASTImporter.cpp === --- clang/lib/AST/ASTImporter.cpp +++ clang/lib/AST/ASTImporter.cpp @@ -8397,8 +8397,8 @@ // and destructed
[PATCH] D115355: Fix build failure with GCC 11 in C++20 mode
Godin added a comment. Thank you for the review @shafik ! As a note: this change is similar to the https://reviews.llvm.org/rG95d0d8e9e9d10da3cfa503fbba405e740aea3cc1 by @rsmith Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115355/new/ https://reviews.llvm.org/D115355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D115355: Fix build failure with GCC 11 in C++20 mode
Godin added a comment. Can someone please commit this on my behalf since I do not have commit rights? Comment at: clang/lib/AST/ASTImporter.cpp:8400-8403 + AttrArgImporter(const AttrArgImporter &) = delete; + AttrArgImporter(AttrArgImporter &&) = default; AttrArgImporter &operator=(const AttrArgImporter &) = delete; AttrArgImporter &operator=(AttrArgImporter &&) = default; dexonsmith wrote: > Might be nice to remove the implied ``s in the parameters/returns (here > and elsewhere) as a follow up; a bit noisy to read those, even if it doesn't > cause a build failure (probably separately from this patch). Thank you for the review @dexonsmith ! I will also prefer such cleanup to be done separately. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115355/new/ https://reviews.llvm.org/D115355 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits