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