[llvm] r236244 - Add a note about permitting default member initializers

Reid Kleckner reid at kleckner.net
Thu Apr 30 11:17:12 PDT 2015


Author: rnk
Date: Thu Apr 30 13:17:12 2015
New Revision: 236244

URL: http://llvm.org/viewvc/llvm-project?rev=236244&view=rev
Log:
Add a note about permitting default member initializers

Use them in WinEHPrepare so that we can spot any toolchain bugs that
come up.

Modified:
    llvm/trunk/docs/CodingStandards.rst
    llvm/trunk/lib/CodeGen/WinEHPrepare.cpp

Modified: llvm/trunk/docs/CodingStandards.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodingStandards.rst?rev=236244&r1=236243&r2=236244&view=diff
==============================================================================
--- llvm/trunk/docs/CodingStandards.rst (original)
+++ llvm/trunk/docs/CodingStandards.rst Thu Apr 30 13:17:12 2015
@@ -131,6 +131,12 @@ unlikely to be supported by our host com
     cannot synthesize them.
 * Initializer lists: N2627_
 * Delegating constructors: N1986_
+* Default member initializers (non-static data member initializers): N2756_
+
+  * Only use these for scalar members that would otherwise be left
+    uninitialized. Non-scalar members generally have appropriate default
+    constructors, and MSVC 2013 has problems when braced initializer lists are
+    involved.
 
 .. _N2118: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html
 .. _N2439: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm
@@ -156,7 +162,7 @@ unlikely to be supported by our host com
 .. _N2346: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm
 .. _N2627: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm
 .. _N1986: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf
-.. _MSVC-compatible RTTI: http://llvm.org/PR18951
+.. _N2756: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2756.htm
 
 The supported features in the C++11 standard libraries are less well tracked,
 but also much greater. Most of the standard libraries implement most of C++11's

Modified: llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/WinEHPrepare.cpp?rev=236244&r1=236243&r2=236244&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/WinEHPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/WinEHPrepare.cpp Thu Apr 30 13:17:12 2015
@@ -72,7 +72,7 @@ class WinEHPrepare : public FunctionPass
 public:
   static char ID; // Pass identification, replacement for typeid.
   WinEHPrepare(const TargetMachine *TM = nullptr)
-      : FunctionPass(ID), DT(nullptr), SEHExceptionCodeSlot(nullptr) {
+      : FunctionPass(ID) {
     if (TM)
       TheTriple = Triple(TM->getTargetTriple());
   }
@@ -119,8 +119,8 @@ private:
   Triple TheTriple;
 
   // All fields are reset by runOnFunction.
-  DominatorTree *DT;
-  EHPersonality Personality;
+  DominatorTree *DT = nullptr;
+  EHPersonality Personality = EHPersonality::Unknown;
   CatchHandlerMapTy CatchHandlerMap;
   CleanupHandlerMapTy CleanupHandlerMap;
   DenseMap<const LandingPadInst *, LandingPadMap> LPadMaps;
@@ -150,7 +150,7 @@ private:
   // 32-bit EH.
   DenseMap<Function *, Value *> HandlerToParentFP;
 
-  AllocaInst *SEHExceptionCodeSlot;
+  AllocaInst *SEHExceptionCodeSlot = nullptr;
 };
 
 class WinEHFrameVariableMaterializer : public ValueMaterializer {





More information about the llvm-commits mailing list