[clang] 40c2d61 - [clang-format] Fix build on gcc < 7 introduced in rG9363aa9.
Marek Kurdej via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 29 01:08:48 PDT 2021
Author: Marek Kurdej
Date: 2021-04-29T10:07:04+02:00
New Revision: 40c2d6188b08f7a1bdd23a8cfdfea8fa998bdff6
URL: https://github.com/llvm/llvm-project/commit/40c2d6188b08f7a1bdd23a8cfdfea8fa998bdff6
DIFF: https://github.com/llvm/llvm-project/commit/40c2d6188b08f7a1bdd23a8cfdfea8fa998bdff6.diff
LOG: [clang-format] Fix build on gcc < 7 introduced in rG9363aa9.
This fixes another bogus build error on gcc, e.g. https://lab.llvm.org/buildbot/#/builders/110/builds/2974.
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/clang/lib/Format/TokenAnnotator.cpp:3412:34: error: binding ‘const clang::format::FormatStyle’ to reference of type ‘clang::format::FormatStyle&’ discards qualifiers
auto ShouldAddSpacesInAngles = [&Style = this->Style,
^
Added:
Modified:
clang/lib/Format/TokenAnnotator.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 3fe62bc4adc0..719bb3fdd066 100755
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -3409,11 +3409,10 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
return Style.SpaceAfterCStyleCast ||
Right.isOneOf(TT_BinaryOperator, TT_SelectorName);
- auto ShouldAddSpacesInAngles = [&Style = this->Style,
- &HasExistingWhitespace]() {
- if (Style.SpacesInAngles == FormatStyle::SIAS_Always)
+ auto ShouldAddSpacesInAngles = [this, &HasExistingWhitespace]() {
+ if (this->Style.SpacesInAngles == FormatStyle::SIAS_Always)
return true;
- if (Style.SpacesInAngles == FormatStyle::SIAS_Leave)
+ if (this->Style.SpacesInAngles == FormatStyle::SIAS_Leave)
return HasExistingWhitespace();
return false;
};
More information about the cfe-commits
mailing list