本文整理汇总了C++中Expression::addressOf方法的典型用法代码示例。如果您正苦于以下问题:C++ Expression::addressOf方法的具体用法?C++ Expression::addressOf怎么用?C++ Expression::addressOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expression
的用法示例。
在下文中一共展示了Expression::addressOf方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: genTypeInfo
Expression *Type::getTypeInfo(Scope *sc)
{
genTypeInfo(sc);
Expression *e = VarExp::create(Loc(), vtinfo);
e = e->addressOf(sc);
e->type = vtinfo->type; // do this so we don't get redundant dereference
return e;
}
示例2: TypeInfoDeclaration
Expression *Type::getTypeInfo(Scope *sc)
{
Declaration *ti = new TypeInfoDeclaration(this, 1);
Expression *e = new VarExp(Loc(), ti);
e = e->addressOf();
e->type = ti->type;
return e;
}
示例3: ErrorExp
Expression *Type::getTypeInfo(Scope *sc)
{
if(ty == Terror)
return new ErrorExp();
buildTypeInfo(sc, false);
Expression *e = new VarExp(Loc(), vtinfo);
e = e->addressOf(sc);
e->type = vtinfo->type; // do this so we don't get redundant dereference
return e;
}
示例4: if
Expression *Type::getTypeInfo(Scope *sc)
{
//printf("Type::getTypeInfo() %p, %s\n", this, toChars());
if (!Type::typeinfo)
{
error(0, "TypeInfo not found. object.d may be incorrectly installed or corrupt, compile with -v switch");
fatal();
}
Expression *e = 0;
Type *t = merge2(); // do this since not all Type's are merge'd
if (!t->vtinfo)
{
#if DMDV2
if (t->isShared())
t->vtinfo = new TypeInfoSharedDeclaration(t);
else if (t->isConst())
t->vtinfo = new TypeInfoConstDeclaration(t);
else if (t->isImmutable())
t->vtinfo = new TypeInfoInvariantDeclaration(t);
else if (t->isWild())
t->vtinfo = new TypeInfoWildDeclaration(t);
else
#endif
t->vtinfo = t->getTypeInfoDeclaration();
assert(t->vtinfo);
/* If this has a custom implementation in std/typeinfo, then
* do not generate a COMDAT for it.
*/
if (!t->builtinTypeInfo())
{ // Generate COMDAT
if (sc) // if in semantic() pass
{ // Find module that will go all the way to an object file
Module *m = sc->module->importedFrom;
m->members->push(t->vtinfo);
}
else // if in obj generation pass
{
#if IN_DMD
t->vtinfo->toObjFile(0); // TODO: multiobj
#else
t->vtinfo->codegen(sir);
#endif
}
}
}
e = new VarExp(0, t->vtinfo);
e = e->addressOf(sc);
e->type = t->vtinfo->type; // do this so we don't get redundant dereference
return e;
}
示例5: toBasetype
Expression *Type::getInternalTypeInfo(Scope *sc)
{ TypeInfoDeclaration *tid;
Expression *e;
Type *t;
static TypeInfoDeclaration *internalTI[TMAX];
//printf("Type::getInternalTypeInfo() %s\n", toChars());
t = toBasetype();
switch (t->ty)
{
case Tsarray:
#if 0
// convert to corresponding dynamic array type
t = t->nextOf()->mutableOf()->arrayOf();
#endif
break;
case Tclass:
if (static_cast<TypeClass *>(t)->sym->isInterfaceDeclaration())
break;
goto Linternal;
case Tarray:
#if DMDV2
// convert to corresponding dynamic array type
t = t->nextOf()->mutableOf()->arrayOf();
#endif
if (t->nextOf()->ty != Tclass)
break;
goto Linternal;
case Tfunction:
case Tdelegate:
case Tpointer:
Linternal:
tid = internalTI[t->ty];
if (!tid)
{ tid = new TypeInfoDeclaration(t, 1);
internalTI[t->ty] = tid;
}
e = new VarExp(0, tid);
e = e->addressOf(sc);
e->type = tid->type; // do this so we don't get redundant dereference
return e;
default:
break;
}
//printf("\tcalling getTypeInfo() %s\n", t->toChars());
return t->getTypeInfo(sc);
}
示例6: if
Expression *Type::getTypeInfo(Scope *sc)
{
Expression *e;
Type *t;
//printf("Type::getTypeInfo() %p, %s\n", this, toChars());
t = merge(); // do this since not all Type's are merge'd
if (!t->vtinfo)
{
if (t->isConst())
t->vtinfo = new TypeInfoConstDeclaration(t);
else if (t->isInvariant())
t->vtinfo = new TypeInfoInvariantDeclaration(t);
else
t->vtinfo = t->getTypeInfoDeclaration();
assert(t->vtinfo);
/* If this has a custom implementation in std/typeinfo, then
* do not generate a COMDAT for it.
*/
if (!t->builtinTypeInfo())
{ // Generate COMDAT
if (sc) // if in semantic() pass
{ // Find module that will go all the way to an object file
Module *m = sc->module->importedFrom;
m->members->push(t->vtinfo);
}
else // if in obj generation pass
{
t->vtinfo->toObjFile();
}
}
}
e = new VarExp(0, t->vtinfo);
e = e->addressOf(sc);
e->type = t->vtinfo->type; // do this so we don't get redundant dereference
return e;
}
示例7: if
Expression *Type::getTypeInfo(Scope *sc)
{
//printf("Type::getTypeInfo() %p, %s\n", this, toChars());
if (!Type::dtypeinfo)
{
error(Loc(), "TypeInfo not found. object.d may be incorrectly installed or corrupt, compile with -v switch");
fatal();
}
Type *t = merge2(); // do this since not all Type's are merge'd
if (!t->vtinfo)
{
#if DMDV2
if (t->isShared()) // does both 'shared' and 'shared const'
t->vtinfo = new TypeInfoSharedDeclaration(t);
else if (t->isConst())
t->vtinfo = new TypeInfoConstDeclaration(t);
else if (t->isImmutable())
t->vtinfo = new TypeInfoInvariantDeclaration(t);
else if (t->isWild())
t->vtinfo = new TypeInfoWildDeclaration(t);
else
#endif
t->vtinfo = t->getTypeInfoDeclaration();
assert(t->vtinfo);
vtinfo = t->vtinfo;
/* If this has a custom implementation in std/typeinfo, then
* do not generate a COMDAT for it.
*/
if (!t->builtinTypeInfo())
{
// Generate COMDAT
if (sc) // if in semantic() pass
{
// Find module that will go all the way to an object file
Module *m = sc->module->importedFrom;
m->members->push(t->vtinfo);
if (ty == Tstruct)
{
Dsymbol *s;
StructDeclaration *sd = ((TypeStruct *)this)->sym;
if ((sd->xeq && sd->xeq != sd->xerreq ||
sd->xcmp && sd->xcmp != sd->xerrcmp ||
search_toHash(sd) ||
search_toString(sd)
) && inNonRoot(sd))
{
//printf("deferred sem3 for TypeInfo - sd = %s, inNonRoot = %d\n", sd->toChars(), inNonRoot(sd));
Module::addDeferredSemantic3(sd);
}
}
}
else // if in obj generation pass
{
t->vtinfo->toObjFile(global.params.multiobj);
}
}
}
if (!vtinfo)
vtinfo = t->vtinfo; // Types aren't merged, but we can share the vtinfo's
Expression *e = new VarExp(Loc(), t->vtinfo);
e = e->addressOf(sc);
e->type = t->vtinfo->type; // do this so we don't get redundant dereference
return e;
}