[PATCH] D26750: [clang-tidy] Add modernize-use-default-member-init check

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 20 05:31:01 PST 2016


aaron.ballman added inline comments.


================
Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:34
+  case Type::STK_IntegralComplex:
+    return InitType->isCharType() ? "'\\0'" : "0";
+  case Type::STK_Floating:
----------------
This is incorrect if the char type is not a narrow character type. I would probably just initialize the integral with `0`, regardless of whether it was a character or not. You should add a test for char, wchar_t, char16_t (et al), and probably all of the other types (just to make sure we handle them properly and don't introduce later regressions).


================
Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:112
+  }
+}
+
----------------
You'll need to add the `llvm_unreachable()` here in order to avoid MSVC warnings about not all control paths returning a value.


https://reviews.llvm.org/D26750





More information about the cfe-commits mailing list