本文整理汇总了C++中Dsymbol::isModule方法的典型用法代码示例。如果您正苦于以下问题:C++ Dsymbol::isModule方法的具体用法?C++ Dsymbol::isModule怎么用?C++ Dsymbol::isModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dsymbol
的用法示例。
在下文中一共展示了Dsymbol::isModule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mangle_variable
void mangle_variable(VarDeclaration *d, bool is_temp_arg_ref)
{
if (!(d->storage_class & (STCextern | STCgshared)))
{
d->error("ICE: C++ static non- __gshared non-extern variables not supported");
assert(0);
}
Dsymbol *p = d->toParent();
if (p && !p->isModule()) //for example: char Namespace1::beta[6] should be mangled as "_ZN10Namespace14betaE"
{
buf.writestring(global.params.isOSX ? "__ZN" : "_ZN"); // "__Z" for OSX, "_Z" for other
prefix_name(p);
source_name(d);
buf.writeByte('E');
}
else //char beta[6] should mangle as "beta"
{
if (!is_temp_arg_ref)
{
if (global.params.isOSX)
buf.writeByte('_');
buf.writestring(d->ident->toChars());
}
else
{
buf.writestring(global.params.isOSX ? "__Z" : "_Z");
source_name(d);
}
}
}
示例2: getFuncTemplateDecl
Module *Dsymbol::getAccessModule()
{
//printf("Dsymbol::getAccessModule()\n");
TemplateDeclaration *td = getFuncTemplateDecl(this);
if (td)
return td->getAccessModule();
Dsymbol *s = this;
while (s)
{
//printf("\ts = %s '%s'\n", s->kind(), s->toPrettyChars());
Module *m = s->isModule();
if (m)
return m;
TemplateInstance *ti = s->isTemplateInstance();
if (ti && ti->enclosing)
/* Because of local template instantiation, the parent isn't where the access
* rights come from - it's the template declaration
*/
s = ti->tempdecl;
else
s = s->parent;
}
return NULL;
}
示例3: prefix_name
void prefix_name(Dsymbol *s)
{
if (!substitute(s))
{
store(s);
Dsymbol *p = s->toParent();
if (p && p->isTemplateInstance())
{
s = p;
if (exist(p->isTemplateInstance()->tempdecl))
{
p = NULL;
}
else
{
p = p->toParent();
}
}
if (p && !p->isModule())
{
prefix_name(p);
}
source_name(s);
}
}
示例4: load
void Import::load(Scope *sc)
{
//printf("Import::load('%s')\n", toChars());
// See if existing module
DsymbolTable *dst = Package::resolve(packages, NULL, &pkg);
Dsymbol *s = dst->lookup(id);
if (s)
{
#if TARGET_NET
mod = (Module *)s;
#else
if (s->isModule())
mod = (Module *)s;
else
error("package and module have the same name");
#endif
}
if (!mod)
{
// Load module
mod = Module::load(loc, packages, id);
dst->insert(id, mod); // id may be different from mod->ident,
// if so then insert alias
if (!mod->importedFrom)
mod->importedFrom = sc ? sc->module->importedFrom : Module::rootModule;
}
if (!pkg)
pkg = mod;
//printf("-Import::load('%s'), pkg = %p\n", toChars(), pkg);
}
示例5: cpp_mangle_name
void cpp_mangle_name(OutBuffer *buf, CppMangleState *cms, Dsymbol *s)
{
Dsymbol *p = s->toParent();
if (p && !p->isModule())
{
buf->writeByte('N');
FuncDeclaration *fd = s->isFuncDeclaration();
VarDeclaration *vd = s->isVarDeclaration();
if (fd && fd->type->isConst())
{
buf->writeByte('K');
}
if (vd && !(vd->storage_class & (STCextern | STCgshared)))
{
s->error("C++ static non- __gshared non-extern variables not supported");
}
if (vd || fd)
{
prefix_name(buf, cms, p);
source_name(buf, s);
}
else
{
assert(0);
}
buf->writeByte('E');
}
else
source_name(buf, s);
}
示例6: load
void Import::load(Scope *sc)
{
//printf("Import::load('%s')\n", toChars());
// See if existing module
DsymbolTable *dst = Package::resolve(packages, NULL, &pkg);
#if TARGET_NET //dot net needs modules and packages with same name
#else
if (pkg && pkg->isModule())
{
::error(loc, "can only import from a module, not from a member of module %s. Did you mean `import %s : %s`?",
pkg->toChars(), pkg->toPrettyChars(), id->toChars());
mod = pkg->isModule(); // Error recovery - treat as import of that module
return;
}
#endif
Dsymbol *s = dst->lookup(id);
if (s)
{
#if TARGET_NET
mod = (Module *)s;
#else
if (s->isModule())
mod = (Module *)s;
else
{
if (pkg)
{
::error(loc, "can only import from a module, not from package %s.%s",
pkg->toPrettyChars(), id->toChars());
}
else
{
::error(loc, "can only import from a module, not from package %s",
id->toChars());
}
}
#endif
}
if (!mod)
{
// Load module
mod = Module::load(loc, packages, id);
if (mod)
{
dst->insert(id, mod); // id may be different from mod->ident,
// if so then insert alias
if (!mod->importedFrom)
mod->importedFrom = sc ? sc->module->importedFrom : Module::rootModule;
}
}
if (!pkg)
pkg = mod;
//printf("-Import::load('%s'), pkg = %p\n", toChars(), pkg);
}
示例7: prefix_name
void prefix_name(Dsymbol *s)
{
if (substitute(s))
return;
Dsymbol *p = s->toParent();
if (p && !p->isModule())
prefix_name(p);
source_name(s);
store(s);
}
示例8: prefix_name
void prefix_name(OutBuffer *buf, CppMangleState *cms, Dsymbol *s)
{
if (!cms->substitute(buf, s))
{
Dsymbol *p = s->toParent();
if (p && !p->isModule())
{
prefix_name(buf, cms, p);
}
source_name(buf, s);
}
}
示例9: Package
DsymbolTable *Package::resolve(Identifiers *packages, Dsymbol **pparent, Package **ppkg)
{
DsymbolTable *dst = Module::modules;
Dsymbol *parent = NULL;
//printf("Package::resolve()\n");
if (ppkg)
*ppkg = NULL;
if (packages)
{
for (size_t i = 0; i < packages->dim; i++)
{ Identifier *pid = packages->tdata()[i];
Dsymbol *p;
p = dst->lookup(pid);
if (!p)
{
p = new Package(pid);
dst->insert(p);
p->parent = parent;
((ScopeDsymbol *)p)->symtab = new DsymbolTable();
}
else
{
assert(p->isPackage());
// It might already be a module, not a package, but that needs
// to be checked at a higher level, where a nice error message
// can be generated.
// dot net needs modules and packages with same name
}
parent = p;
dst = ((Package *)p)->symtab;
if (ppkg && !*ppkg)
*ppkg = (Package *)p;
#if TARGET_NET
#else
if (p->isModule())
{ // Return the module so that a nice error message can be generated
if (ppkg)
*ppkg = (Package *)p;
break;
}
#endif
}
if (pparent)
{
*pparent = parent;
}
}
return dst;
}
示例10: Package
DsymbolTable *Package::resolve(Array *packages, Dsymbol **pparent, Package **ppkg)
{
DsymbolTable *dst = Module::modules;
Dsymbol *parent = NULL;
//printf("Package::resolve()\n");
if (ppkg)
*ppkg = NULL;
if (packages)
{ int i;
for (i = 0; i < packages->dim; i++)
{ Identifier *pid = (Identifier *)packages->data[i];
Dsymbol *p;
p = dst->lookup(pid);
if (!p)
{
p = new Package(pid);
dst->insert(p);
p->parent = parent;
((ScopeDsymbol *)p)->symtab = new DsymbolTable();
}
else
{
assert(p->isPackage());
#if TARGET_NET //dot net needs modules and packages with same name
#else
if (p->isModule())
{ p->error("module and package have the same name");
fatal();
break;
}
#endif
}
parent = p;
dst = ((Package *)p)->symtab;
if (ppkg && !*ppkg)
*ppkg = (Package *)p;
}
if (pparent)
{
*pparent = parent;
}
}
return dst;
}
示例11: while
Module *Dsymbol::getModule()
{
//printf("Dsymbol::getModule()\n");
if (TemplateInstance *ti = isInstantiated())
return ti->tempdecl->getModule();
Dsymbol *s = this;
while (s)
{
//printf("\ts = %s '%s'\n", s->kind(), s->toPrettyChars());
Module *m = s->isModule();
if (m)
return m;
s = s->parent;
}
return NULL;
}
示例12: while
Module *Dsymbol::getModule()
{
Module *m;
Dsymbol *s;
//printf("Dsymbol::getModule()\n");
s = this;
while (s)
{
//printf("\ts = '%s'\n", s->toChars());
m = s->isModule();
if (m)
return m;
s = s->parent;
}
return NULL;
}
示例13: isDataseg
int VarDeclaration::isDataseg()
{
#if 0
printf("VarDeclaration::isDataseg(%p, '%s')\n", this, toChars());
printf("%llx, %p, %p\n", storage_class & (STCstatic | STCconst), parent->isModule(), parent->isTemplateInstance());
printf("parent = '%s'\n", parent->toChars());
#endif
Dsymbol *parent = this->toParent();
if (!parent && !(storage_class & (STCstatic | STCconst)))
{ error("forward referenced");
type = Type::terror;
return 0;
}
return (storage_class & (STCstatic | STCconst) ||
parent->isModule() ||
parent->isTemplateInstance());
}
示例14: cpp_mangle_name
void cpp_mangle_name(OutBuffer *buf, CppMangleState *cms, Dsymbol *s)
{
Dsymbol *p = s->toParent();
if (p && !p->isModule())
{
buf->writeByte('N');
FuncDeclaration *fd = s->isFuncDeclaration();
if (fd->isConst())
buf->writeByte('K');
prefix_name(buf, cms, p);
source_name(buf, s);
buf->writeByte('E');
}
else
source_name(buf, s);
}
示例15: while
Module *Dsymbol::getCompilationModule()
{
Module *m;
TemplateInstance *ti;
Dsymbol *s;
//printf("Dsymbol::getModule()\n");
s = this;
while (s)
{
//printf("\ts = '%s'\n", s->toChars());
m = s->isModule();
if (m)
return m;
ti = s->isTemplateInstance();
if (ti && ti->tmodule)
return ti->tmodule;
s = s->parent;
}
return NULL;
}