Skip to content

Commit 7b7d2dd

Browse files
[llvm][DebugInfo] Fix c++20 warnings in LVOptions.h (#79585)
Compiling with -DCMAKE_CXX_STANDARD=20 produces 228 warnings from this file due to: ``` LVOptions.h:515:16: warning: implicit capture of 'this' with a capture default of '=' is deprecated [-Wdeprecated-this-capture] ``` So I've changed these to explicitly list the captures, including `this`. As llvm requires at least c++17, I think we could use `[=, *this]` instead. However when I did so I got a lot of errors about const. So on balance, explicitly listing the captures seems better than adding some kind of const cast to each one. These and other warnings can be seen on the c++20 buildbot https://lab.llvm.org/buildbot/#/builders/249.
1 parent e0e2160 commit 7b7d2dd

File tree

1 file changed

+4
-4
lines changed
  • llvm/include/llvm/DebugInfo/LogicalView/Core

1 file changed

+4
-4
lines changed

llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,14 +510,14 @@ class LVPatterns final {
510510
template <typename T, typename U>
511511
void resolveGenericPatternMatch(T *Element, const U &Requests) {
512512
assert(Element && "Element must not be nullptr");
513-
auto CheckPattern = [=]() -> bool {
513+
auto CheckPattern = [this, Element]() -> bool {
514514
return (Element->isNamed() &&
515515
(matchGenericPattern(Element->getName()) ||
516516
matchGenericPattern(Element->getLinkageName()))) ||
517517
(Element->isTyped() &&
518518
matchGenericPattern(Element->getTypeName()));
519519
};
520-
auto CheckOffset = [=]() -> bool {
520+
auto CheckOffset = [this, Element]() -> bool {
521521
return matchOffsetPattern(Element->getOffset());
522522
};
523523
if ((options().getSelectGenericPattern() && CheckPattern()) ||
@@ -530,12 +530,12 @@ class LVPatterns final {
530530
template <typename U>
531531
void resolveGenericPatternMatch(LVLine *Line, const U &Requests) {
532532
assert(Line && "Line must not be nullptr");
533-
auto CheckPattern = [=]() -> bool {
533+
auto CheckPattern = [this, Line]() -> bool {
534534
return matchGenericPattern(Line->lineNumberAsStringStripped()) ||
535535
matchGenericPattern(Line->getName()) ||
536536
matchGenericPattern(Line->getPathname());
537537
};
538-
auto CheckOffset = [=]() -> bool {
538+
auto CheckOffset = [this, Line]() -> bool {
539539
return matchOffsetPattern(Line->getAddress());
540540
};
541541
if ((options().getSelectGenericPattern() && CheckPattern()) ||

0 commit comments

Comments
 (0)