* WIP: Objective-C support
* Further work on implementation
* ObjC dynamic cast
* Add swift stub class attribute
* Classes, protocols and ivars
* Fix compilation issues
* Fix objc ir codegen
* Add objc linker option
* Add swift stub classref get ir gen
* Minor cleanup
* Fix objc link flag being added on non-darwin platforms
* Refactor objc gen
* remove use of std::nullopt
* Emit protocol tables
* Remove unused variable
* Formatting
* Fix build in release mode. Thanks for nothing, c++.
* Fix consistency
* Fix dynamic casts
* Fix tocall parentfd ref and arm msgsend call
* Make instance variables work
* Implicitly add isa pointer to objc classes.
* Fix protocol referencing & allow pragma mangle
* Fix protocol linkage
* Fix direct call support
* always generate var type for methods
* Fix test 16096a
* Fix extern ivar symbol gen, retain method decls
* Remove arm32 and x86 support
* Check method and ivar info before pushing to member list
* Make ObjcMethod info untyped.
* Make ivar and method gen more robust
* Generate optional protocol symbols
* Use bitcasting instead of creating multiple type defs
* Fix invalid protocol list struct gen
* More codegen robustness
* emit protocol table as const
* Make protocol table anon struct
* Fix callable type, generate protocol_list_t properly.
* Cast vthis to argtype
* Handle protorefs and classrefs properly
* seperate label ref and deref
* Fix method lookup
* Enable objective-c tests
* Enable objc_call_static test
* Scan both classes and protocols for method ref
* Enable objective-c tests on arm as well.
* supress objc linker warning in tests
* Fix class and protocol gen structure
* Fix objc_protocol_sections test
* ObjcMethod only get callee for functions with bodies
* Fix protocol class method gen
* Make ObjcMethod anon again
* Fix missing emit calls
* Fix classref gen
* Implement some of the requested changes
* Enable compilable tests
* Fix property selector gen, ugly hack for final funcs.
* Fix segfault in referencing fd->type
* Refactor implementation
* Fix null references in class and method lookup
* include unordered_map
* Get functionality on-par with prev impl.
* Fix super context calls
* Move -L-w flag to d_do_test and use IN_LLVM in objc.d/h
* add LDC version tag to -L-w flag
* Update CHANGELOG.md
The previous API of returning two `unsigned`s was ambiguous when accessing the second member of a union that is the first member of a struct, where both output were set to zero.
It now returns one `unsigned` and an output `bool` to determine if it should be used as either a field or byte offset.
By merging consecutive bit fields to a group for as long as they share
storage bytes. This means that the new groups can contain members of
diverging byte offsets, requiring extra care.
Base it on the IR alignments of the fields only.
Also fix the alignment of variables captured by ref (=> pointer
alignment, not the pointee's) and captured lazy params (=>
delegate alignment) in nested frames, something that cropped up with
a new assertion.
I probably introduced this regression lately. Back then, I didn't
account for container aggregates, which require that the LL struct is
packed if the overall D aggregate alignment is lower than a field's
natural alignment.
The front-end fills in missing init expressions (except for the nested
context pointer in most cases), so there are no implicitly initialized
fields for dynamically initialized struct literals.
The front-end is also supposed to make sure there are no overlapping
initializers by using null-expressions for overridden fields, but doesn't
in some cases (DMD issue 16471).
Instead of preferring the first one in lexical field order, now use the
lexically last one to mimic DMD.
The previous code iterated over the fields in lexical order and ignored
the initializer for a field if there were earlier declared fields with
greater offset (and an initializer expression), which is wrong for
anonymous structs inside a union:
union {
struct { int i1; long l = 123; }
struct { int i2; int x = 1; }
}
`x` was previously initialized with 0 (treated as padding).
By refactoring IrAggr::addFieldInitializers() and making it use an
extended and refactored AggrTypeBuilder::addAggregate().
AggrTypeBuilder::addAggregate() can now optionally detect alias fields
in unions (same offset and LL type as a dominant union field) and add
those to the variable-to-GEP-index mapping.
These alias fields can then be indexed directly with a GEP instead of
resorting to casting the pointer and applying the byte offset.
Also adds the CMake infrastructure to compile and link the D source files.
The build is partially broken:
- A few files in Phobos and druntime do not build
- MSVC build is broken because of unresolved symbols involving reals
Trying to get the alignment right by using the first non-default one
in the following order of descending priority:
VarDeclaration::alignment [variables only of course]
Type::alignment()
Type::alignsize()
This fixes `align(x) struct S { ... }`.
We already generated the memsets for zeroing the padding,
but because we relied on the native LLVM type allignment
where possible instead of generating explicit padding
values, LLVM did not always copy those bytes around (e.g.
when spilling/reloading registers).
The previous approach was to add i64, i32, i16, i8 members depending
on alignment and required space. This seems to cause several problems.
Solution is to use a byte array. This makes to code more compact, too.
Fixes issue #989.
The `union` is not created as packed type. This seems to create problems with the default initializer:
struct Foo
{
static union Bar
{
bool b;
ulong l;
}
Bar bar;
}
static this()
{
Foo foo = Foo();
}
creates an error. If you change the order inside the union
static union Bar
{
ulong l;
bool b;
}
then the code works.
Also cleans up the creation of the additonal zeroes for the initializer.
If there are gagged errors then `fatal()` is called in `irtypeaggr.cpp/AggrTypeBuilder::addAggregate()`.
In this case `fatal()` should only be called is there is no error gagging and an overlapping initialization
has been detected.