Skip to content

Commit 8bce4f5

Browse files
authored
dmd: Remove all public C++ functions (dlang#21149)
These are all exposed under a dmd namespace (dlang#16155)
1 parent d48bdb8 commit 8bce4f5

File tree

6 files changed

+13
-27
lines changed

6 files changed

+13
-27
lines changed

compiler/src/dmd/dsymbol.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,4 @@ namespace dmd
428428
Dsymbols *include(Dsymbol *d, Scope *sc);
429429
void setScope(Dsymbol *d, Scope *sc);
430430
void importAll(Dsymbol *d, Scope *sc);
431-
void addComment(Dsymbol *d, const char *comment);
432-
bool oneMember(Dsymbol *d, Dsymbol *&ps, Identifier *ident);
433-
bool hasStaticCtorOrDtor(Dsymbol *d);
434431
}

compiler/src/dmd/dsymbolsem.d

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7531,7 +7531,7 @@ private extern(C++) class NewScopeVisitor : Visitor
75317531
}
75327532

75337533

7534-
extern(C++) Dsymbols* include(Dsymbol d, Scope* sc)
7534+
Dsymbols* include(Dsymbol d, Scope* sc)
75357535
{
75367536
scope icv = new ConditionIncludeVisitor(sc);
75377537
d.accept(icv);
@@ -7891,7 +7891,7 @@ Lfail:
78917891
return false;
78927892
}
78937893

7894-
extern (C++) void addComment(Dsymbol d, const(char)* comment)
7894+
void addComment(Dsymbol d, const(char)* comment)
78957895
{
78967896
scope v = new AddCommentVisitor(comment);
78977897
d.accept(v);
@@ -8108,7 +8108,7 @@ private extern(C++) class OneMemberVisitor : Visitor
81088108
* Return true if any of the members are static ctors or static dtors, or if
81098109
* any members have members that are.
81108110
*/
8111-
extern(C++) bool hasStaticCtorOrDtor(Dsymbol d)
8111+
bool hasStaticCtorOrDtor(Dsymbol d)
81128112
{
81138113
scope v = new HasStaticCtorOrDtor();
81148114
d.accept(v);
@@ -8162,7 +8162,7 @@ private extern(C++) class HasStaticCtorOrDtor : Visitor
81628162
}
81638163
}
81648164

8165-
extern(C++) bool isFuncHidden(ClassDeclaration cd, FuncDeclaration fd)
8165+
bool isFuncHidden(ClassDeclaration cd, FuncDeclaration fd)
81668166
{
81678167
import dmd.funcsem : overloadApply;
81688168
//printf("ClassDeclaration.isFuncHidden(class = %s, fd = %s)\n", toChars(), fd.toPrettyChars());
@@ -8211,7 +8211,7 @@ Dsymbol vtblSymbol(ClassDeclaration cd)
82118211
return cd.vtblsym;
82128212
}
82138213

