Skip to content

Commit

Permalink
[clang-tidy] NFC use CHECK-NOTES in test for cppgoreguidelines-avoid-…
Browse files Browse the repository at this point in the history
…goto

Reviewers: alexfh, aaron.ballman, hokein

Reviewed By: alexfh

Subscribers: nemanjai, xazax.hun, kbarton, cfe-commits

Differential Revision: https://reviews.llvm.org/D52686

llvm-svn: 343565
  • Loading branch information
JonasToth committed Oct 2, 2018
1 parent 4661922 commit 240b8f3
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ void noop() {}
int main() {
noop();
goto jump_to_me;
// CHECK-MESSAGES: [[@LINE-1]]:3: warning: avoid using 'goto' for flow control
// CHECK-MESSAGES: [[@LINE+3]]:1: note: label defined here
// CHECK-NOTES: [[@LINE-1]]:3: warning: avoid using 'goto' for flow control
// CHECK-NOTES: [[@LINE+3]]:1: note: label defined here
noop();

jump_to_me:;

jump_backwards:;
noop();
goto jump_backwards;
// CHECK-MESSAGES: [[@LINE-1]]:3: warning: avoid using 'goto' for flow control
// CHECK-MESSAGES: [[@LINE-4]]:1: note: label defined here
// CHECK-NOTES: [[@LINE-1]]:3: warning: avoid using 'goto' for flow control
// CHECK-NOTES: [[@LINE-4]]:1: note: label defined here

goto jump_in_line;
;
jump_in_line:;
// CHECK-MESSAGES: [[@LINE-3]]:3: warning: avoid using 'goto' for flow control
// CHECK-MESSAGES: [[@LINE-2]]:1: note: label defined here
// CHECK-NOTES: [[@LINE-3]]:3: warning: avoid using 'goto' for flow control
// CHECK-NOTES: [[@LINE-2]]:1: note: label defined here

// Test the GNU extension https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
some_label:;
Expand Down Expand Up @@ -132,8 +132,8 @@ void jump_out_backwards() {
for (int j = 0; j < 10; ++j) {
if (i * j > 80)
goto before_the_loop;
// CHECK-MESSAGES: [[@LINE-1]]:9: warning: avoid using 'goto' for flow control
// CHECK-MESSAGES: [[@LINE-8]]:1: note: label defined here
// CHECK-NOTES: [[@LINE-1]]:9: warning: avoid using 'goto' for flow control
// CHECK-NOTES: [[@LINE-8]]:1: note: label defined here
}
}
}

0 comments on commit 240b8f3

Please sign in to comment.