[PATCH] D147357: [clang-tidy] Add bugprone-optional-value-conversion check

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 10 12:24:01 PDT 2023


njames93 added a comment.

Have you thought of the possibility of handling this case

  takeOptionalValue(std::move(*param));



================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone/optional-value-conversion.rst:34
+Value extraction using ``operator *`` is matched by default.
+Check does not provide auto-fixes.
+
----------------
Any reason for this limitation, given in most cases the fix is to just remove the `*` or `.value()` call


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone/optional-value-conversion.cpp:16
+  };
+}
+
----------------
It'd be good to have tests demonstating `boost::optional` and `absl::optional` as well as the (non standard) get accessor


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147357



More information about the cfe-commits mailing list