[PATCH] D73856: [docu] Improve docu of misc-misplaced-const
Alexander Lanin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 2 14:53:31 PST 2020
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73856.241948.patch
Type: text/x-patch
Size: 637 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200202/d1cb618d/attachment.bin>
More information about the cfe-commits
mailing list