[PATCH] D52230: [clang-tidy] use CHECK-NOTES in tests for bugprone-macro-repeated-side-effects

2018-09-25 Thread Jonas Toth via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE343001: [clang-tidy] use CHECK-NOTES in tests for 
bugprone-macro-repeated-side-effects (authored by JonasToth, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D52230?vs=165942=166961#toc

Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52230

Files:
  test/clang-tidy/bugprone-macro-repeated-side-effects.c

Index: test/clang-tidy/bugprone-macro-repeated-side-effects.c
===
--- test/clang-tidy/bugprone-macro-repeated-side-effects.c
+++ test/clang-tidy/bugprone-macro-repeated-side-effects.c
@@ -3,45 +3,59 @@
 #define badA(x,y)  ((x)+((x)+(y))+(y))
 void bad(int ret, int a, int b) {
   ret = badA(a++, b);
-  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x' are repeated in macro expansion [bugprone-macro-repeated-side-effects]
+  // CHECK-NOTES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x' are repeated in macro expansion [bugprone-macro-repeated-side-effects]
+  // CHECK-NOTES: :[[@LINE-4]]:9: note: macro 'badA' defined here
   ret = badA(++a, b);
-  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x'
+  // CHECK-NOTES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x'
+  // CHECK-NOTES: :[[@LINE-7]]:9: note: macro 'badA' defined here
   ret = badA(a--, b);
-  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x'
+  // CHECK-NOTES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x'
+  // CHECK-NOTES: :[[@LINE-10]]:9: note: macro 'badA' defined here
   ret = badA(--a, b);
-  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x'
+  // CHECK-NOTES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x'
+  // CHECK-NOTES: :[[@LINE-13]]:9: note: macro 'badA' defined here
   ret = badA(a, b++);
-  // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-16]]:9: note: macro 'badA' defined here
   ret = badA(a, ++b);
-  // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-19]]:9: note: macro 'badA' defined here
   ret = badA(a, b--);
-  // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-22]]:9: note: macro 'badA' defined here
   ret = badA(a, --b);
-  // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-25]]:9: note: macro 'badA' defined here
 }
 
 
 #define MIN(A,B) ((A) < (B) ? (A) : (B))// single ?:
 #define LIMIT(X,A,B) ((X) < (A) ? (A) : ((X) > (B) ? (B) : (X)))// two ?:
 void question(int x) {
   MIN(x++, 12);
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: side effects in the 1st macro argument 'A'
+  // CHECK-NOTES: :[[@LINE-1]]:7: warning: side effects in the 1st macro argument 'A'
+  // CHECK-NOTES: :[[@LINE-5]]:9: note: macro 'MIN' defined here
   MIN(34, x++);
-  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: side effects in the 2nd macro argument 'B'
+  // CHECK-NOTES: :[[@LINE-1]]:11: warning: side effects in the 2nd macro argument 'B'
+  // CHECK-NOTES: :[[@LINE-8]]:9: note: macro 'MIN' defined here
   LIMIT(x++, 0, 100);
-  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: side effects in the 1st macro argument 'X'
+  // CHECK-NOTES: :[[@LINE-1]]:9: warning: side effects in the 1st macro argument 'X'
+  // CHECK-NOTES: :[[@LINE-10]]:9: note: macro 'LIMIT' defined here
   LIMIT(20, x++, 100);
-  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: side effects in the 2nd macro argument 'A'
+  // CHECK-NOTES: :[[@LINE-1]]:13: warning: side effects in the 2nd macro argument 'A'
+  // CHECK-NOTES: :[[@LINE-13]]:9: note: macro 'LIMIT' defined here
   LIMIT(20, 0, x++);
-  // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: side effects in the 3rd macro argument 'B'
+  // CHECK-NOTES: :[[@LINE-1]]:16: warning: side effects in the 3rd macro argument 'B'
+  // CHECK-NOTES: :[[@LINE-16]]:9: note: macro 'LIMIT' defined here
 }
 
 // False positive: Repeated side effects is intentional.
 // It is hard to know when it's done by intention so right now we warn.
 #define UNROLL(A){A A}
 void fp1(int i) {
   UNROLL({ i++; });
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: side effects in the 1st macro argument 'A'
+  // CHECK-NOTES: :[[@LINE-1]]:10: warning: side effects in the 1st macro argument 'A'
+  // 

[PATCH] D52230: [clang-tidy] use CHECK-NOTES in tests for bugprone-macro-repeated-side-effects

2018-09-24 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

For the other patches and the following doing the same for other modules too?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52230



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52230: [clang-tidy] use CHECK-NOTES in tests for bugprone-macro-repeated-side-effects

2018-09-23 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

Friendly ping :)
Can i land all the test changes, or do you want to review them? The pattern 
will be the same, I just want them in different commits to revert better if 
something changes on different platforms.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52230



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52230: [clang-tidy] use CHECK-NOTES in tests for bugprone-macro-repeated-side-effects

2018-09-18 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth created this revision.
JonasToth added reviewers: alexfh, aaron.ballman, hokein.
Herald added subscribers: cfe-commits, xazax.hun.

Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52230

Files:
  test/clang-tidy/bugprone-macro-repeated-side-effects.c

Index: test/clang-tidy/bugprone-macro-repeated-side-effects.c
===
--- test/clang-tidy/bugprone-macro-repeated-side-effects.c
+++ test/clang-tidy/bugprone-macro-repeated-side-effects.c
@@ -3,45 +3,59 @@
 #define badA(x,y)  ((x)+((x)+(y))+(y))
 void bad(int ret, int a, int b) {
   ret = badA(a++, b);
-  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x' are repeated in macro expansion [bugprone-macro-repeated-side-effects]
+  // CHECK-NOTES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x' are repeated in macro expansion [bugprone-macro-repeated-side-effects]
+  // CHECK-NOTES: :[[@LINE-4]]:9: note: macro 'badA' defined here
   ret = badA(++a, b);
-  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x'
+  // CHECK-NOTES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x'
+  // CHECK-NOTES: :[[@LINE-7]]:9: note: macro 'badA' defined here
   ret = badA(a--, b);
-  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x'
+  // CHECK-NOTES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x'
+  // CHECK-NOTES: :[[@LINE-10]]:9: note: macro 'badA' defined here
   ret = badA(--a, b);
-  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x'
+  // CHECK-NOTES: :[[@LINE-1]]:14: warning: side effects in the 1st macro argument 'x'
+  // CHECK-NOTES: :[[@LINE-13]]:9: note: macro 'badA' defined here
   ret = badA(a, b++);
-  // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-16]]:9: note: macro 'badA' defined here
   ret = badA(a, ++b);
-  // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-19]]:9: note: macro 'badA' defined here
   ret = badA(a, b--);
-  // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-22]]:9: note: macro 'badA' defined here
   ret = badA(a, --b);
-  // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-1]]:17: warning: side effects in the 2nd macro argument 'y'
+  // CHECK-NOTES: :[[@LINE-25]]:9: note: macro 'badA' defined here
 }
 
 
 #define MIN(A,B) ((A) < (B) ? (A) : (B))// single ?:
 #define LIMIT(X,A,B) ((X) < (A) ? (A) : ((X) > (B) ? (B) : (X)))// two ?:
 void question(int x) {
   MIN(x++, 12);
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: side effects in the 1st macro argument 'A'
+  // CHECK-NOTES: :[[@LINE-1]]:7: warning: side effects in the 1st macro argument 'A'
+  // CHECK-NOTES: :[[@LINE-5]]:9: note: macro 'MIN' defined here
   MIN(34, x++);
-  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: side effects in the 2nd macro argument 'B'
+  // CHECK-NOTES: :[[@LINE-1]]:11: warning: side effects in the 2nd macro argument 'B'
+  // CHECK-NOTES: :[[@LINE-8]]:9: note: macro 'MIN' defined here
   LIMIT(x++, 0, 100);
-  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: side effects in the 1st macro argument 'X'
+  // CHECK-NOTES: :[[@LINE-1]]:9: warning: side effects in the 1st macro argument 'X'
+  // CHECK-NOTES: :[[@LINE-10]]:9: note: macro 'LIMIT' defined here
   LIMIT(20, x++, 100);
-  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: side effects in the 2nd macro argument 'A'
+  // CHECK-NOTES: :[[@LINE-1]]:13: warning: side effects in the 2nd macro argument 'A'
+  // CHECK-NOTES: :[[@LINE-13]]:9: note: macro 'LIMIT' defined here
   LIMIT(20, 0, x++);
-  // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: side effects in the 3rd macro argument 'B'
+  // CHECK-NOTES: :[[@LINE-1]]:16: warning: side effects in the 3rd macro argument 'B'
+  // CHECK-NOTES: :[[@LINE-16]]:9: note: macro 'LIMIT' defined here
 }
 
 // False positive: Repeated side effects is intentional.
 // It is hard to know when it's done by intention so right now we warn.
 #define UNROLL(A){A A}
 void fp1(int i) {
   UNROLL({ i++; });
-  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: side effects in the 1st macro argument 'A'
+  // CHECK-NOTES: :[[@LINE-1]]:10: warning: side effects in the 1st macro argument 'A'
+  // CHECK-NOTES: :[[@LINE-4]]:9: note: macro 'UNROLL' defined here
 }
 
 // Do not produce a false positive on a strchr() macro. Explanation; Currently the '?'
@@ -66,11