BlockStmt* BlockStmt::copyInner(SymbolMap* map) { BlockStmt* _this = new BlockStmt(); _this->blockTag = blockTag; _this->blockInfo = COPY_INT(blockInfo); _this->useList = COPY_INT(useList); _this->byrefVars = COPY_INT(byrefVars); for_alist(expr, body) { Expr* copy = COPY_INT(expr); _this->insertAtTail(copy); if (DefExpr* def = toDefExpr(copy)) { if (TypeSymbol* ts = toTypeSymbol(def->sym)) { if (EnumType* et = toEnumType(ts->type)) { // ensure we have the size, cast functions, etc. // Lydia NOTE: This relies on making no copies of enum types prior to // buildDefaultFunctions(). The creation must happen here because // otherwise the EnumType will not have the correct symbol, and the // symbol will not be in the tree. buildEnumFunctions(et); } } } }
ForallIntents* ForallIntents::copy(SymbolMap* map, bool internal) { // If this fails, see localMap and update_symbols() in DECLARE_COPY(). // NB we can't DECLARE_COPY(ForallIntents) because it has _this->astloc. INT_ASSERT(map && internal); // Start would-be copyInner(). ForallIntents* _this = new ForallIntents(); // alas std::vector does not have a constructor that "reserves" slots int nv = numVars(); _this->fiVars.reserve(nv); _this->fIntents.reserve(nv); _this->riSpecs.reserve(nv); for (int i = 0; i < nv; i++) { _this->fiVars .push_back(COPY_INT(fiVars[i])); _this->fIntents.push_back( fIntents[i]); _this->riSpecs .push_back(COPY_INT(riSpecs[i])); } _this->iterRec = COPY_INT(iterRec); _this->leadIdx = COPY_INT(leadIdx); _this->leadIdxCopy = COPY_INT(leadIdxCopy); // Finish would-be copyInner(). // No update_symbols() because !internal is false. return _this; }
BlockStmt* BlockStmt::copyInner(SymbolMap* map) { BlockStmt* _this = new BlockStmt(); _this->blockTag = blockTag; for_alist(expr, body) _this->insertAtTail(COPY_INT(expr)); _this->blockInfo = COPY_INT(blockInfo); _this->modUses = COPY_INT(modUses); _this->breakLabel = breakLabel; _this->continueLabel = continueLabel; return _this; }
AggregateType* AggregateType::copyInner(SymbolMap* map) { AggregateType* copy_type = new AggregateType(aggregateTag); copy_type->initializerStyle = initializerStyle; copy_type->outer = outer; for_alist(expr, fields) { copy_type->fields.insertAtTail(COPY_INT(expr)); }
void qq_buddy_copy(QQBuddy *from, QQBuddy *to) { if(from == NULL || to == NULL){ return; } #define COPY_STR(x) qq_buddy_set(to, #x, from -> x -> str) COPY_STR(uin); COPY_STR(qqnumber); COPY_STR(status); COPY_STR(nick); COPY_STR(markname); COPY_STR(country); COPY_STR(city); COPY_STR(province); COPY_STR(gender); COPY_STR(face); COPY_STR(flag); COPY_STR(phone); COPY_STR(mobile); COPY_STR(email); COPY_STR(college); COPY_STR(occupation); COPY_STR(personal); COPY_STR(homepage); COPY_STR(lnick); #undef COPY_STR #define COPY_INT(x) to -> x = from -> x COPY_INT(vip_info); COPY_INT(blood); COPY_INT(shengxiao); COPY_INT(constel); COPY_INT(allow); COPY_INT(client_type); COPY_INT(birthday.year); COPY_INT(birthday.month); COPY_INT(birthday.day); COPY_INT(cate_index); #undef COPY_INT }
for_alist(expr, inherits) { copy_type->inherits.insertAtTail(COPY_INT(expr)); }
for_alist(delegate, forwardingTo) { copy_type->forwardingTo.insertAtTail(COPY_INT(delegate)); }
CatchStmt* CatchStmt::copyInner(SymbolMap* map) { return new CatchStmt(COPY_INT(expr()), COPY_INT(body())); }