mirror of
https://github.com/dlang/dmd.git
synced 2025-04-25 20:50:41 +03:00
Move ClassDeclaration.vtblSymbol to dsymbolsem (#20956)
This commit is contained in:
parent
57e7419c4d
commit
325ef115e8
7 changed files with 24 additions and 18 deletions
|
@ -47,6 +47,7 @@ namespace dmd
|
|||
void semanticTypeInfoMembers(StructDeclaration *sd);
|
||||
bool fill(StructDeclaration* sd, Loc loc, Expressions &elements, bool ctorinit);
|
||||
bool isFuncHidden(ClassDeclaration* cd, FuncDeclaration* fd);
|
||||
Dsymbol* vtblSymbol(ClassDeclaration *cd);
|
||||
}
|
||||
|
||||
enum class ClassKind : uint8_t
|
||||
|
@ -300,7 +301,6 @@ public:
|
|||
|
||||
// Back end
|
||||
Dsymbol *vtblsym;
|
||||
Dsymbol *vtblSymbol();
|
||||
|
||||
void accept(Visitor *v) override { v->visit(this); }
|
||||
};
|
||||
|
|
|
@ -185,6 +185,12 @@ bool isFuncHidden(ClassDeclaration cd, FuncDeclaration fd)
|
|||
return dmd.dsymbolsem.isFuncHidden(cd, fd);
|
||||
}
|
||||
|
||||
Dsymbol vtblSymbol(ClassDeclaration cd)
|
||||
{
|
||||
import dmd.dsymbolsem;
|
||||
return dmd.dsymbolsem.vtblSymbol(cd);
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
* dtemplate.d
|
||||
*/
|
||||
|
|
|
@ -888,21 +888,6 @@ extern (C++) class ClassDeclaration : AggregateDeclaration
|
|||
// Back end
|
||||
Dsymbol vtblsym;
|
||||
|
||||
final Dsymbol vtblSymbol()
|
||||
{
|
||||
if (!vtblsym)
|
||||
{
|
||||
auto vtype = Type.tvoidptr.immutableOf().sarrayOf(vtbl.length);
|
||||
auto var = new VarDeclaration(loc, vtype, Identifier.idPool("__vtbl"), null, STC.immutable_ | STC.static_);
|
||||
var.addMember(null, this);
|
||||
var.isdataseg = 1;
|
||||
var._linkage = LINK.d;
|
||||
var.semanticRun = PASS.semanticdone; // no more semantic wanted
|
||||
vtblsym = var;
|
||||
}
|
||||
return vtblsym;
|
||||
}
|
||||
|
||||
extern (D) final bool isErrorException()
|
||||
{
|
||||
return errorException && (this == errorException || errorException.isBaseOf(this, null));
|
||||
|
|
|
@ -8195,3 +8195,18 @@ extern(C++) bool isFuncHidden(ClassDeclaration cd, FuncDeclaration fd)
|
|||
return !fd.parent.isTemplateMixin();
|
||||
}
|
||||
}
|
||||
|
||||
Dsymbol vtblSymbol(ClassDeclaration cd)
|
||||
{
|
||||
if (!cd.vtblsym)
|
||||
{
|
||||
auto vtype = Type.tvoidptr.immutableOf().sarrayOf(cd.vtbl.length);
|
||||
auto var = new VarDeclaration(cd.loc, vtype, Identifier.idPool("__vtbl"), null, STC.immutable_ | STC.static_);
|
||||
var.addMember(null, cd);
|
||||
var.isdataseg = 1;
|
||||
var._linkage = LINK.d;
|
||||
var.semanticRun = PASS.semanticdone; // no more semantic wanted
|
||||
cd.vtblsym = var;
|
||||
}
|
||||
return cd.vtblsym;
|
||||
}
|
||||
|
|
|
@ -6689,7 +6689,6 @@ public:
|
|||
const char* kind() const override;
|
||||
void addObjcSymbols(Array<ClassDeclaration* >* classes, Array<ClassDeclaration* >* categories) final override;
|
||||
Dsymbol* vtblsym;
|
||||
Dsymbol* vtblSymbol();
|
||||
void accept(Visitor* v) override;
|
||||
};
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import dmd.dmdparams;
|
|||
import dmd.dmodule;
|
||||
import dmd.dstruct;
|
||||
import dmd.dsymbol;
|
||||
import dmd.dsymbolsem : vtblSymbol;
|
||||
import dmd.dtemplate;
|
||||
import dmd.e2ir;
|
||||
import dmd.errors;
|
||||
|
|
|
@ -1342,7 +1342,7 @@ public:
|
|||
}
|
||||
}
|
||||
(void)d->csym;
|
||||
(void)d->vtblSymbol()->csym;
|
||||
(void)dmd::vtblSymbol(d)->csym;
|
||||
(void)d->sinit;
|
||||
NewExp *ne = NewExp::create(d->loc, NULL, NULL, d->type, NULL);
|
||||
ne->type = d->type;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue