本文整理汇总了C++中Loc函数的典型用法代码示例。如果您正苦于以下问题:C++ Loc函数的具体用法?C++ Loc怎么用?C++ Loc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Loc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addMipsABI
/// Sanitizes the MIPS ABI in the feature string.
static void addMipsABI(const llvm::Triple &triple, std::vector<std::string> &attrs)
{
enum ABI { O32 = 1<<0, N32 = 1<<1, N64 = 1<<2, EABI = 1<<3 };
const bool is64Bit = triple.getArch() == llvm::Triple::mips64 ||
triple.getArch() == llvm::Triple::mips64el;
const uint32_t defaultABI = is64Bit ? N64 : O32;
uint32_t bits = defaultABI;
std::vector<std::string>::iterator I = attrs.begin();
while (I != attrs.end())
{
std::string str = *I;
bool enabled = str[0] == '+';
std::string flag = (str[0] == '+' || str[0] == '-') ? str.substr(1) : str;
uint32_t newBit = 0;
if (flag == "o32") newBit = O32;
if (flag == "n32") newBit = N32;
if (flag == "n64") newBit = N64;
if (flag == "eabi") newBit = EABI;
if (newBit)
{
I = attrs.erase(I);
if (enabled) bits |= newBit;
else bits &= ~newBit;
}
else
++I;
}
switch (bits)
{
case O32: attrs.push_back("+o32"); break;
case N32: attrs.push_back("+n32"); break;
case N64: attrs.push_back("+n64"); break;
case EABI: attrs.push_back("+eabi"); break;
default: error(Loc(), "Only one ABI argument is supported"); fatal();
}
if (bits != defaultABI)
attrs.push_back(is64Bit ? "-n64" : "-o32");
}
示例2: Objects
void AggregateDeclaration::generateTypeInfoData(Scope *sc)
{
if (!getRTInfo && Type::rtinfo &&
(!isDeprecated() || global.params.useDeprecated) && // don't do it for unused deprecated types
(type && type->ty != Terror)) // or error types
{ // Evaluate: gcinfo!type
Objects *tiargs = new Objects();
tiargs->push(type);
TemplateInstance *ti = new TemplateInstance(loc, Type::rtinfo, tiargs);
ti->semantic(sc);
ti->semantic2(sc);
ti->semantic3(sc);
Dsymbol *s = ti->toAlias();
Expression *e = new DsymbolExp(Loc(), s, 0);
Scope *sc2 = ti->tempdecl->scope->startCTFE();
sc2->instantiatingModule = sc->instantiatingModule ? sc->instantiatingModule : sc->module;
e = e->semantic(sc2);
sc2->endCTFE();
e = e->ctfeInterpret();
getRTInfo = e;
}
}
示例3: Loc
bool UWorld::IsTraceHandleValid(const FTraceHandle& Handle, bool bOverlapTrace)
{
// only valid if it's previous frame or current frame
if (Handle._Data.FrameNumber != AsyncTraceState.CurrentFrame - 1 && Handle._Data.FrameNumber != AsyncTraceState.CurrentFrame)
{
return false;
}
// make sure it has valid index
AsyncTraceData& DataBuffer = AsyncTraceState.GetBufferForFrame(Handle._Data.FrameNumber);
// this function basically verifies if the address location
// is VALID, not necessarily that location was USED in that frame
FBufferIndexPair Loc(Handle._Data.Index);
if (bOverlapTrace)
{
return !!Loc.DatumLookup(DataBuffer.OverlapData);
}
else
{
return !!Loc.DatumLookup(DataBuffer.TraceData);
}
}
示例4:
Dsymbol *search_function(ScopeDsymbol *ad, Identifier *funcid)
{
Dsymbol *s;
FuncDeclaration *fd;
TemplateDeclaration *td;
s = ad->search(Loc(), funcid, 0);
if (s)
{ Dsymbol *s2;
//printf("search_function: s = '%s'\n", s->kind());
s2 = s->toAlias();
//printf("search_function: s2 = '%s'\n", s2->kind());
fd = s2->isFuncDeclaration();
if (fd && fd->type->ty == Tfunction)
return fd;
td = s2->isTemplateDeclaration();
if (td)
return td;
}
return NULL;
}
示例5: getProgram
std::string getProgram(const char *name, const llvm::cl::opt<std::string> *opt,
const char *envVar) {
std::string path;
const char *prog = nullptr;
if (opt && !opt->empty()) {
path = findProgramByName(opt->c_str());
}
if (path.empty() && envVar && (prog = getenv(envVar)) && prog[0] != '\0') {
path = findProgramByName(prog);
}
if (path.empty()) {
path = findProgramByName(name);
}
if (path.empty()) {
error(Loc(), "failed to locate %s", name);
fatal();
}
return path;
}
示例6: Objects
void AggregateDeclaration::semantic3(Scope *sc)
{
//printf("AggregateDeclaration::semantic3(%s)\n", toChars());
if (members)
{
sc = sc->push(this);
sc->parent = this;
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *s = (*members)[i];
s->semantic3(sc);
}
sc = sc->pop();
if (!getRTInfo && Type::rtinfo &&
(!isDeprecated() || global.params.useDeprecated) && // don't do it for unused deprecated types
(type && type->ty != Terror)) // or error types
{ // Evaluate: gcinfo!type
Objects *tiargs = new Objects();
tiargs->push(type);
TemplateInstance *ti = new TemplateInstance(loc, Type::rtinfo, tiargs);
ti->semantic(sc);
ti->semantic2(sc);
ti->semantic3(sc);
Dsymbol *s = ti->toAlias();
Expression *e = new DsymbolExp(Loc(), s, 0);
Scope *sc = ti->tempdecl->scope->startCTFE();
e = e->semantic(sc);
sc->endCTFE();
e = e->ctfeInterpret();
getRTInfo = e;
}
}
}
示例7: assert
Symbol *VarDeclaration::toSymbol()
{
//printf("VarDeclaration::toSymbol(%s)\n", toChars());
//if (needThis()) *(char*)0=0;
assert(!needThis());
if (!csym)
{
TYPE *t;
const char *id;
if (isDataseg())
id = mangle();
else
id = ident->toChars();
Symbol *s = symbol_calloc(id);
s->Salignment = alignment;
if (storage_class & (STCout | STCref))
{
// should be TYref, but problems in back end
t = type_pointer(type->toCtype());
}
else if (storage_class & STClazy)
{
if (config.exe == EX_WIN64 && isParameter())
t = type_fake(TYnptr);
else
t = type_fake(TYdelegate); // Tdelegate as C type
t->Tcount++;
}
else if (isParameter())
{
if (config.exe == EX_WIN64 && type->size(Loc()) > REGSIZE)
{
// should be TYref, but problems in back end
t = type_pointer(type->toCtype());
}
else
{
t = type->toCParamtype();
t->Tcount++;
}
}
else
{
t = type->toCtype();
t->Tcount++;
}
if (isDataseg())
{
if (isThreadlocal())
{ /* Thread local storage
*/
TYPE *ts = t;
ts->Tcount++; // make sure a different t is allocated
type_setty(&t, t->Tty | mTYthread);
ts->Tcount--;
if (global.params.vtls)
{
char *p = loc.toChars();
fprintf(stderr, "%s: %s is thread local\n", p ? p : "", toChars());
if (p)
mem.free(p);
}
}
s->Sclass = SCextern;
s->Sfl = FLextern;
slist_add(s);
/* if it's global or static, then it needs to have a qualified but unmangled name.
* This gives some explanation of the separation in treating name mangling.
* It applies to PDB format, but should apply to CV as PDB derives from CV.
* http://msdn.microsoft.com/en-us/library/ff553493(VS.85).aspx
*/
s->prettyIdent = toPrettyChars();
}
else
{
s->Sclass = SCauto;
s->Sfl = FLauto;
if (nestedrefs.dim)
{
/* Symbol is accessed by a nested function. Make sure
* it is not put in a register, and that the optimizer
* assumes it is modified across function calls and pointer
* dereferences.
*/
//printf("\tnested ref, not register\n");
type_setcv(&t, t->Tty | mTYvolatile);
}
}
if (ident == Id::va_argsave)
/* __va_argsave is set outside of the realm of the optimizer,
* so we tell the optimizer to leave it alone
*/
type_setcv(&t, t->Tty | mTYvolatile);
//.........这里部分代码省略.........
示例8: error
TypeInfoDeclaration *Type::buildTypeInfo(Scope *sc, bool checkNeedSemantic)
{
if (vtinfo)
return vtinfo;
if (sc && checkNeedSemantic && !typeInfoNeedsSemantic())
return 0;
//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 (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
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->ty == Terror)
vtinfo->errors = 1;
else 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(m->semanticRun >= 3)
{
Module::addDeferredSemantic3(t->vtinfo);
t->vtinfo->deferredScope = sc;
sc->setNoFree();
}
if (ty == Tstruct)
{
Dsymbol *s;
StructDeclaration *sd = ((TypeStruct *)this)->sym;
if (sd->members &&
(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
{
// it is always a problem if this is called from the backend without
// being added to the AST for semantic analysis (no RTInfo generated)
// to ease transition, modifier types are just put out as they just forward
// to the actual TypeInfo
if (t->typeInfoNeedsSemantic())
error(Loc(), "ICE: unexpected type info request for %s", t->toChars());
t->vtinfo->toObjFile(global.params.multiobj);
}
}
}
if (!vtinfo)
vtinfo = t->vtinfo; // Types aren't merged, but we can share the vtinfo's
return vtinfo;
}
示例9: checkPredefined
void VersionCondition::addGlobalIdent(const char *ident)
{
checkPredefined(Loc(), ident);
addPredefinedGlobalIdent(ident);
}
示例10: FuncDeclaration_toObjFile
//.........这里部分代码省略.........
{
localgot = NULL;
Statement *sbody = fd->fbody;
Blockx bx;
memset(&bx,0,sizeof(bx));
bx.startblock = block_calloc();
bx.curblock = bx.startblock;
bx.funcsym = s;
bx.scope_index = -1;
bx.classdec = cd;
bx.member = fd;
bx.module = fd->getModule();
irs.blx = &bx;
/* Doing this in semantic3() caused all kinds of problems:
* 1. couldn't reliably get the final mangling of the function name due to fwd refs
* 2. impact on function inlining
* 3. what to do when writing out .di files, or other pretty printing
*/
if (global.params.trace && !fd->isCMain())
{
/* The profiler requires TLS, and TLS may not be set up yet when C main()
* gets control (i.e. OSX), leading to a crash.
*/
/* Wrap the entire function body in:
* trace_pro("funcname");
* try
* body;
* finally
* _c_trace_epi();
*/
StringExp *se = StringExp::create(Loc(), s->Sident);
se->type = Type::tstring;
se->type = se->type->semantic(Loc(), NULL);
Expressions *exps = Expressions_create();
exps->push(se);
FuncDeclaration *fdpro = FuncDeclaration::genCfunc(NULL, Type::tvoid, "trace_pro");
Expression *ec = VarExp::create(Loc(), fdpro);
Expression *e = CallExp::create(Loc(), ec, exps);
e->type = Type::tvoid;
Statement *sp = ExpStatement::create(fd->loc, e);
FuncDeclaration *fdepi = FuncDeclaration::genCfunc(NULL, Type::tvoid, "_c_trace_epi");
ec = VarExp::create(Loc(), fdepi);
e = CallExp::create(Loc(), ec);
e->type = Type::tvoid;
Statement *sf = ExpStatement::create(fd->loc, e);
Statement *stf;
if (sbody->blockExit(fd, false) == BEfallthru)
stf = CompoundStatement::create(Loc(), sbody, sf);
else
stf = TryFinallyStatement::create(Loc(), sbody, sf);
sbody = CompoundStatement::create(Loc(), sp, stf);
}
buildClosure(fd, &irs);
#if TARGET_WINDOS
if (fd->isSynchronized() && cd && config.flags2 & CFG2seh &&
!fd->isStatic() && !sbody->usesEH() && !global.params.trace)
{
/* The "jmonitor" hack uses an optimized exception handling frame
* which is a little shorter than the more general EH frame.
示例11: runLINK
int runLINK()
{
#if _WIN32
if (global.params.is64bit)
{
OutBuffer cmdbuf;
cmdbuf.writestring("/NOLOGO ");
for (size_t i = 0; i < global.params.objfiles->dim; i++)
{
if (i)
cmdbuf.writeByte(' ');
const char *p = (*global.params.objfiles)[i];
const char *basename = FileName::removeExt(FileName::name(p));
const char *ext = FileName::ext(p);
if (ext && !strchr(basename, '.'))
{
// Write name sans extension (but not if a double extension)
writeFilename(&cmdbuf, p, ext - p - 1);
}
else
writeFilename(&cmdbuf, p);
FileName::free(basename);
}
if (global.params.resfile)
{
cmdbuf.writeByte(' ');
writeFilename(&cmdbuf, global.params.resfile);
}
cmdbuf.writeByte(' ');
if (global.params.exefile)
{ cmdbuf.writestring("/OUT:");
writeFilename(&cmdbuf, global.params.exefile);
}
else
{ /* Generate exe file name from first obj name.
* No need to add it to cmdbuf because the linker will default to it.
*/
const char *n = (*global.params.objfiles)[0];
n = FileName::name(n);
global.params.exefile = (char *)FileName::forceExt(n, "exe");
}
// Make sure path to exe file exists
ensurePathToNameExists(Loc(), global.params.exefile);
cmdbuf.writeByte(' ');
if (global.params.mapfile)
{ cmdbuf.writestring("/MAP:");
writeFilename(&cmdbuf, global.params.mapfile);
}
else if (global.params.map)
{
const char *fn = FileName::forceExt(global.params.exefile, "map");
const char *path = FileName::path(global.params.exefile);
const char *p;
if (path[0] == '\0')
p = FileName::combine(global.params.objdir, fn);
else
p = fn;
cmdbuf.writestring("/MAP:");
writeFilename(&cmdbuf, p);
}
for (size_t i = 0; i < global.params.libfiles->dim; i++)
{
cmdbuf.writeByte(' ');
cmdbuf.writestring("/DEFAULTLIB:");
writeFilename(&cmdbuf, (*global.params.libfiles)[i]);
}
if (global.params.deffile)
{
cmdbuf.writeByte(' ');
cmdbuf.writestring("/DEF:");
writeFilename(&cmdbuf, global.params.deffile);
}
if (global.params.symdebug)
{
cmdbuf.writeByte(' ');
cmdbuf.writestring("/DEBUG");
// in release mode we need to reactivate /OPT:REF after /DEBUG
if (global.params.release)
cmdbuf.writestring(" /OPT:REF");
}
if (global.params.dll)
{
cmdbuf.writeByte(' ');
cmdbuf.writestring("/DLL");
}
for (size_t i = 0; i < global.params.linkswitches->dim; i++)
//.........这里部分代码省略.........
示例12: Parameters
FuncDeclaration *buildArrayOp(Identifier *ident, BinExp *exp, Scope *sc)
{
Parameters *fparams = new Parameters();
Expression *loopbody = buildArrayLoop(exp, fparams);
/* Construct the function body:
* foreach (i; 0 .. p.length) for (size_t i = 0; i < p.length; i++)
* loopbody;
* return p;
*/
Parameter *p = (*fparams)[0];
// foreach (i; 0 .. p.length)
Statement *s1 = new ForeachRangeStatement(Loc(), TOKforeach,
new Parameter(0, NULL, Id::p, NULL),
new IntegerExp(Loc(), 0, Type::tsize_t),
new ArrayLengthExp(Loc(), new IdentifierExp(Loc(), p->ident)),
new ExpStatement(Loc(), loopbody),
Loc());
//printf("%s\n", s1->toChars());
Statement *s2 = new ReturnStatement(Loc(), new IdentifierExp(Loc(), p->ident));
//printf("s2: %s\n", s2->toChars());
Statement *fbody = new CompoundStatement(Loc(), s1, s2);
// Built-in array ops should be @trusted, pure, nothrow and nogc
StorageClass stc = STCtrusted | STCpure | STCnothrow | STCnogc;
/* Construct the function
*/
TypeFunction *ftype = new TypeFunction(fparams, exp->e1->type, 0, LINKc, stc);
//printf("fd: %s %s\n", ident->toChars(), ftype->toChars());
FuncDeclaration *fd = new FuncDeclaration(Loc(), Loc(), ident, STCundefined, ftype);
fd->fbody = fbody;
fd->protection = Prot(PROTpublic);
fd->linkage = LINKc;
fd->isArrayOp = 1;
sc->_module->importedFrom->members->push(fd);
sc = sc->push();
sc->parent = sc->_module->importedFrom;
sc->stc = 0;
sc->linkage = LINKc;
fd->semantic(sc);
fd->semantic2(sc);
unsigned errors = global.startGagging();
fd->semantic3(sc);
if (global.endGagging(errors))
{
fd->type = Type::terror;
fd->errors = true;
fd->fbody = NULL;
}
sc->pop();
return fd;
}
示例13: Loc
/*****************************************
* Create inclusive destructor for struct/class by aggregating
* all the destructors in dtors[] with the destructors for
* all the members.
* Note the close similarity with StructDeclaration::buildPostBlit(),
* and the ordering changes (runs backward instead of forwards).
*/
FuncDeclaration *buildDtor(AggregateDeclaration *ad, Scope *sc)
{
//printf("AggregateDeclaration::buildDtor() %s\n", ad->toChars());
StorageClass stc = STCsafe | STCnothrow | STCpure | STCnogc;
Loc declLoc = ad->dtors.dim ? ad->dtors[0]->loc : ad->loc;
Loc loc = Loc(); // internal code should have no loc to prevent coverage
Expression *e = NULL;
for (size_t i = 0; i < ad->fields.dim; i++)
{
VarDeclaration *v = ad->fields[i];
if (v->storage_class & STCref)
continue;
Type *tv = v->type->baseElemOf();
if (tv->ty != Tstruct || !v->type->size())
continue;
StructDeclaration *sdv = ((TypeStruct *)tv)->sym;
if (!sdv->dtor)
continue;
sdv->dtor->functionSemantic();
stc = mergeFuncAttrs(stc, sdv->dtor);
if (stc & STCdisable)
{
e = NULL;
break;
}
Expression *ex = new ThisExp(loc);
ex = new DotVarExp(loc, ex, v, 0);
if (v->type->toBasetype()->ty == Tstruct)
{
// this.v.__xdtor()
// This is a hack so we can call destructors on const/immutable objects.
ex = new AddrExp(loc, ex);
ex = new CastExp(loc, ex, v->type->mutableOf()->pointerTo());
ex = new PtrExp(loc, ex);
if (stc & STCsafe)
stc = (stc & ~STCsafe) | STCtrusted;
ex = new DotVarExp(loc, ex, sdv->dtor, 0);
ex = new CallExp(loc, ex);
}
else
{
// _ArrayDtor((cast(S*)this.v.ptr)[0 .. n])
// This is a hack so we can call destructors on const/immutable objects.
ex = new DotIdExp(loc, ex, Id::ptr);
ex = new CastExp(loc, ex, sdv->type->pointerTo());
if (stc & STCsafe)
stc = (stc & ~STCsafe) | STCtrusted;
uinteger_t n = v->type->size() / sdv->type->size();
ex = new SliceExp(loc, ex, new IntegerExp(loc, 0, Type::tsize_t),
new IntegerExp(loc, n, Type::tsize_t));
// Prevent redundant bounds check
((SliceExp *)ex)->upperIsInBounds = true;
((SliceExp *)ex)->lowerIsLessThanUpper = true;
ex = new CallExp(loc, new IdentifierExp(loc, Id::_ArrayDtor), ex);
}
e = Expression::combine(ex, e); // combine in reverse order
}
/* Build our own "destructor" which executes e
*/
if (e || (stc & STCdisable))
{
//printf("Building __fieldDtor()\n");
DtorDeclaration *dd = new DtorDeclaration(declLoc, Loc(), stc, Id::__fieldDtor);
dd->storage_class |= STCinference;
dd->fbody = new ExpStatement(loc, e);
ad->dtors.shift(dd);
ad->members->push(dd);
dd->semantic(sc);
}
FuncDeclaration *xdtor = NULL;
switch (ad->dtors.dim)
{
case 0:
break;
case 1:
xdtor = ad->dtors[0];
break;
default:
e = NULL;
stc = STCsafe | STCnothrow | STCpure | STCnogc;
for (size_t i = 0; i < ad->dtors.dim; i++)
//.........这里部分代码省略.........
示例14: Parameter
/******************************************
* Build __xopCmp for TypeInfo_Struct
* static bool __xopCmp(ref const S p, ref const S q)
* {
* return p.opCmp(q);
* }
*
* This is called by TypeInfo.compare(p1, p2). If the struct does not support
* const objects comparison, it will throw "not implemented" Error in runtime.
*/
FuncDeclaration *buildXopCmp(StructDeclaration *sd, Scope *sc)
{
//printf("StructDeclaration::buildXopCmp() %s\n", toChars());
if (Dsymbol *cmp = search_function(sd, Id::cmp))
{
if (FuncDeclaration *fd = cmp->isFuncDeclaration())
{
TypeFunction *tfcmpptr;
{
Scope scx;
/* const int opCmp(ref const S s);
*/
Parameters *parameters = new Parameters;
parameters->push(new Parameter(STCref | STCconst, sd->type, NULL, NULL));
tfcmpptr = new TypeFunction(parameters, Type::tint32, 0, LINKd);
tfcmpptr->mod = MODconst;
tfcmpptr = (TypeFunction *)tfcmpptr->semantic(Loc(), &scx);
}
fd = fd->overloadExactMatch(tfcmpptr);
if (fd)
return fd;
}
}
else
{
#if 0 // FIXME: doesn't work for recursive alias this
/* Check opCmp member exists.
* Consider 'alias this', but except opDispatch.
*/
Expression *e = new DsymbolExp(sd->loc, sd);
e = new DotIdExp(sd->loc, e, Id::cmp);
Scope *sc2 = sc->push();
e = e->trySemantic(sc2);
sc2->pop();
if (e)
{
Dsymbol *s = NULL;
switch (e->op)
{
case TOKoverloadset: s = ((OverExp *)e)->vars; break;
case TOKimport: s = ((ScopeExp *)e)->sds; break;
case TOKvar: s = ((VarExp *)e)->var; break;
default: break;
}
if (!s || s->ident != Id::cmp)
e = NULL; // there's no valid member 'opCmp'
}
if (!e)
return NULL; // bitwise comparison would work
/* Essentially, a struct which does not define opCmp is not comparable.
* At this time, typeid(S).compare might be correct that throwing "not implement" Error.
* But implementing it would break existing code, such as:
*
* struct S { int value; } // no opCmp
* int[S] aa; // Currently AA key uses bitwise comparison
* // (It's default behavior of TypeInfo_Strust.compare).
*
* Not sure we should fix this inconsistency, so just keep current behavior.
*/
#else
return NULL;
#endif
}
if (!sd->xerrcmp)
{
// object._xopCmp
Identifier *id = Identifier::idPool("_xopCmp");
Expression *e = new IdentifierExp(sd->loc, Id::empty);
e = new DotIdExp(sd->loc, e, Id::object);
e = new DotIdExp(sd->loc, e, id);
e = e->semantic(sc);
Dsymbol *s = getDsymbol(e);
assert(s);
sd->xerrcmp = s->isFuncDeclaration();
}
Loc declLoc = Loc(); // loc is unnecessary so __xopCmp is never called directly
Loc loc = Loc(); // loc is unnecessary so errors are gagged
Parameters *parameters = new Parameters;
parameters->push(new Parameter(STCref | STCconst, sd->type, Id::p, NULL));
parameters->push(new Parameter(STCref | STCconst, sd->type, Id::q, NULL));
TypeFunction *tf = new TypeFunction(parameters, Type::tint32, 0, LINKd);
Identifier *id = Id::xopCmp;
FuncDeclaration *fop = new FuncDeclaration(declLoc, Loc(), id, STCstatic, tf);
Expression *e1 = new IdentifierExp(loc, Id::p);
//.........这里部分代码省略.........
示例15: FistMove
void FistMove (PointingEvent *e)
{ if (IsHeeding (e))
IncTranslation (6.0 * FistMotion (e, Loc ()));
}