[PATCH] D52690: [clang-tidy] NFC use CHECK-NOTES in tests for misc-misplaced-const

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 29 07:41:30 PDT 2018


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/D52690

Files:
  test/clang-tidy/misc-misplaced-const.c
  test/clang-tidy/misc-misplaced-const.cpp


Index: test/clang-tidy/misc-misplaced-const.cpp
===================================================================
--- test/clang-tidy/misc-misplaced-const.cpp
+++ test/clang-tidy/misc-misplaced-const.cpp
@@ -12,7 +12,8 @@
   if (const cip i = 0)
     ;
 
-  // CHECK-MESSAGES: :[[@LINE+1]]:16: warning: 'i' declared with a const-qualified typedef type; results in the type being 'int *const' instead of 'const int *'
+  // CHECK-NOTES: :[[@LINE+2]]:16: warning: 'i' declared with a const-qualified typedef type; results in the type being 'int *const' instead of 'const int *'
+  // CHECK-NOTES: :[[@LINE-12]]:14: note: typedef declared here
   if (const ip i = 0)
     ;
 }
Index: test/clang-tidy/misc-misplaced-const.c
===================================================================
--- test/clang-tidy/misc-misplaced-const.c
+++ test/clang-tidy/misc-misplaced-const.c
@@ -14,28 +14,33 @@
 
   // Not ok
   const ip i3 = 0;
-  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'i3' declared with a const-qualified typedef type; results in the type being 'int *const' instead of 'const int *'
+  // CHECK-NOTES: :[[@LINE-1]]:12: warning: 'i3' declared with a const-qualified typedef type; results in the type being 'int *const' instead of 'const int *'
+  // CHECK-NOTES: :[[@LINE-14]]:14: note: typedef declared here
 
   ip const i4 = 0;
-  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'i4' declared with a const-qualified
+  // CHECK-NOTES: :[[@LINE-1]]:12: warning: 'i4' declared with a const-qualified
+  // CHECK-NOTES: :[[@LINE-18]]:14: note: typedef declared here
 
   const volatile ip i5 = 0;
-  // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: 'i5' declared with a const-qualified typedef type; results in the type being 'int *const volatile' instead of 'const int *volatile'
+  // CHECK-NOTES: :[[@LINE-1]]:21: warning: 'i5' declared with a const-qualified typedef type; results in the type being 'int *const volatile' instead of 'const int *volatile'
+  // CHECK-NOTES: :[[@LINE-22]]:14: note: typedef declared here
 }
 
 void func2(const plain_i *i1,
            const cip i2,
            const ip i3,
-           // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: 'i3' declared with a const-qualified
+           // CHECK-NOTES: :[[@LINE-1]]:21: warning: 'i3' declared with a const-qualified
+           // CHECK-NOTES: :[[@LINE-29]]:14: note: typedef declared here
            const int *i4) {
 }
 
 struct S {
   const int *i0;
   const plain_i *i1;
   const cip i2;
   const ip i3;
-  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'i3' declared with a const-qualified
+  // CHECK-NOTES: :[[@LINE-1]]:12: warning: 'i3' declared with a const-qualified
+  // CHECK-NOTES: :[[@LINE-39]]:14: note: typedef declared here
 };
 
 // Function pointers should not be diagnosed because a function


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52690.167603.patch
Type: text/x-patch
Size: 2794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180929/68ea34e3/attachment.bin>


More information about the cfe-commits mailing list