changeset 139:0ab29b838084 trunk

[svn r143] Fixed: a few bugs in debug information, still only line info, but should be correct files now :) Fixed: tango.io.Console seems to be working now.
author lindquist
date Tue, 22 Jan 2008 00:01:16 +0100
parents aeddd4d533b3
children ffcc9a2f3d9d
files dmd/declaration.c dmd/expression.c dmd/lexer.c dmd/mangle.c dmd/mars.c dmd/module.c dmd/module.h dmd/mtype.c dmd/mtype.h dmd/parse.c dmd/statement.c dmd/template.c gen/functions.cpp gen/todebug.cpp gen/todebug.h gen/toobj.cpp ir/irmodule.cpp ir/irmodule.h llvmdc.kdevelop.filelist suite/dwarfdebug/dwarf1/app.d suite/dwarfdebug/dwarf1/build.sh suite/dwarfdebug/dwarf1/lib.d suite/dwarfdebug/dwarf2/app.d suite/dwarfdebug/dwarf2/build.sh suite/dwarfdebug/dwarf2/lib.d tango/lib/common/tango/llvmdc.mak tango/lib/compiler/llvmdc/cast.d tango/lib/compiler/llvmdc/llvmdc.mak tango/lib/gc/stub/llvmdc.mak tango/tango/io/Buffer.d tango/tango/io/Console.d tango/tango/io/DeviceConduit.d tangotests/l.d
diffstat 33 files changed, 192 insertions(+), 106 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/declaration.c	Fri Jan 18 20:13:19 2008 +0100
+++ b/dmd/declaration.c	Tue Jan 22 00:01:16 2008 +0100
@@ -1099,6 +1099,7 @@
 Expression *VarDeclaration::callAutoDtor()
 {   Expression *e = NULL;
 
+    //printf("VarDeclaration::callAutoDtor() %s\n", toChars());
     if (storage_class & (STCauto | STCscope) && !noauto)
     {
 	for (ClassDeclaration *cd = type->isClassHandle();
@@ -1109,6 +1110,8 @@
 	     * classes to determine if there's no way the monitor
 	     * could be set.
 	     */
+	    if (cd->isInterfaceDeclaration())
+		error("interface %s cannot be scope", cd->toChars());
 	    if (1 || onstack || cd->dtors.dim)	// if any destructors
 	    {
 		// delete this;
--- a/dmd/expression.c	Fri Jan 18 20:13:19 2008 +0100
+++ b/dmd/expression.c	Tue Jan 22 00:01:16 2008 +0100
@@ -518,7 +518,7 @@
 	    {
 		// BUG: should check that argument to ref is type 'invariant'
 		// BUG: assignments to ref should also be type 'invariant'
-		arg = arg->modifiableLvalue(sc, NULL);
+		arg = arg->modifiableLvalue(sc, arg);
 
 		//if (arg->op == TOKslice)
 		    //arg->error("cannot modify slice %s", arg->toChars());
@@ -4357,7 +4357,7 @@
 	if (e)
 	    return e;
 
-	e1 = e1->modifiableLvalue(sc, NULL);
+	e1 = e1->modifiableLvalue(sc, e1);
 	e1->checkScalar();
 	type = e1->type;
 	if (type->toBasetype()->ty == Tbool)
@@ -4388,7 +4388,7 @@
 	if (e)
 	    return e;
 
-	e1 = e1->modifiableLvalue(sc, NULL);
+	e1 = e1->modifiableLvalue(sc, e1);
 	e1->checkScalar();
 	type = e1->type;
 	if (type->toBasetype()->ty == Tbool)
@@ -6874,7 +6874,7 @@
 	    return e;
 
 	e = this;
-	e1 = e1->modifiableLvalue(sc, NULL);
+	e1 = e1->modifiableLvalue(sc, e1);
 	e1->checkScalar();
 	e1->checkNoBool();
 	if (e1->type->ty == Tpointer)
@@ -7060,7 +7060,7 @@
 	// e1 is not an lvalue, but we let code generator handle it
 	ArrayLengthExp *ale = (ArrayLengthExp *)e1;
 
-	ale->e1 = ale->e1->modifiableLvalue(sc, NULL);
+	ale->e1 = ale->e1->modifiableLvalue(sc, e1);
     }
     else if (e1->op == TOKslice)
 	;
@@ -7122,7 +7122,7 @@
     if (e)
 	return e;
 
-    e1 = e1->modifiableLvalue(sc, NULL);
+    e1 = e1->modifiableLvalue(sc, e1);
 
     Type *tb1 = e1->type->toBasetype();
     Type *tb2 = e2->type->toBasetype();
@@ -7222,7 +7222,7 @@
     if (e)
 	return e;
 
-    e1 = e1->modifiableLvalue(sc, NULL);
+    e1 = e1->modifiableLvalue(sc, e1);
     e1->checkScalar();
     e1->checkNoBool();
     if (e1->type->ty == Tpointer && e2->type->isintegral())
@@ -7267,7 +7267,7 @@
 	    error("cannot append to static array %s", se->e1->type->toChars());
     }
 
-    e1 = e1->modifiableLvalue(sc, NULL);
+    e1 = e1->modifiableLvalue(sc, e1);
 
     Type *tb1 = e1->type->toBasetype();
     Type *tb2 = e2->type->toBasetype();
@@ -7316,7 +7316,7 @@
     if (e)
 	return e;
 
-    e1 = e1->modifiableLvalue(sc, NULL);
+    e1 = e1->modifiableLvalue(sc, e1);
     e1->checkScalar();
     e1->checkNoBool();
     type = e1->type;
@@ -7372,7 +7372,7 @@
     if (e)
 	return e;
 
-    e1 = e1->modifiableLvalue(sc, NULL);
+    e1 = e1->modifiableLvalue(sc, e1);
     e1->checkScalar();
     e1->checkNoBool();
     type = e1->type;
@@ -7443,7 +7443,7 @@
     if (e)
 	return e;
 
-    e1 = e1->modifiableLvalue(sc, NULL);
+    e1 = e1->modifiableLvalue(sc, e1);
     e1->checkScalar();
     e1->checkNoBool();
     type = e1->type;
@@ -7472,7 +7472,7 @@
     if (e)
 	return e;
 
-    e1 = e1->modifiableLvalue(sc, NULL);
+    e1 = e1->modifiableLvalue(sc, e1);
     e1->checkScalar();
     e1->checkNoBool();
     type = e1->type;
@@ -7501,7 +7501,7 @@
     if (e)
 	return e;
 
-    e1 = e1->modifiableLvalue(sc, NULL);
+    e1 = e1->modifiableLvalue(sc, e1);
     e1->checkScalar();
     e1->checkNoBool();
     type = e1->type;
--- a/dmd/lexer.c	Fri Jan 18 20:13:19 2008 +0100
+++ b/dmd/lexer.c	Tue Jan 22 00:01:16 2008 +0100
@@ -2162,7 +2162,7 @@
 		break;
 	    if (d >= r)
 		break;
-	    if (n * r + d < n)
+	    if (n && n * r + d <= n)
 	    {
 		error ("integer overflow");
 		break;
--- a/dmd/mangle.c	Fri Jan 18 20:13:19 2008 +0100
+++ b/dmd/mangle.c	Tue Jan 22 00:01:16 2008 +0100
@@ -141,8 +141,10 @@
 	if (isMain())
 	    return "_Dmain";
 
+    if (isWinMain() || isDllMain())
+        return ident->toChars();
+
     assert(this);
-    
     return Declaration::mangle();
     }
 
--- a/dmd/mars.c	Fri Jan 18 20:13:19 2008 +0100
+++ b/dmd/mars.c	Tue Jan 22 00:01:16 2008 +0100
@@ -1,5 +1,5 @@
 // Compiler implementation of the D programming language
-// Copyright (c) 1999-2007 by Digital Mars
+// Copyright (c) 1999-2008 by Digital Mars
 // All Rights Reserved
 // written by Walter Bright
 // http://www.digitalmars.com
@@ -68,10 +68,10 @@
 #error "fix this"
 #endif
 
-    copyright = "Copyright (c) 1999-2007 by Digital Mars and Tomas Lindquist Olsen";
+    copyright = "Copyright (c) 1999-2008 by Digital Mars and Tomas Lindquist Olsen";
     written = "written by Walter Bright and Tomas Lindquist Olsen";
     llvmdc_version = "0.1";
-    version = "v1.025";
+    version = "v1.026";
     global.structalign = 8;
 
     memset(&params, 0, sizeof(Param));
@@ -823,7 +823,6 @@
 		continue;
 	    }
 
-#if !IN_LLVM
 #if TARGET_LINUX
 	    if (strcmp(ext, "a") == 0)
 #else
@@ -833,7 +832,6 @@
 		global.params.libfiles->push(files.data[i]);
 		continue;
 	    }
-#endif
 
 	    if (strcmp(ext, global.ddoc_ext) == 0)
 	    {
--- a/dmd/module.c	Fri Jan 18 20:13:19 2008 +0100
+++ b/dmd/module.c	Tue Jan 22 00:01:16 2008 +0100
@@ -162,7 +162,7 @@
     symfile = new File(symfilename);
 
     // LLVMDC
-    llvmCompileUnit = 0;
+    irModule = NULL;
 }
 
 void Module::setDocfile()
--- a/dmd/module.h	Fri Jan 18 20:13:19 2008 +0100
+++ b/dmd/module.h	Tue Jan 22 00:01:16 2008 +0100
@@ -29,7 +29,7 @@
 #if IN_LLVM
 struct DValue;
 typedef DValue elem;
-namespace llvm { class GlobalVariable; }
+struct IrModule;
 #else
 #ifdef IN_GCC
 union tree_node; typedef union tree_node elem;
@@ -169,7 +169,7 @@
     void genmoduleinfo();
 
     // LLVMDC
-    llvm::GlobalVariable* llvmCompileUnit;
+    IrModule* irModule;
 
     Module *isModule() { return this; }
 };
