Commit graph

175 commits

Author SHA1 Message Date
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
Martin Kinkelin
11dfc4b5d7
Get rid of dead code (arrayops + DtoCallFunction() overload) (#2500) 2018-01-14 00:02:42 +01:00
Martin
6e7249c574 DI: Use fully qualified names
Tested by dmd-testsuite's runnable/testpdb.
2017-10-22 23:12:30 +02:00
Martin
610a1c37e4 Handle multiple function definitions with same mangled name
By discarding (and warning about) all but the first definition.
compilable/test17352.d tests that the compiler accepts 2 distinct but
equivalent templated function instantiations (with an alias to a
different local of the same type and name) ending up with a common
mangled name.
See https://issues.dlang.org/show_bug.cgi?id=17352.
2017-09-23 22:11:34 +02:00
Martin
8cc5ff6e79 Fix debuginfos for nested ref/out parameters (use llvm.dbg.declare)
llvm.dbg.value() apparently doesn't like GEP + deref, so use
llvm.dbg.declare() & GEP.
2017-09-09 22:02:14 +02:00
Martin
8371d173a9 MSVC x64: Declare params rewritten by ExplicitByvalRewrite as DI refs 2017-09-09 22:01:22 +02:00
Martin
8a5984b7d3 Use llvm.dbg.value for all non-special refs & fix nested refs DI 2017-09-09 22:01:22 +02:00
Martin
287e4b9b53 Cosmetics & improved comments wrt. llvm.dbg.value 2017-09-09 22:01:17 +02:00
Johan Engelen
7563930496 ref variables are not always function parameters: could be from a foreach statement, where it _is_ an alloca. 2017-08-27 21:47:33 +02:00
Johan Engelen
152416bd37 Attempt to use llvm.dbg.value instead for ref params. 2017-08-27 20:49:43 +02:00
Johan Engelen
bea0a37582 An attempt to fix runnable/gdb4149.d test: correct debuginfo for ref parameters. 2017-08-26 14:56:37 +02:00
Nicholas Wilson
f27109c8e8 New spirv and 6.0 compilation fixes (#2276)
Update to a new SPIRV-LLVM and fix compilation issues for LLVM6.0
2017-08-18 15:23:56 +08:00
Johan Engelen
cc35356d78 Mark intentional fall through as such. (#2218) 2017-07-20 20:22:43 +02:00
Johan Engelen
498f790915 Make the producer name in debuginfo more precise. (#2205) 2017-07-19 20:29:57 +02:00
Martin
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
Nicholas Wilson
c041205fe0 Dcompute fixes (#2195)
* Disable debug info for now Until I get it working.

* Don't recurse into uninstansiated templates

* Remove device only modules from objfiles.

* Remove typeid generation for dcompute.

* Dont generate typeinfo member functions

* Whitelist `__dcompute_reflect`
2017-07-13 11:28:09 +08:00
kinke
20084000b0 Merge pull request #2142 from kinke/archiver
Integrate LLD for MSVC targets; prepare for other targets
2017-06-04 04:02:22 +02:00
Martin
383c2d3a59 Range-ify usages of front-end Arrays 2017-06-04 00:29:44 +02:00
Elie Morisse
caa515a69b For classes DIBuilder::CreateCompositeType was producing DIType with wrong sizes.
Resulting in incorrect values in GDB.
2017-05-21 21:41:29 -03:00
Elie Morisse
3338bbf9c0 DIType for types involving classes were incorrect in some cases.
Static arrays of classes, pointers to class (and perhaps global class variables) ended up with a wrong DIType because of wrong CreateTypeDescription() calls for class types.

Ex.: Array!FuncDeclaration caused an infinite recursion crash in GDB, because for its « FuncDeclaration[SMALLARRAYCAP] smallarray » field DIBuilder::CreateSArrayType() had DIBuilder return a value type instead of a reference type for FuncDeclaration.
2017-05-21 21:41:25 -03:00
Johan Engelen
d61452c6a8 Add internal global option to enable outputting of source line info 2017-05-03 00:10:52 +02:00
Johan Engelen
c2b539c348 Fix LLVM 5.0 compilation 2017-03-14 23:45:56 +01:00
Martin
dca21939e1 Merge 2.072.2 front-end
The part needing most attention was ddmd.root.ctfloat, ddmd.target (incl.
gen/target.cpp) and ddmd.builtin. The front-end is now prepared for
elaborate compile-time floating-point types to allow for proper cross-
compilation.

This version still uses the host's `real` type for compile-time reals,
except for MSVC hosts, which still use 64-bit doubles (when compiled with
DMD host compiler too).

Some other changes:

* semantic*() of Statements extracted from statement.d to statementsem.d
* mangle() -> mangleToBuffer()
* Identifier::string -> toChars()
* Token::float80value => floatvalue
* Dsymbol::isAggregateMember() => isMember()
* BoolExp is no more
* ddmd.root.ctfloat: LDC-specific CTFE builtins
2017-01-29 15:48:03 +01:00
kinke
89e5d27415 Put debuginfo on GEP instead of on the alloca with an offset. (#1984)
For nested variables. Resolves issue #1933 at the expense of a debuginfo
regression wrt. captured this pointer, see PR #1963.

Also add DWARF deref for non-ref/out variables captured by reference.
2017-01-25 00:36:00 +01:00