[PATCH] D106431: [clang-tidy] Fix cppcoreguidelines-init-variables by removing the enum FixIt, and add support for initialization check of scoped enum.

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 29 00:30:22 PDT 2021


whisperity added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp:85
+  if (TypePtr->isEnumeralType())
+    InitializationString = "";
+  else if (TypePtr->isIntegerType())
----------------
Also, if we're using //Optional//, this could also be `= nullptr` instead, and then we have the state when the //Optional// `hasValue()` but the value itself is null. In all other cases, it //both// `hasValue()` and the value is non-null.
This would also eliminate the need for the `strlen` call.


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

https://reviews.llvm.org/D106431



More information about the cfe-commits mailing list