aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!

In D72373#1809080 <https://reviews.llvm.org/D72373#1809080>, @AlexanderLanin 
wrote:

> FIX-IT isn't quite that obvious. Some options:
>
> - look for other typedef which contains the same as const
> - create new typedef/using
> - remove "*" from typedef and adjust all usage accordingly. Implies removing 
> "Ptr" suffix.


I think we can punt on the fixit for now as this is a good incremental 
improvement. Another possible option is to remove the `const` from the 
declaration using the typedef (there may be situations where you cannot add a 
new typedef or modify the existing one because the typedef is in a system 
header).



================
Comment at: 
clang-tools-extra/test/clang-tidy/checkers/misc-misplaced-const.cpp:2
+// RUN: %check_clang_tidy %s misc-misplaced-const %t -- -- -DUSING
+// RUN: %check_clang_tidy %s misc-misplaced-const %t -- -- -DTYPEDEF
+
----------------
AlexanderLanin wrote:
> is this good practice? I didn't want to duplicate everything here.
Yes, this is a good way to reduce duplication.


================
Comment at: 
clang-tools-extra/test/clang-tidy/checkers/misc-misplaced-const.cpp:32
+  // Potentially quite unexpectedly the int can be modified here
+  // CHECK-MESSAGES: :[[@LINE+1]]:23: warning: 'i' declared with a 
const-qualified {{.*}}; results in the type being 'int *const' instead of 
'const int *'
+  if (const ptr_to_int i = 0) {
----------------
AlexanderLanin wrote:
> not sure how to remove the regex here without duplicating everything
I think the regex is reasonable enough.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72373/new/

https://reviews.llvm.org/D72373



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

Reply via email to