Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Changeset 820:bb4a81e68ddb

Show
Ignore:
Timestamp:
12/01/08 19:20:22 (1 month ago)
Author:
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
branch:
default
Message:

Implemented allocating storage for a slice if its address is taken, fixes #115

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gen/toir.cpp

    r819 r820  
    889889    } 
    890890    Logger::println("is nothing special"); 
    891     LLValue* lval = v->getLVal(); 
     891 
     892    // we special case here, since apparently taking the address of a slice is ok 
     893    LLValue* lval; 
     894    if (v->isLVal()) 
     895        lval = v->getLVal(); 
     896    else 
     897    { 
     898        assert(v->isSlice()); 
     899        LLValue* rval = v->getRVal(); 
     900        lval = DtoAlloca(rval->getType(), ".tmp_slice_storage"); 
     901        DtoStore(rval, lval); 
     902    } 
     903 
    892904    if (Logger::enabled()) 
    893905        Logger::cout() << "lval: " << *lval << '\n'; 
    894     return new DImValue(type, DtoBitCast(v->getLVal(), DtoType(type))); 
     906 
     907    return new DImValue(type, DtoBitCast(lval, DtoType(type))); 
    895908} 
    896909 
Copyright © 2008, LDC Development Team.