diff gen/metadata.h @ 1317:4099548c80e0

Allocate objects on the stack if they (a) don't have a destructor, and (b) don't override the delete operator (on top of the regular conditions for stack allocation that also apply to arrays, structs, etc.). The "no destructor" clause is not strictly necessary, but calling them at the right time would be tricky to say the least; it would involve, among other things, "manually" inserting a try-finally block around anything that might throw exceptions not caught in the current function. Note: objects with custom new operators are automatically ignored because they don't use the regular allocation runtime call, so there's no need to pay special attention to them.
author Frits van Bommel <fvbommel wxs.nl>
date Sat, 09 May 2009 00:50:15 +0200
parents 8c65217be813
children c21a6654cce2
line wrap: on
line diff
--- a/gen/metadata.h	Fri May 08 16:00:44 2009 +0200
+++ b/gen/metadata.h	Sat May 09 00:50:15 2009 +0200
@@ -25,6 +25,21 @@
     TD_NumFields    /// The number of fields in TypeInfo metadata
 };
 
+
+// *** Metadata for ClassInfo instances ***
+#define CD_PREFIX "llvm.ldc.classinfo."
+
+/// The fields in the metadata node for a ClassInfo instance.
+/// (Its name will be CD_PREFIX ~ <Name of ClassInfo global>)
+enum ClassDataFields {
+    CD_BodyType,    /// A value of the LLVM type corresponding to the class body.
+    CD_Finalize,    /// True if this class (or a base class) has a destructor.
+    CD_CustomDelete,/// True if this class has an overridden delete operator.
+    
+    // Must be kept last
+    CD_NumFields    /// The number of fields in ClassInfo metadata
+};
+
 #endif
 
 #endif