In the VS debugger, this means that the displayed type is the floating-
point one instead of the enum, but the enum value is displayed
correctly - it was previously re-interpreted as integer of matching
size.
As *the* way to access the IrType associated with a Type via its `ctype`
field. Most importantly, it makes sure all access is redirected to the
*unqualified* type's `ctype`, which allows to get rid of the 'multiple
types' workaround for aggregates in DtoType(). Those were e.g. hit for
`shared struct SpinLock`, where the struct's type includes the `shared`
modifier...
I expect this to be slightly more performant than the previous behavior,
where a delegate was treated like a corresponding struct, passed via
hidden pointer and returned via sret.
The primary motivation is a smooth preparation for PR #3578 - in order
to allow people to experiment with `-preview=in` without recompiling
druntime and Phobos, `in` slices and delegates must not be passed by-ref
with `-preview=in` (see dlang/dmd#11828). This would have required a
special case for delegates on Win64, which is IMO better handled this
way.
LLVM already provides suited RAII helper types to restore the IRBuilder
state. [They sadly aren't movable, so I've had to wrap them in a
unique_ptr.]
While at it, also minimally revise debuginfo generation for functions.
Whenever we need an IR function, we'd better make sure it exists. Handle
that in DtoCallee(), by invoking DtoDeclareFunction() by default,
instead of the previous DtoResolveFunction() + DtoCallee() combo.
DtoResolveFunction() usually declares the function, but somehow doesn't
for abstract and body-less functions.
Don't declare some special params as DI references, but as DI locals
instead.
Also enable some Win32 checks in the args_cdb test, as they are working
now with LLVM 7.
And make sure the template instance names include the template
parameters, a regression after #2826.
Also prevent `TemplatedSymbol(...).TemplatedSymbol` names, just use
`TemplatedSymbol!(...)` instead.
Once again closer to GDC and Clang's output, and attaching static variables to the module scope prevents an assert from triggering in IR/DIBuilder.cpp:
checkGlobalVariableScope(): Assertion `CT->getIdentifier().empty() && "Context of a global variable should not be a type with identifier"'
Previously entries were made children of the compile unit, and both global and imported symbols were only accessible by using their mangled name, or since the latest commit by their qualified name.
This brings the DWARF output closer to GDC's.