Mercurial > projects > ldc
changeset 172:68a7dd38c03c trunk
[svn r188] Fixed using a dereferenced pointer argument as both l- and r-value. fixes tango.io.FileRoots.
Reorganized the tangotests dir a bit.
author | lindquist |
---|---|
date | Tue, 06 May 2008 07:26:27 +0200 |
parents | 95f07e3f8bb9 |
children | db9890b3fb64 |
files | gen/dvalue.cpp gen/toir.cpp llvmdc.kdevelop.filelist tangotests/b.d tangotests/c.d tangotests/compile/d.d tangotests/compile/g.d tangotests/d.d tangotests/e.d tangotests/f.d tangotests/fail/p.d tangotests/fail/q.d tangotests/g.d tangotests/h.d tangotests/i.d tangotests/p.d tangotests/q.d |
diffstat | 17 files changed, 80 insertions(+), 74 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/dvalue.cpp Tue May 06 05:25:53 2008 +0200 +++ b/gen/dvalue.cpp Tue May 06 07:26:27 2008 +0200 @@ -52,12 +52,8 @@ } else { if (rval) return rval; - Logger::cout() << "val: " << *val << '\n'; - if (isaArgument(val)) { - if (var && (var->isRef() || var->isOut())) - return DtoLoad(val); - } - else if (!isField() && DtoCanLoad(val)) { + //Logger::cout() << "val: " << *val << '\n'; + if (!isThis() && !isField() && DtoCanLoad(val)) { return DtoLoad(val); } return val;
--- a/gen/toir.cpp Tue May 06 05:25:53 2008 +0200 +++ b/gen/toir.cpp Tue May 06 07:26:27 2008 +0200 @@ -211,12 +211,6 @@ // function parameter else if (vd->isParameter()) { Logger::println("function param"); - if (!gIR->irDsymbol[vd].getIrValue()) { - assert(0); // should be fixed now - // TODO: determine this properly - // this happens when the DMD frontend generates by pointer wrappers for struct opEquals(S) and opCmp(S) - gIR->irDsymbol[vd].getIrValue() = &p->func()->func->getArgumentList().back(); - } if (vd->isRef() || vd->isOut() || DtoIsPassedByRef(vd->type) || llvm::isa<llvm::AllocaInst>(gIR->irDsymbol[vd].getIrValue())) { return new DVarValue(vd, gIR->irDsymbol[vd].getIrValue(), true); } @@ -1371,7 +1365,8 @@ Type* t = DtoDType(type); Type* e1type = DtoDType(e1->type); - //Logger::print("e1type=%s\n", e1type->toChars()); + //Logger::println("e1type=%s", e1type->toChars()); + //Logger::cout() << *DtoType(e1type) << '\n'; if (VarDeclaration* vd = var->isVarDeclaration()) { llvm::Value* arrptr;
--- a/llvmdc.kdevelop.filelist Tue May 06 05:25:53 2008 +0200 +++ b/llvmdc.kdevelop.filelist Tue May 06 07:26:27 2008 +0200 @@ -748,6 +748,8 @@ tangotests tangotests/a.d tangotests/aa1.d +tangotests/abc.d +tangotests/abcd.d tangotests/b.d tangotests/c.d tangotests/classes1.d
--- a/tangotests/b.d Tue May 06 05:25:53 2008 +0200 +++ b/tangotests/b.d Tue May 06 07:26:27 2008 +0200 @@ -27,3 +27,8 @@ { c.d = 2.5; } + +void main() +{ + func(); +}
--- a/tangotests/c.d Tue May 06 05:25:53 2008 +0200 +++ b/tangotests/c.d Tue May 06 07:26:27 2008 +0200 @@ -18,3 +18,8 @@ { c.i = 123; } + +void main() +{ + func(); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tangotests/compile/d.d Tue May 06 07:26:27 2008 +0200 @@ -0,0 +1,8 @@ +char* toStringz (char[] s) +{ + if (s.ptr) + if (! (s.length && s[$-1] is 0)) + s = s ~ '\0'; + return s.ptr; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tangotests/compile/g.d Tue May 06 07:26:27 2008 +0200 @@ -0,0 +1,9 @@ +extern(C) +{ + private extern int integer; +} + +void func() +{ + integer++; +} \ No newline at end of file
--- a/tangotests/d.d Tue May 06 05:25:53 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -char* toStringz (char[] s) -{ - if (s.ptr) - if (! (s.length && s[$-1] is 0)) - s = s ~ '\0'; - return s.ptr; -} -
--- a/tangotests/e.d Tue May 06 05:25:53 2008 +0200 +++ b/tangotests/e.d Tue May 06 07:26:27 2008 +0200 @@ -20,3 +20,8 @@ { scope c = new MyClass(42); } + +void main() +{ + func(); +} \ No newline at end of file
--- a/tangotests/f.d Tue May 06 05:25:53 2008 +0200 +++ b/tangotests/f.d Tue May 06 07:26:27 2008 +0200 @@ -1,7 +1,5 @@ extern(C) int printf(char*,...); - - void main() { printf("Hello World!\n");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tangotests/fail/p.d Tue May 06 07:26:27 2008 +0200 @@ -0,0 +1,18 @@ +extern(C) int printf(char*, ...); + +int main(char[][] args) +{ + printf("getint\n"); + int i = getint(); + printf("assert true\n"); + assert(i == 1234); + printf("assert false\n"); + assert(i != 1234); + printf("return\n"); + return 0; +} + +int getint() +{ + return 1234; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tangotests/fail/q.d Tue May 06 07:26:27 2008 +0200 @@ -0,0 +1,22 @@ +class E : Exception +{ + this(char[] msg) + { + super(msg); + } + + char[] toString() + { + return super.toString(); + } +} + +extern(C) int printf(char*, ...); + +void main() +{ + auto e = new E("hello world"); + auto msg = e.toString(); + printf("message should be: '%.*s'\n", msg.length, msg.ptr); + throw e; +}
--- a/tangotests/g.d Tue May 06 05:25:53 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -extern(C) -{ - private extern int integer; -} - -void func() -{ - integer++; -} \ No newline at end of file
--- a/tangotests/h.d Tue May 06 05:25:53 2008 +0200 +++ b/tangotests/h.d Tue May 06 07:26:27 2008 +0200 @@ -21,7 +21,7 @@ } } -void func() +void main() { scope c = new C; }
--- a/tangotests/i.d Tue May 06 05:25:53 2008 +0200 +++ b/tangotests/i.d Tue May 06 07:26:27 2008 +0200 @@ -14,7 +14,7 @@ } } -void func() +void main() { scope c = new C; }
--- a/tangotests/p.d Tue May 06 05:25:53 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -extern(C) int printf(char*, ...); - -int main(char[][] args) -{ - printf("getint\n"); - int i = getint(); - printf("assert true\n"); - assert(i == 1234); - printf("assert false\n"); - assert(i != 1234); - printf("return\n"); - return 0; -} - -int getint() -{ - return 1234; -}
--- a/tangotests/q.d Tue May 06 05:25:53 2008 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -class E : Exception -{ - this(char[] msg) - { - super(msg); - } - - char[] toString() - { - return super.toString(); - } -} - -extern(C) int printf(char*, ...); - -void main() -{ - auto e = new E("hello world"); - auto msg = e.toString(); - printf("message should be: '%.*s'\n", msg.length, msg.ptr); - throw e; -}