[PATCH] D24892: [clang-tidy] Add option "LiteralInitializers" to cppcoreguidelines-pro-type-member-init

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 26 08:49:25 PDT 2016


aaron.ballman added inline comments.

================
Comment at: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:377
@@ +376,3 @@
+        else if (type->isIntegerType())
+          Initializer = " = 0";
+        else if (type->isFloatingType())
----------------
What about cases where a suffix is desired, like `U` or `LL`?

================
Comment at: clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:379
@@ +378,3 @@
+        else if (type->isFloatingType())
+          Initializer = " = 0.0";
+        else if (type->isPointerType())
----------------
Same here for `f`.

================
Comment at: test/clang-tidy/cppcoreguidelines-pro-type-member-init-literal-initializers.cpp:14
@@ +13,3 @@
+  // CHECK-FIXES: float f = 0.0;
+  int* ptr;
+  // CHECK-FIXES: int* ptr = nullptr;
----------------
The `*` should bind to `ptr`.


https://reviews.llvm.org/D24892





More information about the cfe-commits mailing list