JonasToth updated this revision to Diff 167919. JonasToth added a comment. - use absolute line number for note
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: :4: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: :4: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: :4: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: :4: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: :4: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: :4:14: note: typedef declared here }; // Function pointers should not be diagnosed because a function
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: :4: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: :4: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: :4: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: :4: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: :4: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: :4:14: note: typedef declared here }; // Function pointers should not be diagnosed because a function
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits