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

Shivam Gupta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 30 10:41:32 PDT 2023


xgupta added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/OptionalValueConversionCheck.cpp:61
+                                matchers::matchesAnyListedName(ValueMethods)))))
+              .bind("fun")),
+      hasType(qualType().bind("value-type")));
----------------
Any good reason to choose "fun" as the matcher name?


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


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