8214-
extern(C++) bool isAbstract(ClassDeclaration cd)
8214+
bool isAbstract(ClassDeclaration cd)
82158215
{
82168216
enum log = false;
82178217
if (cd.isabstract != ThreeState.none)

compiler/src/dmd/expression.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ namespace dmd
5151
{
5252
// in expressionsem.d
5353
Expression *expressionSemantic(Expression *e, Scope *sc);
54-
void lowerNonArrayAggregate(StaticForeach *sfe, Scope *sc);
5554
// in typesem.d
5655
Expression *defaultInit(Type *mt, Loc loc, const bool isCfile = false);
5756

compiler/src/dmd/expressionsem.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17511,7 +17511,7 @@ bool fill(StructDeclaration sd, Loc loc, ref Expressions elements, bool ctorinit
1751117511
* sfe = The 'static foreach'.
1751217512
* sc = The current scope.
1751317513
*/
17514-
extern (C++) void lowerNonArrayAggregate(StaticForeach sfe, Scope* sc)
17514+
void lowerNonArrayAggregate(StaticForeach sfe, Scope* sc)
1751517515
{
1751617516
import dmd.statement;
1751717517

@@ -17726,7 +17726,7 @@ extern(D) void lowerArrayAggregate(StaticForeach sfe, Scope* sc)
1772617726
sfe.aggrfe.aggr = sfe.aggrfe.aggr.ctfeInterpret();
1772717727
}
1772817728

17729-
extern(C++) int include(Condition c, Scope* sc)
17729+
int include(Condition c, Scope* sc)
1773017730
{
1773117731
scope v = new IncludeVisitor(sc);
1773217732
c.accept(v);

compiler/src/dmd/frontend.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7532,8 +7532,6 @@ class ImportAllVisitor : public Visitor
75327532
void visit(StaticForeachDeclaration* _) override;
75337533
};
75347534

7535-
extern Array<Dsymbol* >* include(Dsymbol* d, Scope* sc);
7536-
75377535
class ConditionIncludeVisitor : public Visitor
75387536
{
75397537
public:
@@ -7547,8 +7545,6 @@ class ConditionIncludeVisitor : public Visitor
75477545
void visit(StaticForeachDeclaration* sfd) override;
75487546
};
75497547

7550-
extern void addComment(Dsymbol* d, const char* comment);
7551-
75527548
class AddCommentVisitor : public Visitor
75537549
{
75547550
public:
@@ -7561,16 +7557,6 @@ class AddCommentVisitor : public Visitor
75617557
void visit(StaticForeachDeclaration* sfd) override;
75627558
};
75637559

7564-
extern bool hasStaticCtorOrDtor(Dsymbol* d);
7565-
7566-
extern bool isFuncHidden(ClassDeclaration* cd, FuncDeclaration* fd);
7567-
7568-
extern bool isAbstract(ClassDeclaration* cd);
7569-
7570-
extern void lowerNonArrayAggregate(StaticForeach* sfe, Scope* sc);
7571-
7572-
extern int32_t include(Condition* c, Scope* sc);
7573-
75747560
class NrvoWalker final : public StatementRewriteWalker
75757561
{
75767562
public:

compiler/src/tests/cxxfrontend.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,10 +1721,11 @@ int main(int argc, char **argv)
17211721
/**********************************/
17221722
// Link Tests
17231723

1724-
void aggregate_h(StructDeclaration *sd)
1724+
void aggregate_h(StructDeclaration *sd, ClassDeclaration *cd, FuncDeclaration *fd)
17251725
{
17261726
dmd::search_toString(sd);
17271727
dmd::semanticTypeInfoMembers(sd);
1728+
dmd::isFuncHidden(cd, fd);
17281729
}
17291730

17301731
void argtypes_h(Type *t)
@@ -1736,14 +1737,16 @@ void argtypes_h(Type *t)
17361737
//dmd::isHFVA(t);
17371738
}
17381739

1739-
void declaration_h(FuncDeclaration *fd, Loc loc, Expressions* args, Parameters* params)
1740+
void declaration_h(FuncDeclaration *fd, Loc loc, Expressions* args, Parameters* params,
1741+
ClassDeclaration *cd)
17401742
{
17411743
dmd::functionSemantic(fd);
17421744
dmd::functionSemantic3(fd);
17431745
::eval_builtin(loc, fd, args);
17441746
::isBuiltin(fd);
17451747
dmd::genCfunc(params, fd->type, "test");
17461748
dmd::genCfunc(params, fd->type, Identifier::idPool("test"));
1749+
dmd::isAbstract(cd);
17471750
}
17481751

17491752
void doc_h(Module *m, const char *ptr, d_size_t length, const char *date,
@@ -1761,6 +1764,7 @@ void dsymbol_h(Dsymbol *d, Scope *sc, ScopeDsymbol *sds, Loc loc, Identifier *id
17611764
dmd::search(d, loc, ident);
17621765
dmd::setScope(d, sc);
17631766
dmd::importAll(d, sc);
1767+
dmd::include(d, sc);
17641768
}
17651769

17661770
void expression_h(Expression *e, Scope *sc, Type *t, Loc loc, Expressions *es)

0 commit comments

Comments
 (0)