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

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 30 12:11:56 PDT 2023


PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/OptionalValueConversionCheck.cpp:61
+                                matchers::matchesAnyListedName(ValueMethods)))))
+              .bind("fun")),
+      hasType(qualType().bind("value-type")));
----------------
xgupta wrote:
> Any good reason to choose "fun" as the matcher name?
shortcut from function, as its matcher for a cxxMemberCallExpr i will change it to for example "call"


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone/optional-value-conversion.rst:32
+    }
+
+Value extraction using ``operator *`` is matched by default.
----------------
xgupta wrote:
> Can we also write - A better approach would be to directly pass opt to the print function without extracting its value: 
> `print(opt)`
Yes I will add such thing...


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