[PATCH] D73856: [docu] Improve docu of misc-misplaced-const

2020-02-03 Thread Alexander Lanin via Phabricator via cfe-commits
AlexanderLanin abandoned this revision.
AlexanderLanin added a comment.

@aaron.ballman I was ready to complain, but you are right. It would make 
absolutely no sense to move the const, it's just where it should be.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73856



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


[PATCH] D73856: [docu] Improve docu of misc-misplaced-const

2020-02-03 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

> East const makes the problem more obvious. With west const people were 
> telling me the const is on the wrong side.

I don't see how this makes the problem more obvious and it seems odd to me that 
we'd mix styles in code and prose. I prefer leaving this as a west const.

I have no opinion about `typedef` vs `using` in this spot, but given that the 
check can be used in C as well as C++, `typedef` is slightly more portable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73856



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


[PATCH] D73856: [docu] Improve docu of misc-misplaced-const

2020-02-02 Thread Alexander Lanin via Phabricator via cfe-commits
AlexanderLanin created this revision.
AlexanderLanin added a project: clang-tools-extra.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

East const makes the problem more obvious. With west const people were telling 
me the const is on the wrong side.

Also it's time to use using instead of typedef.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73856

Files:
  clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-const.rst


Index: clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-const.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-const.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-const.rst
@@ -13,10 +13,9 @@
 
 .. code-block:: c++
 
-  typedef int *int_ptr;
-  void f(const int_ptr ptr) {
+  using int_ptr = int*;
+  void f(int_ptr const ptr) {
 *ptr = 0; // potentially quite unexpectedly the int can be modified here
-ptr = 0; // does not compile
   }
 
 The check does not diagnose when the underlying ``typedef``/``using`` type is a


Index: clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-const.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-const.rst
+++ clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-const.rst
@@ -13,10 +13,9 @@
 
 .. code-block:: c++
 
-  typedef int *int_ptr;
-  void f(const int_ptr ptr) {
+  using int_ptr = int*;
+  void f(int_ptr const ptr) {
 *ptr = 0; // potentially quite unexpectedly the int can be modified here
-ptr = 0; // does not compile
   }
 
 The check does not diagnose when the underlying ``typedef``/``using`` type is a
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits