[clang] 83fe0b1 - [clang] Fix -Wunused-lambda-capture in TokenAnnotator.cpp (NFC)
Jie Fu via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 9 04:27:43 PST 2024
Author: Jie Fu
Date: 2024-03-09T20:26:10+08:00
New Revision: 83fe0b13824bc419092bad47727aa1c8ca69330a
URL: https://github.com/llvm/llvm-project/commit/83fe0b13824bc419092bad47727aa1c8ca69330a
DIFF: https://github.com/llvm/llvm-project/commit/83fe0b13824bc419092bad47727aa1c8ca69330a.diff
LOG: [clang] Fix -Wunused-lambda-capture in TokenAnnotator.cpp (NFC)
llvm-project/clang/lib/Format/TokenAnnotator.cpp:2707:43:
error: lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture]
auto IsQualifiedPointerOrReference = [this](FormatToken *T) {
^~~~
1 error generated.
Added:
Modified:
clang/lib/Format/TokenAnnotator.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 3a5510661200e8..d7b84e309e0964 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -2707,6 +2707,7 @@ class AnnotatingParser {
auto IsQualifiedPointerOrReference = [this](FormatToken *T) {
// This is used to handle cases such as x = (foo *const)&y;
assert(!T->isTypeName(IsCpp) && "Should have already been checked");
+ (void)IsCpp; // Avoid -Wunused-lambda-capture when assertion is disabled.
// Strip trailing qualifiers such as const or volatile when checking
// whether the parens could be a cast to a pointer/reference type.
while (T) {
More information about the cfe-commits
mailing list