Commit graph

198 commits

Author SHA1 Message Date
Martin Kinkelin
06d51e36f4 Remove superfluous DIBuilder::CreateCompositeTypeDescription 2021-04-06 01:35:46 +02:00
Martin Kinkelin
f8ef4cd863 DI: Emit enums with floating-point base type as typedefs
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.
2021-04-05 22:18:27 +02:00
Martin Kinkelin
eb4fcf26b1 DI: Emit delegate funcptr member as function *pointer*
This is at least required when debugging in VS on Windows.
2021-04-05 22:07:06 +02:00
Martin Kinkelin
3b7e00a768 Fix overzealous toBasetype'ing for debuginfo types
Resolves #3688.
2021-04-05 22:07:06 +02:00
Martin Kinkelin
d8bc064cfb Add support for LLVM 12 2021-02-12 07:54:41 +01:00
Martin Kinkelin
079858f3b2 Upgrade frontend & libs to early v2.095.0 (dlang/dmd@a4274b3c39) 2020-11-27 17:45:13 +01:00
Martin Kinkelin
3f716ff75e Refactoring: Introduce getIrType()
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...
2020-11-13 15:43:18 +01:00
Martin Kinkelin
246b783119
Win64 ABI: Pass/return delegates like slices - in (up to) 2 GP registers (#3609)
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.
2020-11-11 21:04:05 +01:00
Martin Kinkelin
1d969cfcca Revise IRScope refactoring
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.
2020-09-26 01:04:50 +02:00
Martin Kinkelin
9c42dfd9d0 LLVM 11: Adapt debuginfos wrt. static array and vector lengths
To overcome a new assertion, complaining that subranges with lower
bounds (always 0) aren't supported for CodeView.
2020-09-26 01:04:50 +02:00
Martin Kinkelin
877ce6fe4c
Add -gdwarf CLI option to emit DWARF debuginfos for MSVC targets (#3533)
Analogous to clang.
2020-08-11 10:30:31 +02:00
Martin Kinkelin
49affcffb2
Fix issue #3496 - missing IR declarations for some fwd-declared functions (#3503)
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.
2020-07-13 21:49:41 +02:00
Martin Kinkelin
834f666ce5
Raise min LLVM version to 6.0 (#3493) 2020-07-13 20:42:50 +02:00
Martin Kinkelin
22bf484ccf
Don't emit any column infos for CodeView by default (like clang) & add -gcolumn-info (#3388)
Fixes #3102; see https://reviews.llvm.org/D23720.
2020-03-30 14:37:45 +02:00
Martin Kinkelin
7a6c536fe9 Merge remote-tracking branch 'origin/master' into merge-2090 2020-01-12 15:49:04 +01:00
Martin Kinkelin
34eae780c1 Fix debuginfo for enum of delegates 2020-01-11 03:44:12 +01:00
Martin Kinkelin
66f3267a82 Fix issue #3272 (debuginfo for enum of function pointers) 2020-01-11 03:44:11 +01:00
Martin Kinkelin
5e7e0d55bc Merge remote-tracking branch 'origin/master' into merge-2090
Conflicts:
	tests/d2/dmd-testsuite
2020-01-06 17:01:57 +01:00
Fangrui Song
1743be4e8e dibuilder: fix createGlobalVariableExpression call for LLVM 10 (#3266) 2020-01-06 01:16:31 +01:00
Martin Kinkelin
4ac7f0554b Adapt to frontend refactorings 2019-12-22 16:29:45 +01:00
Roberto Rosmaninho
a1e44b2c81 Adapt to current LLVM 10 (#3257) 2019-12-16 22:23:43 +01:00
Martin Kinkelin
b741ee5715 Fix some ICEs in debuginfo generator wrt. opaque structs
Just enough to make new compilable/ice20044.d pass with `-g`.
2019-07-29 21:38:34 +02:00
Martin Kinkelin
e52199469f Upgrade front-end & libs to v2.087.0-beta.1 2019-06-21 15:39:45 +02:00
Martin Kinkelin
d4858cfbcb
Fix issue #2937 (DI scope for types in static foreach in mixin templates) (#2939) 2018-12-16 13:41:18 +01:00
Nicholas Wilson
7a2a59874a fix compilation with recent LLVM (#2921) 2018-11-25 15:27:10 +01:00
Martin Kinkelin
0a6125352d
Debuginfo: Fix Win64 CodeView emission for some by-value params (#2908)
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.
2018-11-15 03:02:09 +01:00
Oleksandr Palamar
540f19c8a9 Debuginfo: Fix type for associative arrays and make -gc emit C++-imitating names (#2869) 2018-11-11 17:29:00 +01:00
Martin Kinkelin
71dfc4a637 Fix DIBuilder::EmitNamespace() for LLVM < 5.0 2018-11-03 23:22:19 +01:00
Martin Kinkelin
3e30bc691a Clang-format messy gen/dibuilder.cpp 2018-11-03 23:22:19 +01:00
Martin Kinkelin
be6c608a67 Refactor DIBuilder [NFC] 2018-11-03 23:22:19 +01:00
Martin Kinkelin
e0319eadf1 Add DI namespaces & use them for templates and C++ namespaces
And make sure the template instance names include the template
parameters, a regression after #2826.

Also prevent `TemplatedSymbol(...).TemplatedSymbol` names, just use
`TemplatedSymbol!(...)` instead.
2018-11-03 23:22:19 +01:00
Martin Kinkelin
4a23399236 Aim for consistent #includes (order + dir prefix)
I surely missed a few.
2018-10-20 16:19:46 +02:00
Martin Kinkelin
7776c4081b Upgrade frontend & libs to v2.083.0-beta.1 2018-10-20 16:19:46 +02:00
Martin Kinkelin
5cdab742f7 Restore special DI name for extern(D) main function (D main) 2018-10-15 23:17:24 +02:00
Martin Kinkelin
518eafc2f9 Work around apparent LLVM CodeView bug wrt. nested functions 2018-10-15 23:17:24 +02:00
Martin Kinkelin
070d6dab0f Slightly refactor DIBuilder::EmitSubProgram() 2018-10-15 23:17:24 +02:00
Elie Morisse
dcad25d6fd Debug info: for extern(D) functions whose order of explicit arguments gets reversed, set the calling convention to DW_CC_D_dmd.
DW_CC_D_dmd is set to the first available value according to https://gcc.gnu.org/wiki/GNUDwarfExtensions. A GDB patch to handle this calling convention is being proposed.
2018-10-15 23:17:24 +02:00
Elie Morisse
23e73160cf Debug info: remove dead getDefinedModule() function. 2018-10-15 23:10:22 +02:00
Elie Morisse
a62a94fa43 Debug info: move the IrTypeAggr::diCompositeType field into IrAggr to get it reset when emitting a new module
diCompositeType might contain references to another compile unit, so has to be re-created for each module.
2018-10-15 23:10:22 +02:00
Elie Morisse
02eb4058fa Debug info: create temporary forward subprograms before creating the subprogram type
This is for the special case of auto functions returning a nested type, e.g:

  auto foo() {
    struct S {};
    S s;
    return s;
  }
2018-10-15 23:10:18 +02:00
Elie Morisse
8d26d5f452 Debug info: DIBuilder::GetSymbolScope() might need to declare functions 2018-10-15 22:57:59 +02:00
Elie Morisse
e292cbc84f Debug info: at least for GDB, "this" parameters should get declared as DW_TAG_pointer_type instead of DW_TAG_reference_type for member function calls to work
Matches GDC and Clang's output.
2018-10-15 22:54:29 +02:00
Elie Morisse
9facf5ad28 Debug info: better handling of static aggregate members with DIFlagStaticMember
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"'
2018-10-15 22:51:50 +02:00
Elie Morisse
2cdae62b0e Debug info: attach entries to their scope, and never use the qualified name except for modules
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.
2018-10-15 22:51:50 +02:00
Elie Morisse
841146644b Debug info: emit llvm::DIModule and llvm::DIImportedEntity for modules and imports
Matches GDC's DWARF output and enables access to global and imported symbols from GDB.
2018-10-15 22:48:03 +02:00
Martin Kinkelin
5c24f60cf9
Raise min LLVM version to 3.9 (#2872) 2018-10-15 22:31:59 +02:00
Martin Kinkelin
5d8b581025 Rename ExplicitByvalRewrite to IndirectByvalRewrite 2018-05-27 00:57:26 +02:00
Johan Engelen
5b775a7dc5
Fix compilation with LLVM trunk. (#2705) 2018-05-22 20:04:09 +02:00
Martin
114dfa4333 Handle new special enums in debuginfo emission
I.e., __c_(u)long and __c_long_double.

This fixes runnable/cppa.d.
2018-04-27 23:50:52 +02:00
Martin
df4f854dd5 Upgrade to D v2.079.0-beta.1 2018-02-20 02:04:41 +01:00