--- a/dmd/mtype.c	Fri Jan 18 20:13:19 2008 +0100
+++ b/dmd/mtype.c	Tue Jan 22 00:01:16 2008 +0100
@@ -3973,6 +3973,15 @@
     return sym->basetype->dotExp(sc, e, ident);
 }
 
+Expression *TypeTypedef::getProperty(Loc loc, Identifier *ident)
+{
+    if (ident == Id::init)
+    {
+	return Type::getProperty(loc, ident);
+    }
+    return sym->basetype->getProperty(loc, ident);
+}
+
 int TypeTypedef::isbit()
 {
     return sym->basetype->isbit();
@@ -4276,6 +4285,18 @@
 	return e;
     }
 
+    TemplateInstance *ti = s->isTemplateInstance();
+    if (ti)
+    {	if (!ti->semanticdone)
+	    ti->semantic(sc);
+	s = ti->inst->toAlias();
+	if (!s->isTemplateInstance())
+	    goto L1;
+	Expression *de = new DotExp(e->loc, e, new ScopeExp(e->loc, ti));
+	de->type = e->type;
+	return de;
+    }
+
     d = s->isDeclaration();
 #ifdef DEBUG
     if (!d)
@@ -4646,6 +4667,18 @@
 	return e;
     }
 
+    TemplateInstance *ti = s->isTemplateInstance();
+    if (ti)
+    {	if (!ti->semanticdone)
+	    ti->semantic(sc);
+	s = ti->inst->toAlias();
+	if (!s->isTemplateInstance())
+	    goto L1;
+	Expression *de = new DotExp(e->loc, e, new ScopeExp(e->loc, ti));
+	de->type = e->type;
+	return de;
+    }
+
     d = s->isDeclaration();
     if (!d)
     {
--- a/dmd/mtype.h	Fri Jan 18 20:13:19 2008 +0100
+++ b/dmd/mtype.h	Tue Jan 22 00:01:16 2008 +0100
@@ -587,6 +587,7 @@
     void toTypeInfoBuffer(OutBuffer *buf);
     void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
     Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
+    Expression *getProperty(Loc loc, Identifier *ident);
     int isbit();
     int isintegral();
     int isfloating();
--- a/dmd/parse.c	Fri Jan 18 20:13:19 2008 +0100
+++ b/dmd/parse.c	Tue Jan 22 00:01:16 2008 +0100
@@ -1219,13 +1219,12 @@
 
 TemplateParameters *Parser::parseTemplateParameterList()
 {
-    TemplateParameters *tpl;
+    TemplateParameters *tpl = new TemplateParameters();
 
     if (token.value != TOKlparen)
     {   error("parenthesized TemplateParameterList expected following TemplateIdentifier");
 	goto Lerr;
     }
-    tpl = new TemplateParameters();
     nextToken();
 
     // Get array of TemplateParameters
@@ -1309,7 +1308,7 @@
 		if (!tp_ident)
 		{
 		    error("no identifier for template value parameter");
-		    goto Lerr;
+		    tp_ident = new Identifier("error", TOKidentifier);
 		}
 		if (token.value == TOKcolon)	// : CondExpression
 		{
@@ -1330,10 +1329,8 @@
 	}
     }
     check(TOKrparen);
+Lerr:
     return tpl;
-
-Lerr:
-    return NULL;
 }
 
 /******************************************
--- a/dmd/statement.c	Fri Jan 18 20:13:19 2008 +0100
+++ b/dmd/statement.c	Tue Jan 22 00:01:16 2008 +0100
@@ -1982,6 +1982,7 @@
     {	condition = condition->integralPromotions(sc);
 	condition->checkIntegral();
     }
+    condition = condition->optimize(WANTvalue);
 
     sc = sc->push();
     sc->sbreak = this;
--- a/dmd/template.c	Fri Jan 18 20:13:19 2008 +0100
+++ b/dmd/template.c	Tue Jan 22 00:01:16 2008 +0100
@@ -1,6 +1,6 @@
 
 // Compiler implementation of the D programming language
-// Copyright (c) 1999-2007 by Digital Mars
+// Copyright (c) 1999-2008 by Digital Mars
 // All Rights Reserved
 // written by Walter Bright
 // http://www.digitalmars.com
@@ -1540,6 +1540,9 @@
 	else if (tempinst->tempdecl != tp->tempinst->tempdecl)
 	    goto Lnomatch;
 
+	if (tempinst->tiargs->dim != tp->tempinst->tiargs->dim)
+	    goto Lnomatch;
+
 	for (int i = 0; i < tempinst->tiargs->dim; i++)
 	{
 	    //printf("test: [%d]\n", i);
@@ -3008,6 +3011,8 @@
 	    ea = ea->semantic(sc);
 	    ea = ea->optimize(WANTvalue | WANTinterpret);
 	    tiargs->data[j] = ea;
+	    if (ea->op == TOKtype)
+		tiargs->data[j] = ea->type;
 	}
 	else if (sa)
 	{
@@ -3292,6 +3297,9 @@
 	  Lsa:
 	    Declaration *d = sa->isDeclaration();
 	    if (d && !d->isDataseg() &&
+#if V2
+		!(d->storage_class & STCmanifest) &&
+#endif
 		(!d->isFuncDeclaration() || d->isFuncDeclaration()->isNested()) &&
 		!isTemplateMixin())
 	    {
--- a/gen/functions.cpp	Fri Jan 18 20:13:19 2008 +0100
+++ b/gen/functions.cpp	Tue Jan 22 00:01:16 2008 +0100
@@ -459,10 +459,7 @@
     // debug info
     if (global.params.symdebug) {
         Module* mo = fd->getModule();
-        if (!mo->llvmCompileUnit) {
-            mo->llvmCompileUnit = DtoDwarfCompileUnit(mo,false);
-        }
-        fd->irFunc->dwarfSubProg = DtoDwarfSubProgram(fd, mo->llvmCompileUnit);
+        fd->irFunc->dwarfSubProg = DtoDwarfSubProgram(fd, DtoDwarfCompileUnit(mo));
     }
 
     Type* t = DtoDType(fd->type);
--- a/gen/todebug.cpp	Fri Jan 18 20:13:19 2008 +0100
+++ b/gen/todebug.cpp	Tue Jan 22 00:01:16 2008 +0100
@@ -11,6 +11,8 @@
 #include "gen/tollvm.h"
 #include "gen/logger.h"
 
+#include "ir/irmodule.h"
+
 using namespace llvm::dwarf;
 
 static const llvm::PointerType* ptrTy(const llvm::Type* t)
@@ -110,27 +112,40 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::GlobalVariable* DtoDwarfCompileUnit(Module* m, bool define)
+llvm::GlobalVariable* DtoDwarfCompileUnit(Module* m)
 {
+    if (!m->irModule)
+        m->irModule = new IrModule(m);
+    else if (m->irModule->dwarfCompileUnit)
+    {
+        if (m->irModule->dwarfCompileUnit->getParent() == gIR->module)
+            return m->irModule->dwarfCompileUnit;
+    }
+
+    // create a valid compile unit constant for the current module
+
     llvm::Constant* c = NULL;
-    if (1 || define) {
-        std::vector<llvm::Constant*> vals;
-        vals.push_back(llvm::ConstantExpr::getAdd(
-            DtoConstUint(DW_TAG_compile_unit),
-            DtoConstUint(llvm::LLVMDebugVersion)));
-        vals.push_back(dbgToArrTy(GetDwarfAnchor(DW_TAG_compile_unit)));
 
-        vals.push_back(DtoConstUint(DW_LANG_C));// _D)); // doesn't seem to work
-        vals.push_back(DtoConstStringPtr(m->srcfile->name->toChars(), "llvm.metadata"));
-        std::string srcpath(FileName::path(m->srcfile->name->toChars()));
-        //srcpath.append("/");
-        vals.push_back(DtoConstStringPtr(srcpath.c_str(), "llvm.metadata"));
-        vals.push_back(DtoConstStringPtr("LLVMDC (http://www.dsource.org/projects/llvmdc)", "llvm.metadata"));
+    std::vector<llvm::Constant*> vals;
+    vals.push_back(llvm::ConstantExpr::getAdd(
+        DtoConstUint(DW_TAG_compile_unit),
+        DtoConstUint(llvm::LLVMDebugVersion)));
+    vals.push_back(dbgToArrTy(GetDwarfAnchor(DW_TAG_compile_unit)));
 
-        c = llvm::ConstantStruct::get(GetDwarfCompileUnitType(), vals);
-    }
+    vals.push_back(DtoConstUint(DW_LANG_C));// _D)); // doesn't seem to work
+    vals.push_back(DtoConstStringPtr(m->srcfile->name->toChars(), "llvm.metadata"));
+    std::string srcpath(FileName::path(m->srcfile->name->toChars()));
+    if (srcpath.empty())
+        srcpath = ".";
+    vals.push_back(DtoConstStringPtr(srcpath.c_str(), "llvm.metadata"));
+    vals.push_back(DtoConstStringPtr("LLVMDC (http://www.dsource.org/projects/llvmdc)", "llvm.metadata"));
+
+    c = llvm::ConstantStruct::get(GetDwarfCompileUnitType(), vals);
+
     llvm::GlobalVariable* gv = new llvm::GlobalVariable(GetDwarfCompileUnitType(), true, llvm::GlobalValue::InternalLinkage, c, "llvm.dbg.compile_unit", gIR->module);
     gv->setSection("llvm.metadata");
+
+    m->irModule->dwarfCompileUnit = gv;
     return gv;
 }
 
@@ -181,7 +196,7 @@
     std::vector<llvm::Value*> args;
     args.push_back(DtoConstUint(ln));
     args.push_back(DtoConstUint(0));
-    assert(gIR->dmodule->llvmCompileUnit);
-    args.push_back(dbgToArrTy(gIR->dmodule->llvmCompileUnit));
+    FuncDeclaration* fd = gIR->func()->decl;
+    args.push_back(dbgToArrTy(DtoDwarfCompileUnit(fd->getModule())));
     gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.stoppoint"), args.begin(), args.end());
 }
--- a/gen/todebug.h	Fri Jan 18 20:13:19 2008 +0100
+++ b/gen/todebug.h	Tue Jan 22 00:01:16 2008 +0100
@@ -7,7 +7,7 @@
 const llvm::StructType* GetDwarfCompileUnitType();
 const llvm::StructType* GetDwarfSubProgramType();
 
-llvm::GlobalVariable* DtoDwarfCompileUnit(Module* m, bool define);
+llvm::GlobalVariable* DtoDwarfCompileUnit(Module* m);
 llvm::GlobalVariable* DtoDwarfSubProgram(FuncDeclaration* fd, llvm::GlobalVariable* compileUnit);
 
 void DtoDwarfFuncStart(FuncDeclaration* fd);
--- a/gen/toobj.cpp	Fri Jan 18 20:13:19 2008 +0100
+++ b/gen/toobj.cpp	Tue Jan 22 00:01:16 2008 +0100
@@ -42,6 +42,7 @@
 #include "gen/runtime.h"
 
 #include "ir/irvar.h"
+#include "ir/irmodule.h"
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
@@ -59,10 +60,15 @@
     deleteObjFile();
 
     // create a new ir state
+    // TODO look at making the instance static and moving most functionality into IrModule where it belongs
     IRState ir;
     gIR = &ir;
     ir.dmodule = this;
 
+    // module ir state
+    // might already exist via import, just overwrite...
+    irModule = new IrModule(this);
+
     // name the module
     std::string mname(toChars());
     if (md != 0)
@@ -88,7 +94,7 @@
     // debug info
     if (global.params.symdebug) {
         RegisterDwarfSymbols(ir.module);
-        ir.dmodule->llvmCompileUnit = DtoDwarfCompileUnit(this,true);
+        DtoDwarfCompileUnit(this);
     }
 
     // start out by providing opaque for the built-in class types
--- a/ir/irmodule.cpp	Fri Jan 18 20:13:19 2008 +0100
+++ b/ir/irmodule.cpp	Tue Jan 22 00:01:16 2008 +0100
@@ -3,6 +3,7 @@
 IrModule::IrModule(Module* module)
 {
     M = module;
+    dwarfCompileUnit = NULL;
 }
 
 IrModule::~IrModule()
--- a/ir/irmodule.h	Fri Jan 18 20:13:19 2008 +0100
+++ b/ir/irmodule.h	Tue Jan 22 00:01:16 2008 +0100
@@ -11,6 +11,8 @@
     virtual ~IrModule();
 
     Module* M;
+
+    llvm::GlobalVariable* dwarfCompileUnit;
 };
 
 #endif
--- a/llvmdc.kdevelop.filelist	Fri Jan 18 20:13:19 2008 +0100
+++ b/llvmdc.kdevelop.filelist	Tue Jan 22 00:01:16 2008 +0100
@@ -250,6 +250,16 @@
 lphobos/typeinfos2.d
 premake.lua
 runalltests.d
+suite
+suite/dwarfdebug
+suite/dwarfdebug/dwarf1
+suite/dwarfdebug/dwarf1/app.d
+suite/dwarfdebug/dwarf1/build.sh
+suite/dwarfdebug/dwarf1/lib.d
+suite/dwarfdebug/dwarf2
+suite/dwarfdebug/dwarf2/app.d
+suite/dwarfdebug/dwarf2/build.sh
+suite/dwarfdebug/dwarf2/lib.d
 tango
 tango/lib
 tango/lib/common
@@ -759,6 +769,7 @@
 tangotests/r.d
 tangotests/s.d
 tangotests/t.d
+tangotests/u.d
 test
 test/a.d
 test/aa1.d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/suite/dwarfdebug/dwarf1/app.d	Tue Jan 22 00:01:16 2008 +0100
@@ -0,0 +1,12 @@
+module app;
+import lib;
+
+void func()
+{
+    lib_func();
+}
+
+void main()
+{
+    func();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/suite/dwarfdebug/dwarf1/build.sh	Tue Jan 22 00:01:16 2008 +0100
@@ -0,0 +1,3 @@
+#!/bin/bash
+llvmdc lib.d -c -g -dis
+llvmdc app.d lib.bc -g -dis -ofapp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/suite/dwarfdebug/dwarf1/lib.d	Tue Jan 22 00:01:16 2008 +0100
@@ -0,0 +1,7 @@
+module lib;
+
+void lib_func()
+{
+    int* p;
+    *p = 666;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/suite/dwarfdebug/dwarf2/app.d	Tue Jan 22 00:01:16 2008 +0100
@@ -0,0 +1,14 @@
+module app;
+import lib;
+
+void func()
+{
+    int* ip;
+    int i = lib_templ_func(ip);
+}
+
+int main(char[][] args)
+{
+    func();
+    return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/suite/dwarfdebug/dwarf2/build.sh	Tue Jan 22 00:01:16 2008 +0100
@@ -0,0 +1,3 @@
+#!/bin/bash
+llvmdc lib.d -c -g -dis
+llvmdc app.d lib.bc -g -dis -ofapp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/suite/dwarfdebug/dwarf2/lib.d	Tue Jan 22 00:01:16 2008 +0100
@@ -0,0 +1,6 @@
+module lib;
+
+T lib_templ_func(T)(T* a)
+{
+    return *a;
+}
--- a/tango/lib/common/tango/llvmdc.mak	Fri Jan 18 20:13:19 2008 +0100
+++ b/tango/lib/common/tango/llvmdc.mak	Tue Jan 22 00:01:16 2008 +0100
@@ -22,14 +22,14 @@
 ADD_CFLAGS=
 ADD_DFLAGS=
 
-CFLAGS=-O $(ADD_CFLAGS)
-#CFLAGS=-g $(ADD_CFLAGS)
+#CFLAGS=-O $(ADD_CFLAGS)
+CFLAGS=-g $(ADD_CFLAGS)
 
-DFLAGS=-release -O -inline -w -nofloat $(ADD_DFLAGS)
-#DFLAGS=-g -w -nofloat $(ADD_DFLAGS)
+#DFLAGS=-release -O -inline -w $(ADD_DFLAGS)
+DFLAGS=-g -w $(ADD_DFLAGS)
 
-TFLAGS=-O -inline -w -nofloat $(ADD_DFLAGS)
-#TFLAGS=-g -w -nofloat $(ADD_DFLAGS)
+#TFLAGS=-O -inline -w $(ADD_DFLAGS)
+TFLAGS=-g -w $(ADD_DFLAGS)
 
 DOCFLAGS=-version=DDoc
 
--- a/tango/lib/compiler/llvmdc/cast.d	Fri Jan 18 20:13:19 2008 +0100
+++ b/tango/lib/compiler/llvmdc/cast.d	Tue Jan 22 00:01:16 2008 +0100
@@ -27,7 +27,7 @@
 
 extern (C):
 
-debug = PRINTF;
+//debug = PRINTF;
 debug(PRINTF) int printf(char*, ...);
 
 /******************************************
--- a/tango/lib/compiler/llvmdc/llvmdc.mak	Fri Jan 18 20:13:19 2008 +0100
+++ b/tango/lib/compiler/llvmdc/llvmdc.mak	Tue Jan 22 00:01:16 2008 +0100
@@ -20,14 +20,14 @@
 RM=rm -f
 MD=mkdir -p
 
-CFLAGS=-O3 $(ADD_CFLAGS)
-#CFLAGS=-g $(ADD_CFLAGS)
+#CFLAGS=-O3 $(ADD_CFLAGS)
+CFLAGS=-g $(ADD_CFLAGS)
 
-DFLAGS=-release -O3 -inline -w $(ADD_DFLAGS)
-#DFLAGS=-g -w $(ADD_DFLAGS)
+#DFLAGS=-release -O3 -inline -w $(ADD_DFLAGS)
+DFLAGS=-g -w $(ADD_DFLAGS)
 
-TFLAGS=-O3 -inline -w $(ADD_DFLAGS)
-#TFLAGS=-g -w $(ADD_DFLAGS)
+#TFLAGS=-O3 -inline -w $(ADD_DFLAGS)
+TFLAGS=-g -w $(ADD_DFLAGS)
 
 DOCFLAGS=-version=DDoc
 
--- a/tango/lib/gc/stub/llvmdc.mak	Fri Jan 18 20:13:19 2008 +0100
+++ b/tango/lib/gc/stub/llvmdc.mak	Tue Jan 22 00:01:16 2008 +0100
@@ -20,16 +20,16 @@
 ADD_CFLAGS=
 ADD_DFLAGS=
 
-CFLAGS=-O $(ADD_CFLAGS)
-#CFLAGS=-g $(ADD_CFLAGS)
+#CFLAGS=-O $(ADD_CFLAGS)
+CFLAGS=-g $(ADD_CFLAGS)
 
 ### warnings disabled because gcx has issues ###
 
-DFLAGS=-release -O -inline $(ADD_DFLAGS)
-#DFLAGS=-g $(ADD_DFLAGS)
+#DFLAGS=-release -O -inline $(ADD_DFLAGS)
+DFLAGS=-g $(ADD_DFLAGS)
 
-TFLAGS=-O -inline $(ADD_DFLAGS)
-#TFLAGS=-g $(ADD_DFLAGS)
+#TFLAGS=-O -inline $(ADD_DFLAGS)
+TFLAGS=-g $(ADD_DFLAGS)
 
 DOCFLAGS=-version=DDoc
 
--- a/tango/tango/io/Buffer.d	Fri Jan 18 20:13:19 2008 +0100
+++ b/tango/tango/io/Buffer.d	Tue Jan 22 00:01:16 2008 +0100
@@ -25,7 +25,6 @@
 extern (C)
 {
         protected void * memcpy (void *dst, void *src, uint);
-        private int printf(char*, ...);
 }       
 
 /*******************************************************************************
@@ -164,18 +163,10 @@
 
         this (IConduit conduit)
         {
-                printf("Buffer.this(%p)\n", conduit);
-                printf("assert (conduit !is null);\n");
-                assert (conduit !is null);
-                printf("assert (conduit);\n", conduit);
                 assert (conduit);
 
-                printf("this (conduit.bufferSize(%p));\n", conduit);
-                printf("cast(Object)conduit = %p\n", cast(Object)conduit);
                 this (conduit.bufferSize);
                 setConduit (conduit);
-
-                assert(this !is null);
         }
 
         /***********************************************************************
@@ -230,7 +221,6 @@
 
         this (uint capacity = 0)
         {
-                printf("Buffer.this(%p, %u)\n", this, capacity);
                 setContent (new ubyte[capacity], 0);
                 assert(this !is null);
         }
@@ -551,7 +541,6 @@
 
         IBuffer append (void* src, uint length)
         {
-                printf("Buffer.append(%p, %u)\n", src, length);
                 if (length > writable)
                     // can we write externally?
                     if (sink)
@@ -571,9 +560,7 @@
                        }
                     else
                        error (overflow);
-                printf("  copying\n");
                 copy (src, length);
-                printf("returning\n");
                 return this;
         }
 
@@ -1097,7 +1084,6 @@
 
         protected void copy (void *src, uint size)
         {
-                printf("Buffer.copy(%p, %u)\n", src, size);
                 // avoid "out of bounds" test on zero size
                 if (size)
                    {
@@ -1105,7 +1091,6 @@
                    memcpy (&data[extent], src, size);
                    extent += size;
                    }
-                printf("  copy done\n");
         }
 
         /***********************************************************************
--- a/tango/tango/io/Console.d	Fri Jan 18 20:13:19 2008 +0100
+++ b/tango/tango/io/Console.d	Tue Jan 22 00:01:16 2008 +0100
@@ -23,7 +23,6 @@
 version (Posix)
          private import tango.stdc.posix.unistd;  // needed for isatty()
 
-private extern(C) int printf(char*, ...);
 
 /*******************************************************************************
 
@@ -70,7 +69,6 @@
 
                 private this (Conduit conduit, bool redirected)
                 {
-                        printf("Console.Input.this(%p, %d)\n", conduit, redirected);
                         assert (conduit);
                         redirect = redirected;
                         buffer = new Buffer (conduit);
@@ -599,7 +597,6 @@
 
                         private this (Handle handle)
                         {
-                                printf("Console.Conduit.this(%d)\n", handle);
                                 reopen (handle);
                                 redirected = (isatty(handle) is 0);
                         }
@@ -627,18 +624,12 @@
 
 static this ()
 {
-        printf("STATIC INIT FOR CONSOLE\n");
-        printf("Cin conduit\n");
         auto conduit = new Console.Conduit (0);
-        assert(conduit);
-        printf("Cin input\n");
         Cin  = new Console.Input (conduit, conduit.redirected);
 
-        printf("Cout\n");
         conduit = new Console.Conduit (1);
         Cout = new Console.Output (conduit, conduit.redirected);
 
-        printf("Cerr\n");
         conduit = new Console.Conduit (2);
         Cerr = new Console.Output (conduit, conduit.redirected);
 }
--- a/tango/tango/io/DeviceConduit.d	Fri Jan 18 20:13:19 2008 +0100
+++ b/tango/tango/io/DeviceConduit.d	Tue Jan 22 00:01:16 2008 +0100
@@ -18,8 +18,6 @@
 
 private import  tango.core.Exception;
 
-private extern(C) int printf(char*, ...);
-
 /*******************************************************************************
 
         Implements a means of reading and writing a file device. Conduits
--- a/tangotests/l.d	Fri Jan 18 20:13:19 2008 +0100
+++ b/tangotests/l.d	Tue Jan 22 00:01:16 2008 +0100
@@ -2,13 +2,5 @@
 
 void main()
 {
-    printf("enter\n");
-    assert(Cout !is null);
-    printf("newline\n");
-    Cout.newline;
-    printf("hi message\n");
     Cout("Hi, says LLVMDC + Tango").newline;
-    printf("exit\n");
 }
-
-extern(C) int printf(char*,...);