njames93 added inline comments.

================
Comment at: 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/avoid-const-or-ref-data-members.cpp:103-104
+struct WithAlias {
+  ConstType c;
+  // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: member 'c' is const qualified
+  RefType lr;
----------------
I feel like this could potentially confuse users. Maybe we should walk the 
alias to show where the type was declared to be const/reference.
Or, not a fan of this choice, don't diagnose these unless the user opts into 
this behaviour.


================
Comment at: 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/avoid-const-or-ref-data-members.cpp:136-157
+template <typename T>
+struct TemplatedOk {
+  T t;
+};
+
+template <typename T>
+struct TemplatedConst {
----------------
This whole block displeases me. Warning on the instantiation isn't a great idea 
and could confuse users.
Would again need some expansion notes to explain why the warning is being 
triggered, especially when if for 99% of the uses one of these structs has a T 
which isn't const or a reference.
Failing that just disabling the check in template instantiations would also fix 
the issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126880

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

Reply via email to