whisperity added inline comments.

================
Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp:85
+  if (TypePtr->isEnumeralType())
+    InitializationString = "";
+  else if (TypePtr->isIntegerType())
----------------
whisperity wrote:
> 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.
In the StringRef case, you'd need to `emplace` a default-constructed StringRef 
(which has the semantics of not pointing anywhere and having length 0) into the 
Optional. 


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

https://reviews.llvm.org/D106431

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to