njames93 accepted this revision.
njames93 added a comment.
This revision is now accepted and ready to land.
Just 2 more `CHECK-FIXES` lines need updating.
FWIW the reason its good to be explicit is because FileCheck will start
searching from the line where the previous CHECK-FIXES had and stop when it
sees line that contains the match.
In this example:
// CHECK-FIXES: [this]() { };
If the there was an error with the fix, but later on in the file, that string
was found. FileCheck would assume the CHECK-FIXES directive was found and
report success.
That may in turn lead other CHECK-FIXES to fail due to the position of the
previous match. But those error message would be slightly more confusing as the
expected fix was actually found in the output file (just not in the correct
place)
Expanding the check to this:
// CHECK-FIXES: auto explicit_this_capture = [this]() { };
Means we have to match the whole line(which is a lot less likely to appear
again later in the file.)
================
Comment at:
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/avoid-capture-default-when-capturing-this.cpp:10
+ // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: lambdas that capture 'this'
should not specify a capture default
[cppcoreguidelines-avoid-capture-default-when-capturing-this]
+ // CHECK-FIXES: [this]() { };
+
----------------
================
Comment at:
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/avoid-capture-default-when-capturing-this.cpp:14
+ // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: lambdas that capture 'this'
should not specify a capture default
[cppcoreguidelines-avoid-capture-default-when-capturing-this]
+ // CHECK-FIXES: [local, this]() { return (local+x) > 10; };
+
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141133/new/
https://reviews.llvm.org/D141133
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits