| 1 |
/** |
| 2 |
* Contains C++ interfaces for interacting with DMD as a library. |
| 3 |
* |
| 4 |
* Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved |
| 5 |
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) |
| 6 |
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) |
| 7 |
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/cxxfrontend.d, _cxxfrontend.d) |
| 8 |
* Documentation: https://dlang.org/phobos/dmd_cxxfrontend.html |
| 9 |
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/cxxfrontend.d |
| 10 |
*/ |
| 11 |
module dmd.cxxfrontend; |
| 12 |
|
| 13 |
import dmd.aggregate : AggregateDeclaration; |
| 14 |
import dmd.arraytypes; |
| 15 |
import dmd.astenums; |
| 16 |
import dmd.attrib; |
| 17 |
import dmd.common.outbuffer : OutBuffer; |
| 18 |
import dmd.dclass : ClassDeclaration; |
| 19 |
import dmd.declaration : TypeInfoDeclaration; |
| 20 |
import dmd.denum : EnumDeclaration; |
| 21 |
import dmd.dmodule /*: Module*/; |
| 22 |
import dmd.dscope : Scope; |
| 23 |
import dmd.dstruct /*: StructDeclaration*/; |
| 24 |
import dmd.dsymbol : Dsymbol, ScopeDsymbol, CAsmDeclaration, SearchOpt, SearchOptFlags; |
| 25 |
import dmd.dtemplate /*: TemplateInstance, TemplateParameter, Tuple*/; |
| 26 |
import dmd.errorsink : ErrorSink; |
| 27 |
import dmd.expression /*: Expression*/; |
| 28 |
import dmd.func : FuncDeclaration; |
| 29 |
import dmd.globals; |
| 30 |
import dmd.identifier : Identifier; |
| 31 |
import dmd.init : Initializer, NeedInterpret; |
| 32 |
import dmd.location : Loc; |
| 33 |
import dmd.mtype /*: Covariant, Type, Parameter, ParameterList*/; |
| 34 |
import dmd.rootobject : RootObject; |
| 35 |
import dmd.statement : Statement, AsmStatement, GccAsmStatement; |
| 36 |
|
| 37 |
// NB: At some point in the future, we can switch to shortened function syntax. |
| 38 |
extern (C++, "dmd"): |
| 39 |
|
| 40 |
/*********************************************************** |
| 41 |
* atrtibsem.d |
| 42 |
*/ |
| 43 |
Expressions* getAttributes(UserAttributeDeclaration a) |
| 44 |
{ |
| 45 |
import dmd.attribsem; |
| 46 |
return dmd.attribsem.getAttributes(a); |
| 47 |
} |
| 48 |
|
| 49 |
/*********************************************************** |
| 50 |
* mangle/cpp.d |
| 51 |
*/ |
| 52 |
const(char)* toCppMangleItanium(Dsymbol s) |
| 53 |
{ |
| 54 |
import dmd.mangle.cpp; |
| 55 |
return dmd.mangle.cpp.toCppMangleItanium(s); |
| 56 |
} |
| 57 |
|
| 58 |
const(char)* cppTypeInfoMangleItanium(Dsymbol s) |
| 59 |
{ |
| 60 |
import dmd.mangle.cpp; |
| 61 |
return dmd.mangle.cpp.cppTypeInfoMangleItanium(s); |
| 62 |
} |
| 63 |
|
| 64 |
const(char)* cppThunkMangleItanium(FuncDeclaration fd, int offset) |
| 65 |
{ |
| 66 |
import dmd.mangle.cpp; |
| 67 |
return dmd.mangle.cpp.cppThunkMangleItanium(fd, offset); |
| 68 |
} |
| 69 |
|
| 70 |
/*********************************************************** |
| 71 |
* dinterpret.d |
| 72 |
*/ |
| 73 |
Expression ctfeInterpret(Expression e) |
| 74 |
{ |
| 75 |
import dmd.dinterpret; |
| 76 |
return dmd.dinterpret.ctfeInterpret(e); |
| 77 |
} |
| 78 |
|
| 79 |
/*********************************************************** |
| 80 |
* mangle/package.d |
| 81 |
*/ |
| 82 |
const(char)* mangleExact(FuncDeclaration fd) |
| 83 |
{ |
| 84 |
import dmd.mangle; |
| 85 |
return dmd.mangle.mangleExact(fd); |
| 86 |
} |
| 87 |
|
| 88 |
void mangleToBuffer(Type t, ref OutBuffer buf) |
| 89 |
{ |
| 90 |
import dmd.mangle; |
| 91 |
return dmd.mangle.mangleToBuffer(t, buf); |
| 92 |
} |
| 93 |
|
| 94 |
void mangleToBuffer(Expression e, ref OutBuffer buf) |
| 95 |
{ |
| 96 |
import dmd.mangle; |
| 97 |
return dmd.mangle.mangleToBuffer(e, buf); |
| 98 |
} |
| 99 |
|
| 100 |
void mangleToBuffer(Dsymbol s, ref OutBuffer buf) |
| 101 |
{ |
| 102 |
import dmd.mangle; |
| 103 |
return dmd.mangle.mangleToBuffer(s, buf); |
| 104 |
} |
| 105 |
|
| 106 |
void mangleToBuffer(TemplateInstance ti, ref OutBuffer buf) |
| 107 |
{ |
| 108 |
import dmd.mangle; |
| 109 |
return dmd.mangle.mangleToBuffer(ti, buf); |
| 110 |
} |
| 111 |
|
| 112 |
/*********************************************************** |
| 113 |
* dmodule.d |
| 114 |
*/ |
| 115 |
void getLocalClasses(Module mod, ref ClassDeclarations aclasses) |
| 116 |
{ |
| 117 |
return dmd.dmodule.getLocalClasses(mod, aclasses); |
| 118 |
} |
| 119 |
|
| 120 |
FuncDeclaration findGetMembers(ScopeDsymbol dsym) |
| 121 |
{ |
| 122 |
return dmd.dmodule.findGetMembers(dsym); |
| 123 |
} |
| 124 |
|
| 125 |
/*********************************************************** |
| 126 |
* doc.d |
| 127 |
*/ |
| 128 |
void gendocfile(Module m, const char* ddoctext_ptr, size_t ddoctext_length, |
| 129 |
const char* datetime, ErrorSink eSink, ref OutBuffer outbuf) |
| 130 |
{ |
| 131 |
import dmd.doc; |
| 132 |
return dmd.doc.gendocfile(m, ddoctext_ptr, ddoctext_length, datetime, eSink, outbuf); |
| 133 |
} |
| 134 |
|
| 135 |
/*********************************************************** |
| 136 |
* dstruct.d |
| 137 |
*/ |
| 138 |
FuncDeclaration search_toString(StructDeclaration sd) |
| 139 |
{ |
| 140 |
return dmd.dstruct.search_toString(sd); |
| 141 |
} |
| 142 |
|
| 143 |
/*********************************************************** |
| 144 |
* dsymbolsem.d |
| 145 |
*/ |
| 146 |
void dsymbolSemantic(Dsymbol dsym, Scope* sc) |
| 147 |
{ |
| 148 |
import dmd.dsymbolsem; |
| 149 |
return dmd.dsymbolsem.dsymbolSemantic(dsym, sc); |
| 150 |
} |
| 151 |
|
| 152 |
void addMember(Dsymbol dsym, Scope* sc, ScopeDsymbol sds) |
| 153 |
{ |
| 154 |
import dmd.dsymbolsem; |
| 155 |
return dmd.dsymbolsem.addMember(dsym, sc, sds); |
| 156 |
} |
| 157 |
|
| 158 |
Dsymbol search(Dsymbol d, Loc loc, Identifier ident, SearchOptFlags |
| 159 |
flags = SearchOpt.all) |
| 160 |
{ |
| 161 |
import dmd.dsymbolsem; |
| 162 |
return dmd.dsymbolsem.search(d, loc, ident, flags); |
| 163 |
} |
| 164 |
|
| 165 |
void setScope(Dsymbol d, Scope* sc) |
| 166 |
{ |
| 167 |
import dmd.dsymbolsem; |
| 168 |
return dmd.dsymbolsem.setScope(d, sc); |
| 169 |
} |
| 170 |
|
| 171 |
void importAll(Dsymbol d, Scope* sc) |
| 172 |
{ |
| 173 |
import dmd.dsymbolsem; |
| 174 |
return dmd.dsymbolsem.importAll(d, sc); |
| 175 |
} |
| 176 |
|
| 177 |
Dsymbols* include(Dsymbol d, Scope* sc) |
| 178 |
{ |
| 179 |
import dmd.dsymbolsem; |
| 180 |
return dmd.dsymbolsem.include(d, sc); |
| 181 |
} |
| 182 |
|
| 183 |
bool isFuncHidden(ClassDeclaration cd, FuncDeclaration fd) |
| 184 |
{ |
| 185 |
import dmd.dsymbolsem; |
| 186 |
return dmd.dsymbolsem.isFuncHidden(cd, fd); |
| 187 |
} |
| 188 |
|
| 189 |
Dsymbol vtblSymbol(ClassDeclaration cd) |
| 190 |
{ |
| 191 |
import dmd.dsymbolsem; |
| 192 |
return dmd.dsymbolsem.vtblSymbol(cd); |
| 193 |
} |
| 194 |
|
| 195 |
/*********************************************************** |
| 196 |
* dtemplate.d |
| 197 |
*/ |
| 198 |
inout(Expression) isExpression(inout RootObject o) |
| 199 |
{ |
| 200 |
return dmd.dtemplate.isExpression(o); |
| 201 |
} |
| 202 |
|
| 203 |
inout(Dsymbol) isDsymbol(inout RootObject o) |
| 204 |
{ |
| 205 |
return dmd.dtemplate.isDsymbol(o); |
| 206 |
} |
| 207 |
|
| 208 |
inout(Type) isType(inout RootObject o) |
| 209 |
{ |
| 210 |
return dmd.dtemplate.isType(o); |
| 211 |
} |
| 212 |
|
| 213 |
inout(Tuple) isTuple(inout RootObject o) |
| 214 |
{ |
| 215 |
return dmd.dtemplate.isTuple(o); |
| 216 |
} |
| 217 |
|
| 218 |
inout(Parameter) isParameter(inout RootObject o) |
| 219 |
{ |
| 220 |
return dmd.dtemplate.isParameter(o); |
| 221 |
} |
| 222 |
|
| 223 |
inout(TemplateParameter) isTemplateParameter(inout RootObject o) |
| 224 |
{ |
| 225 |
return dmd.dtemplate.isTemplateParameter(o); |
| 226 |
} |
| 227 |
|
| 228 |
bool isError(const RootObject o) |
| 229 |
{ |
| 230 |
return dmd.dtemplate.isError(o); |
| 231 |
} |
| 232 |
|
| 233 |
void printTemplateStats(bool listInstances, ErrorSink eSink) |
| 234 |
{ |
| 235 |
return dmd.dtemplate.printTemplateStats(listInstances, eSink); |
| 236 |
} |
| 237 |
|
| 238 |
/*********************************************************** |
| 239 |
* dtoh.d |
| 240 |
*/ |
| 241 |
void genCppHdrFiles(ref Modules ms) |
| 242 |
{ |
| 243 |
import dmd.dtoh; |
| 244 |
return dmd.dtoh.genCppHdrFiles(ms); |
| 245 |
} |
| 246 |
|
| 247 |
/*********************************************************** |
| 248 |
* enumsem.d |
| 249 |
*/ |
| 250 |
Expression getDefaultValue(EnumDeclaration ed, Loc loc) |
| 251 |
{ |
| 252 |
import dmd.enumsem; |
| 253 |
return dmd.enumsem.getDefaultValue(ed, loc); |
| 254 |
} |
| 255 |
|
| 256 |
/*********************************************************** |
| 257 |
* expression.d |
| 258 |
*/ |
| 259 |
void expandTuples(Expressions* exps, Identifiers* names = null) |
| 260 |
{ |
| 261 |
return dmd.expression.expandTuples(exps, names); |
| 262 |
} |
| 263 |
|
| 264 |
/*********************************************************** |
| 265 |
* expressionsem.d |
| 266 |
*/ |
| 267 |
Expression expressionSemantic(Expression e, Scope* sc) |
| 268 |
{ |
| 269 |
import dmd.expressionsem; |
| 270 |
return dmd.expressionsem.expressionSemantic(e, sc); |
| 271 |
} |
| 272 |
|
| 273 |
bool fill(StructDeclaration sd, Loc loc, |
| 274 |
ref Expressions elements, bool ctorinit) |
| 275 |
{ |
| 276 |
import dmd.expressionsem; |
| 277 |
return dmd.expressionsem.fill(sd, loc, elements, ctorinit); |
| 278 |
} |
| 279 |
|
| 280 |
/*********************************************************** |
| 281 |
* func.d |
| 282 |
*/ |
| 283 |
FuncDeclaration genCfunc(Parameters* fparams, Type treturn, const(char)* name, StorageClass stc = STC.none) |
| 284 |
{ |
| 285 |
return FuncDeclaration.genCfunc(fparams, treturn, name, cast(STC) stc); |
| 286 |
} |
| 287 |
|
| 288 |
FuncDeclaration genCfunc(Parameters* fparams, Type treturn, Identifier id, StorageClass stc = STC.none) |
| 289 |
{ |
| 290 |
return FuncDeclaration.genCfunc(fparams, treturn, id, cast(STC) stc); |
| 291 |
} |
| 292 |
|
| 293 |
/*********************************************************** |
| 294 |
* funcsem.d |
| 295 |
*/ |
| 296 |
bool functionSemantic(FuncDeclaration fd) |
| 297 |
{ |
| 298 |
import dmd.funcsem; |
| 299 |
return dmd.funcsem.functionSemantic(fd); |
| 300 |
} |
| 301 |
|
| 302 |
bool functionSemantic3(FuncDeclaration fd) |
| 303 |
{ |
| 304 |
import dmd.funcsem; |
| 305 |
return dmd.funcsem.functionSemantic3(fd); |
| 306 |
} |
| 307 |
|
| 308 |
MATCH leastAsSpecialized(FuncDeclaration fd, FuncDeclaration g, Identifiers* names) |
| 309 |
{ |
| 310 |
import dmd.funcsem; |
| 311 |
return dmd.funcsem.leastAsSpecialized(fd, g, names); |
| 312 |
} |
| 313 |
|
| 314 |
PURE isPure(FuncDeclaration fd) |
| 315 |
{ |
| 316 |
import dmd.funcsem; |
| 317 |
return dmd.funcsem.isPure(fd); |
| 318 |
} |
| 319 |
|
| 320 |
/*********************************************************** |
| 321 |
* hdrgen.d |
| 322 |
*/ |
| 323 |
void genhdrfile(Module m, bool doFuncBodies, ref OutBuffer buf) |
| 324 |
{ |
| 325 |
import dmd.hdrgen; |
| 326 |
return dmd.hdrgen.genhdrfile(m, doFuncBodies, buf); |
| 327 |
} |
| 328 |
|
| 329 |
const(char)* toChars(const Statement s) |
| 330 |
{ |
| 331 |
import dmd.hdrgen; |
| 332 |
return dmd.hdrgen.toChars(s); |
| 333 |
} |
| 334 |
|
| 335 |
const(char)* toChars(const Expression e) |
| 336 |
{ |
| 337 |
import dmd.hdrgen; |
| 338 |
return dmd.hdrgen.toChars(e); |
| 339 |
} |
| 340 |
|
| 341 |
const(char)* toChars(const Initializer i) |
| 342 |
{ |
| 343 |
import dmd.hdrgen; |
| 344 |
return dmd.hdrgen.toChars(i); |
| 345 |
} |
| 346 |
|
| 347 |
const(char)* toChars(const Type t) |
| 348 |
{ |
| 349 |
import dmd.hdrgen; |
| 350 |
return dmd.hdrgen.toChars(t); |
| 351 |
} |
| 352 |
|
| 353 |
void moduleToBuffer(ref OutBuffer buf, bool vcg_ast, Module m) |
| 354 |
{ |
| 355 |
import dmd.hdrgen; |
| 356 |
return dmd.hdrgen.moduleToBuffer(buf, vcg_ast, m); |
| 357 |
} |
| 358 |
|
| 359 |
const(char)* parametersTypeToChars(ParameterList pl) |
| 360 |
{ |
| 361 |
import dmd.hdrgen; |
| 362 |
return dmd.hdrgen.parametersTypeToChars(pl); |
| 363 |
} |
| 364 |
|
| 365 |
/*********************************************************** |
| 366 |
* iasm.d |
| 367 |
*/ |
| 368 |
Statement asmSemantic(AsmStatement s, Scope* sc) |
| 369 |
{ |
| 370 |
import dmd.iasm; |
| 371 |
return dmd.iasm.asmSemantic(s, sc); |
| 372 |
} |
| 373 |
|
| 374 |
void asmSemantic(CAsmDeclaration d, Scope* sc) |
| 375 |
{ |
| 376 |
import dmd.iasm; |
| 377 |
return dmd.iasm.asmSemantic(d, sc); |
| 378 |
} |
| 379 |
|
| 380 |
/*********************************************************** |
| 381 |
* iasmgcc.d |
| 382 |
*/ |
| 383 |
Statement gccAsmSemantic(GccAsmStatement s, Scope* sc) |
| 384 |
{ |
| 385 |
import dmd.iasmgcc; |
| 386 |
return dmd.iasmgcc.gccAsmSemantic(s, sc); |
| 387 |
} |
| 388 |
|
| 389 |
void gccAsmSemantic(CAsmDeclaration d, Scope* sc) |
| 390 |
{ |
| 391 |
import dmd.iasmgcc; |
| 392 |
return dmd.iasmgcc.gccAsmSemantic(d, sc); |
| 393 |
} |
| 394 |
|
| 395 |
/*********************************************************** |
| 396 |
* initsem.d |
| 397 |
*/ |
| 398 |
Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, |
| 399 |
NeedInterpret needInterpret) |
| 400 |
{ |
| 401 |
import dmd.initsem; |
| 402 |
return dmd.initsem.initializerSemantic(init, sc, tx, needInterpret); |
| 403 |
} |
| 404 |
|
| 405 |
Expression initializerToExpression(Initializer init, Type itype = null, const |
| 406 |
bool isCfile = false) |
| 407 |
{ |
| 408 |
import dmd.initsem; |
| 409 |
return dmd.initsem.initializerToExpression(init, itype, isCfile); |
| 410 |
} |
| 411 |
|
| 412 |
/*********************************************************** |
| 413 |
* json.d |
| 414 |
*/ |
| 415 |
void json_generate(ref Modules modules, ref OutBuffer buf) |
| 416 |
{ |
| 417 |
import dmd.json; |
| 418 |
return dmd.json.json_generate(modules, buf); |
| 419 |
} |
| 420 |
|
| 421 |
JsonFieldFlags tryParseJsonField(const(char)* fieldName) |
| 422 |
{ |
| 423 |
import dmd.json; |
| 424 |
return dmd.json.tryParseJsonField(fieldName); |
| 425 |
} |
| 426 |
|
| 427 |
/*********************************************************** |
| 428 |
* mtype.d |
| 429 |
*/ |
| 430 |
AggregateDeclaration isAggregate(Type t) |
| 431 |
{ |
| 432 |
return dmd.mtype.isAggregate(t); |
| 433 |
} |
| 434 |
|
| 435 |
/*********************************************************** |
| 436 |
* optimize.d |
| 437 |
*/ |
| 438 |
Expression optimize(Expression e, int result, bool keepLvalue = false) |
| 439 |
{ |
| 440 |
import dmd.optimize; |
| 441 |
return dmd.optimize.optimize(e, result, keepLvalue); |
| 442 |
} |
| 443 |
|
| 444 |
/*********************************************************** |
| 445 |
* semantic2.d |
| 446 |
*/ |
| 447 |
void semantic2(Dsymbol dsym, Scope* sc) |
| 448 |
{ |
| 449 |
import dmd.semantic2; |
| 450 |
return dmd.semantic2.semantic2(dsym, sc); |
| 451 |
} |
| 452 |
|
| 453 |
/*********************************************************** |
| 454 |
* semantic3.d |
| 455 |
*/ |
| 456 |
void semantic3(Dsymbol dsym, Scope* sc) |
| 457 |
{ |
| 458 |
import dmd.semantic3; |
| 459 |
return dmd.semantic3.semantic3(dsym, sc); |
| 460 |
} |
| 461 |
|
| 462 |
void semanticTypeInfoMembers(StructDeclaration sd) |
| 463 |
{ |
| 464 |
import dmd.semantic3; |
| 465 |
return dmd.semantic3.semanticTypeInfoMembers(sd); |
| 466 |
} |
| 467 |
|
| 468 |
bool checkClosure(FuncDeclaration fd) |
| 469 |
{ |
| 470 |
import dmd.semantic3; |
| 471 |
return dmd.semantic3.checkClosure(fd); |
| 472 |
} |
| 473 |
/*********************************************************** |
| 474 |
* statementsem.d |
| 475 |
*/ |
| 476 |
Statement statementSemantic(Statement s, Scope* sc) |
| 477 |
{ |
| 478 |
import dmd.statementsem; |
| 479 |
return dmd.statementsem.statementSemantic(s, sc); |
| 480 |
} |
| 481 |
|
| 482 |
/*********************************************************** |
| 483 |
* templateparamsem.d |
| 484 |
*/ |
| 485 |
bool tpsemantic(TemplateParameter tp, Scope* sc, TemplateParameters* parameters) |
| 486 |
{ |
| 487 |
import dmd.templateparamsem; |
| 488 |
return dmd.templateparamsem.tpsemantic(tp, sc, parameters); |
| 489 |
} |
| 490 |
|
| 491 |
/*********************************************************** |
| 492 |
* typesem.d |
| 493 |
*/ |
| 494 |
bool hasPointers(Type t) |
| 495 |
{ |
| 496 |
import dmd.typesem; |
| 497 |
return dmd.typesem.hasPointers(t); |
| 498 |
} |
| 499 |
|
| 500 |
Type typeSemantic(Type type, Loc loc, Scope* sc) |
| 501 |
{ |
| 502 |
import dmd.typesem; |
| 503 |
return dmd.typesem.typeSemantic(type, loc, sc); |
| 504 |
} |
| 505 |
|
| 506 |
Type trySemantic(Type type, Loc loc, Scope* sc) |
| 507 |
{ |
| 508 |
import dmd.typesem; |
| 509 |
return dmd.typesem.trySemantic(type, loc, sc); |
| 510 |
} |
| 511 |
|
| 512 |
Type merge(Type type) |
| 513 |
{ |
| 514 |
import dmd.typesem; |
| 515 |
return dmd.typesem.merge(type); |
| 516 |
} |
| 517 |
|
| 518 |
Type merge2(Type type) |
| 519 |
{ |
| 520 |
import dmd.typesem; |
| 521 |
return dmd.typesem.merge2(type); |
| 522 |
} |
| 523 |
|
| 524 |
Expression defaultInit(Type mt, Loc loc, const bool isCfile = false) |
| 525 |
{ |
| 526 |
import dmd.typesem; |
| 527 |
return dmd.typesem.defaultInit(mt, loc, isCfile); |
| 528 |
} |
| 529 |
|
| 530 |
Dsymbol toDsymbol(Type type, Scope* sc) |
| 531 |
{ |
| 532 |
import dmd.typesem; |
| 533 |
return dmd.typesem.toDsymbol(type, sc); |
| 534 |
} |
| 535 |
|
| 536 |
Covariant covariant(Type src, Type t, StorageClass* pstc = null, bool |
| 537 |
cppCovariant = false) |
| 538 |
{ |
| 539 |
import dmd.typesem; |
| 540 |
return dmd.typesem.covariant(src, t, cast(STC*) pstc, cppCovariant); |
| 541 |
} |
| 542 |
|
| 543 |
bool isZeroInit(Type t, Loc loc) |
| 544 |
{ |
| 545 |
import dmd.typesem; |
| 546 |
return dmd.typesem.isZeroInit(t, loc); |
| 547 |
} |
| 548 |
|
| 549 |
bool isBaseOf(Type tthis, Type t, int* poffset) |
| 550 |
{ |
| 551 |
import dmd.typesem; |
| 552 |
return dmd.typesem.isBaseOf(tthis, t, poffset); |
| 553 |
} |
| 554 |
|
| 555 |
bool equivalent(Type src, Type t) |
| 556 |
{ |
| 557 |
import dmd.typesem; |
| 558 |
return dmd.typesem.equivalent(src, t); |
| 559 |
} |
| 560 |
|
| 561 |
Type sarrayOf(Type type, dinteger_t dim) |
| 562 |
{ |
| 563 |
import dmd.typesem; |
| 564 |
return dmd.typesem.sarrayOf(type, dim); |
| 565 |
} |
| 566 |
|
| 567 |
Type arrayOf(Type type) |
| 568 |
{ |
| 569 |
import dmd.typesem; |
| 570 |
return dmd.typesem.arrayOf(type); |
| 571 |
} |
| 572 |
|
| 573 |
Type constOf(Type type) |
| 574 |
{ |
| 575 |
import dmd.typesem; |
| 576 |
return dmd.typesem.constOf(type); |
| 577 |
} |
| 578 |
|
| 579 |
Type immutableOf(Type type) |
| 580 |
{ |
| 581 |
import dmd.typesem; |
| 582 |
return dmd.typesem.immutableOf(type); |
| 583 |
} |
| 584 |
|
| 585 |
Type mutableOf(Type type) |
| 586 |
{ |
| 587 |
import dmd.typesem; |
| 588 |
return dmd.typesem.mutableOf(type); |
| 589 |
} |
| 590 |
|
| 591 |
Type sharedOf(Type type) |
| 592 |
{ |
| 593 |
import dmd.typesem; |
| 594 |
return dmd.typesem.sharedOf(type); |
| 595 |
} |
| 596 |
|
| 597 |
Type sharedConstOf(Type type) |
| 598 |
{ |
| 599 |
import dmd.typesem; |
| 600 |
return dmd.typesem.sharedConstOf(type); |
| 601 |
} |
| 602 |
|
| 603 |
Type unSharedOf(Type type) |
| 604 |
{ |
| 605 |
import dmd.typesem; |
| 606 |
return dmd.typesem.unSharedOf(type); |
| 607 |
} |
| 608 |
|
| 609 |
Type wildOf(Type type) |
| 610 |
{ |
| 611 |
import dmd.typesem; |
| 612 |
return dmd.typesem.wildOf(type); |
| 613 |
} |
| 614 |
|
| 615 |
Type wildConstOf(Type type) |
| 616 |
{ |
| 617 |
import dmd.typesem; |
| 618 |
return dmd.typesem.wildConstOf(type); |
| 619 |
} |
| 620 |
|
| 621 |
Type sharedWildOf(Type type) |
| 622 |
{ |
| 623 |
import dmd.typesem; |
| 624 |
return dmd.typesem.sharedWildOf(type); |
| 625 |
} |
| 626 |
|
| 627 |
Type sharedWildConstOf(Type type) |
| 628 |
{ |
| 629 |
import dmd.typesem; |
| 630 |
return dmd.typesem.sharedWildConstOf(type); |
| 631 |
} |
| 632 |
|
| 633 |
Type substWildTo(Type type, uint mod) |
| 634 |
{ |
| 635 |
import dmd.typesem; |
| 636 |
return dmd.typesem.substWildTo(type, mod); |
| 637 |
} |
| 638 |
|
| 639 |
Type unqualify(Type type, uint m) |
| 640 |
{ |
| 641 |
import dmd.typesem; |
| 642 |
return dmd.typesem.unqualify(type, m); |
| 643 |
} |
| 644 |
|
| 645 |
Type toHeadMutable(const(Type) type) |
| 646 |
{ |
| 647 |
import dmd.typesem; |
| 648 |
return dmd.typesem.toHeadMutable(type); |
| 649 |
} |
| 650 |
|
| 651 |
Type aliasthisOf(Type type) |
| 652 |
{ |
| 653 |
import dmd.typesem; |
| 654 |
return dmd.typesem.aliasthisOf(type); |
| 655 |
} |
| 656 |
|
| 657 |
Type castMod(Type type, MOD mod) |
| 658 |
{ |
| 659 |
import dmd.typesem; |
| 660 |
return dmd.typesem.castMod(type, mod); |
| 661 |
} |
| 662 |
|
| 663 |
Type addMod(Type type, MOD mod) |
| 664 |
{ |
| 665 |
import dmd.typesem; |
| 666 |
return dmd.typesem.addMod(type, mod); |
| 667 |
} |
| 668 |
|
| 669 |
Type addStorageClass(Type type, StorageClass stc) |
| 670 |
{ |
| 671 |
import dmd.typesem; |
| 672 |
return dmd.typesem.addStorageClass(type, cast(STC) stc); |
| 673 |
} |
| 674 |
|
| 675 |
Type pointerTo(Type type) |
| 676 |
{ |
| 677 |
import dmd.typesem; |
| 678 |
return dmd.typesem.pointerTo(type); |
| 679 |
} |
| 680 |
|
| 681 |
Type referenceTo(Type type) |
| 682 |
{ |
| 683 |
import dmd.typesem; |
| 684 |
return dmd.typesem.referenceTo(type); |
| 685 |
} |
| 686 |
|
| 687 |
uinteger_t size(Type type) |
| 688 |
{ |
| 689 |
import dmd.typesem; |
| 690 |
return dmd.typesem.size(type); |
| 691 |
} |
| 692 |
|
| 693 |
uinteger_t size(Type type, Loc loc) |
| 694 |
{ |
| 695 |
import dmd.typesem; |
| 696 |
return dmd.typesem.size(type, loc); |
| 697 |
} |
| 698 |
|
| 699 |
MATCH implicitConvTo(Type from, Type to) |
| 700 |
{ |
| 701 |
import dmd.dcast; |
| 702 |
return dmd.dcast.implicitConvTo(from, to); |
| 703 |
} |
| 704 |
|
| 705 |
MATCH constConv(Type from, Type to) |
| 706 |
{ |
| 707 |
import dmd.typesem; |
| 708 |
return dmd.typesem.constConv(from, to); |
| 709 |
} |
| 710 |
|
| 711 |
/*********************************************************** |
| 712 |
* typinf.d |
| 713 |
*/ |
| 714 |
bool genTypeInfo(Expression e, Loc loc, Type torig, Scope* sc) |
| 715 |
{ |
| 716 |
import dmd.typinf; |
| 717 |
return dmd.typinf.genTypeInfo(e, loc, torig, sc); |
| 718 |
} |
| 719 |
|
| 720 |
bool isSpeculativeType(Type t) |
| 721 |
{ |
| 722 |
import dmd.typinf; |
| 723 |
return dmd.typinf.isSpeculativeType(t); |
| 724 |
} |
| 725 |
|
| 726 |
bool builtinTypeInfo(Type t) |
| 727 |
{ |
| 728 |
import dmd.typinf; |
| 729 |
return dmd.typinf.builtinTypeInfo(t); |
| 730 |
} |
| 731 |
|
| 732 |
Type makeNakedAssociativeArray(TypeAArray t) |
| 733 |
{ |
| 734 |
import dmd.typinf; |
| 735 |
return dmd.typinf.makeNakedAssociativeArray(t); |
| 736 |
} |
| 737 |
|
| 738 |
TypeInfoDeclaration getTypeInfoAssocArrayDeclaration(TypeAArray t, Scope* sc) |
| 739 |
{ |
| 740 |
import dmd.typinf; |
| 741 |
return dmd.typinf.getTypeInfoAssocArrayDeclaration(t, sc); |
| 742 |
} |
| 743 |
|
| 744 |
version (IN_LLVM) |
| 745 |
{ |
| 746 |
/*********************************************************** |
| 747 |
* argtypes_aarch64.d |
| 748 |
*/ |
| 749 |
TypeTuple toArgTypes_aarch64(Type t) |
| 750 |
{ |
| 751 |
import dmd.argtypes_aarch64; |
| 752 |
return dmd.argtypes_aarch64.toArgTypes_aarch64(t); |
| 753 |
} |
| 754 |
|
| 755 |
bool isHFVA(Type t, int maxNumElements = 4, Type* rewriteType = null) |
| 756 |
{ |
| 757 |
import dmd.argtypes_aarch64; |
| 758 |
return dmd.argtypes_aarch64.isHFVA(t, maxNumElements, rewriteType); |
| 759 |
} |
| 760 |
|
| 761 |
/*********************************************************** |
| 762 |
* argtypes_sysv_x64.d |
| 763 |
*/ |
| 764 |
TypeTuple toArgTypes_sysv_x64(Type t) |
| 765 |
{ |
| 766 |
import dmd.argtypes_sysv_x64; |
| 767 |
return dmd.argtypes_sysv_x64.toArgTypes_sysv_x64(t); |
| 768 |
} |
| 769 |
|
| 770 |
/*********************************************************** |
| 771 |
* argtypes_x86.d |
| 772 |
*/ |
| 773 |
TypeTuple toArgTypes_x86(Type t) |
| 774 |
{ |
| 775 |
import dmd.argtypes_x86; |
| 776 |
return dmd.argtypes_x86.toArgTypes_x86(t); |
| 777 |
} |
| 778 |
} |