From 6e5082bbc498ab7d68178ea883203b38f6cd47fb Mon Sep 17 00:00:00 2001 From: Marek Kurdej Date: Thu, 29 Apr 2021 09:56:11 +0200 Subject: [PATCH] [clang-format] Fix build on gcc < 7 introduced in rG9363aa9. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes a bogus build error on gcc, e.g. https://lab.llvm.org/buildbot/#/builders/110/builds/2973. /home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/clang/lib/Format/TokenAnnotator.cpp:3097:53: error: binding ‘const clang::SourceRange’ to reference of type ‘clang::SourceRange&’ discards qualifiers auto HasExistingWhitespace = [&Whitespace = Right.WhitespaceRange]() { ^ --- clang/lib/Format/TokenAnnotator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index f20640a..3fe62bc 100755 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -3094,8 +3094,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, const FormatToken &Right) { const FormatToken &Left = *Right.Previous; - auto HasExistingWhitespace = [&Whitespace = Right.WhitespaceRange]() { - return Whitespace.getBegin() != Whitespace.getEnd(); + auto HasExistingWhitespace = [&Right]() { + return Right.WhitespaceRange.getBegin() != Right.WhitespaceRange.getEnd(); }; if (Right.Tok.getIdentifierInfo() && Left.Tok.getIdentifierInfo()) return true; // Never ever merge two identifiers. -- 2.7.4