A lot of system specific knowledge is already present in LLVM. This is used to populate several fields in global.params instead of hard coded values in main(). Ensures that the frontend and LLVM have always the same values.
Variable `args` was used without first checking for valid values. You could crash LDC by entering something like 'pragma(intrinsic) void crash();' in the source file.
This simplifies the code in module.cpp a bit. But it is also the base to implement a pragma to place an arbitrary function in llvm.global_ctors and llvm.global_dtors.
The string representation of the data layout is retrieved from the TargetData class (in main) and passed via global.params.dataLayout to the module. Since the gTargetData is also a global variable it makes no sense to pass this information using another global variable.
- Add new files and remove unused files.
- Only create .bc files if requested.
(Creating .bc and .obj files at the same time confuses the LIB tool. Maybe a CMake bug....)
- Add references to new commits for Win64 in druntime and phobos.
See the comment in DtoCallFunction for an explanation of what is
going on.
The struct zero initialization code was also refactored out to
AssignExp::toElem and modified so that it is only triggered
on integer->struct assignments, not for any types where the
modifier-stripped types don't match up. This would have lead to
silently wrong code in the cases where the assert would have been
triggered otherwise.
Fixes the Phobos testsuite build.
Implementing the recursion in DeclarationExp::apply, which seems more
natural, lead to a "cannot interpret" CTFE error in Phobos.
An upstream bug will be raised about this.
NChybrid was the only one that didn't instantly trigger a "not
implemented" assertion on any code using nested function for a long
time, and removing the cruft greatly improves code readability
(maintainability is a moot point anyway given its current state).
Previously, we just had a hack to make ref foreach statements work.
This commit enables them to work in other cases as well, like the
implicit __result variable for functions with out-contracts (which
is such a magic ref variable for ref-returning functions).
Fixes DMD testcase 'testcontracts'.