diff dmd/dsymbol.c @ 946:1714836f2c0b

Mostly rewrite debug info generation in terms of llvm/Analysis/DebugInfo.h. Add getCompilationModule to Dsymbol and fix template compile unit decision code. Runtime compiles with -g again.
author Christian Kamm <kamm incasoftware de>
date Sun, 08 Feb 2009 16:50:22 +0100
parents e83ba4ae4878
children b30fe7e1dbb9
line wrap: on
line diff
--- a/dmd/dsymbol.c	Sun Feb 08 05:26:54 2009 +0100
+++ b/dmd/dsymbol.c	Sun Feb 08 16:50:22 2009 +0100
@@ -554,6 +554,34 @@
     return NULL;
 }
 
+
+/**********************************
+ * Determine which Module a Dsymbol will be compiled in.
+ * This may be different from getModule for templates.
+ */
+
+Module *Dsymbol::getCompilationModule()
+{
+    Module *m;
+    TemplateInstance *ti;
+    Dsymbol *s;
+
+    //printf("Dsymbol::getModule()\n");
+    s = this;
+    while (s)
+    {
+	//printf("\ts = '%s'\n", s->toChars());
+	m = s->isModule();
+	if (m)
+	    return m;
+	ti = s->isTemplateInstance();
+	if (ti && ti->tmodule)
+	    return ti->tmodule;
+	s = s->parent;
+    }
+    return NULL;
+}
+
 /*************************************
  */