[PATCH] D23353: [clang-tidy] Add check 'misc-use-after-move'

Eugene Zelenko via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 10 11:07:00 PDT 2016


Eugene.Zelenko added a subscriber: Eugene.Zelenko.

================
Comment at: docs/ReleaseNotes.rst:75
@@ +74,3 @@
+
+  This check warns if an object is used after it has been moved, without an
+  intervening reinitialization.
----------------
Please remove //This check// and capitalize //warns//

================
Comment at: docs/clang-tidy/checks/misc-use-after-move.rst:15
@@ +14,3 @@
+
+The last line will trigger a warning that ``str`` is used after it has been
+moved.
----------------
str is not language construct, please use `.

================
Comment at: docs/clang-tidy/checks/misc-use-after-move.rst:51
@@ +50,3 @@
+In some cases, the check may not be able to detect that two branches are
+mutually exclusive. For example (assuming that ``i`` is an int):
+
----------------
i is not language construct, please use `.

================
Comment at: docs/clang-tidy/checks/misc-use-after-move.rst:78
@@ +77,3 @@
+
+No warnings are emitted for objects of type std::unique_ptr and std::shared_ptr,
+as they have defined move behavior. (Objects of these classes are guaranteed to
----------------
Please highlight std::unique_ptr and std::shared_ptr with ``

================
Comment at: docs/clang-tidy/checks/misc-use-after-move.rst:181
@@ +180,3 @@
+  .. code-block:: c++
+  struct S {
+    std::string str;
----------------
Please insert empty line and indent code as in previous examples.

================
Comment at: docs/clang-tidy/checks/misc-use-after-move.rst:190
@@ +189,3 @@
+
+The check will not consider ``s`` to be reinitialized after the last line;
+instead, the line that assigns to ``s.str`` will be flagged as a use-after-move.
----------------
s, s.str and S are not language construct. Please use `.


https://reviews.llvm.org/D23353





More information about the cfe-commits mailing list