Commit Graph

29 Commits

Author SHA1 Message Date
Adrian Prantl 3285546c97 -gmodules: Emit debug info for implicit module imports via #include.
When a type is only used as a template parameter and that type is the
only type imported from another #include'd module, no skeleton CU for
that module is generated, so a consumer doesn't know where to find the
type definition. By emitting an import declaration, we can force a
skeleton CU to be generated for each imported module.

rdar://problem/36266156

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321754 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-03 19:10:21 +00:00
Adrian Prantl 05401222b8 Debug Info: Avoid completing class types when a definition is in a module.
This patch adds an early exit to CGDebugInfo::completeClassData() when
compiling with -gmodules and the to-be-completed type is available in
a clang module.

rdar://problem/23599990

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308938 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24 23:48:51 +00:00
Adrian Prantl bccfcb9907 Update for LLVM IR metadata changes (DIImportedEntity now needs a DIFile).
<rdar://problem/33357889>
https://bugs.llvm.org/show_bug.cgi?id=33822

Differential Revision: https://reviews.llvm.org/D35583

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308399 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-19 00:09:58 +00:00
Adrian Prantl acf47c79de Adapt to LLVM API change (DINamespace no longer takes line/file info).
rdar://problem/17484998
https://reviews.llvm.org/D32648

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301707 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 22:25:53 +00:00
Aaron Ballman a2bfcbd876 Removing a redundant, but harmless, %s; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300347 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-14 17:37:29 +00:00
Peter Collingbourne 48ccf5de8d Update Clang for D20147 ("DebugInfo: New metadata representation for global variables.")
Differential Revision: http://reviews.llvm.org/D20415

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281285 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-13 01:13:19 +00:00
Adrian Prantl 51b294d259 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279491 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-22 22:38:18 +00:00
Adrian Prantl db4c239f5e Module debug info: Fix a bug in handling record decls without fields.
The previous condition would erroneously mark all CXXRecordDecls
that didn't have any fields as being defined in a clang module.
This patch fixes the condition to only apply to explicit template
instantiations.

<rdar://problem/27771823>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278952 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-17 18:27:24 +00:00
Adrian Prantl 2e58709f44 Module debugging: Also correctly handle typedef'd foward-declared members.
Thanks again to Richard Smith for pointing this out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267630 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 23:37:38 +00:00
Adrian Prantl 56d464f4c2 Module debugging: Add testcase for member classes of class template specializations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267612 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 21:58:23 +00:00
Adrian Prantl 3cb9485016 Module debugging: Use the definition to determine module-defined types.
Follow-up to r267464. Thanks to Richard Smith for pointing this out!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267611 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 21:58:18 +00:00
Adrian Prantl 15a13f4ca1 Module Debugging: Fix the condition for determining whether a template
instantiation is in a module.

This patch fixes the condition for determining whether the debug info for a
template instantiation will exist in an imported clang module by:

- checking whether the ClassTemplateSpecializationDecl is complete and
- checking that the instantiation was in a module by looking at the first field.

I also added a negative check to make sure that a typedef to a forward-declared
template (with the definition outside of the module) is handled correctly.

http://reviews.llvm.org/D19443
rdar://problem/25553724

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267464 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-25 20:52:40 +00:00
Duncan P. N. Exon Smith 4a0e8aa964 DebugInfo: Adapt to loss of DITypeRef in LLVM r267296
LLVM stopped using MDString-based type references, and DIBuilder no
longer fills 'retainedTypes:' with every DICompositeType that has an
'identifier:' field.   There are just minor changes to keep the same
behaviour in CFE.

Leaving 'retainedTypes:' unfilled has a dramatic impact on the output
order of the IR though.  There are a huge number of testcase changes,
which were unfortunately not really scriptable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267297 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-23 21:08:27 +00:00
Duncan P. N. Exon Smith 70fae264e3 DebugInfo: Make DICompositeTypes distinct most of the time
Since elements of most kinds of DICompositeType have back references,
most are involved in uniquing cycles.  Except via the ODR 'identifier:'
field, which doesn't care about the storage type (see r266549),
they have no hope of being uniqued.

Distinct nodes are far more efficient, so use them for most kinds of
DICompositeType definitions (i.e., when DIType::isForwardDecl is false).
The exceptions:

  - DW_TAG_array_type, since their elements never have back-references
    and they never have ODR 'identifier:' fields;

  - DW_TAG_enumeration_type when there is no ODR 'identifier:' field,
    since their elements usually don't have back-references.

This breaks the last major uniquing cycle I'm aware of in the debug info
graph.  The impact won't be enormous for C++ because references to
ODR-uniqued nodes still use string-based DITypeRefs; but this should
prevent a regression in C++ when we drop the string-based references.

This wouldn't have been reasonable until r266549, when composite types
stopped relying on being uniqued by structural equivalence to prevent
blow-ups at LTO time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266556 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-17 07:45:08 +00:00
Adrian Prantl 2e0dd42050 Rephrase this test to help debug a buildbot issue
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258526 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 19:14:24 +00:00
Adrian Prantl 9fd9596d49 Fix a typo in r258507 and change the PCH dwoid constant to ~1UL.
rdar://problem/24290667

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258519 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 18:46:45 +00:00
Adrian Prantl efaf7e0f27 Fix 80-column violations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258518 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 18:46:40 +00:00
Adrian Prantl a892974a4f Module Debugging: Use a nonzero DWO id for precompiled headers.
PCH files don't have a module signature and LLVM uses a nonzero DWO id as
an indicator for skeleton / module CUs. This change pins the DWO id for PCH
files to a known constant value.
The correct long-term solution here is to implement a module signature
that is an actual dterministic hash (at the moment module signatures are
just random nonzero numbers) and then enable this for PCH files as well.

<rdar://problem/24290667>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258507 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 17:43:43 +00:00
Adrian Prantl 3d5d4c3965 Module Debugging: Fine-tune the condition that determines whether a type
can be found in a module.

There are externally visible anonymous types that can be found:
  typedef struct { } s; // I can be found via the typedef.
There are anonymous internal types that can be found:
  namespace { struct s {}; } // I can be found by name.

rdar://problem/24199640

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258272 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 01:29:34 +00:00
Adrian Prantl 4732653928 Module Debugging: Don't emit external type references to anonymous types.
Even if they exist in the module, they can't be matched with the forward
declaration in the object file.
<rdar://problem/24199640>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258251 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 23:42:53 +00:00
Adrian Prantl 135b6cd218 Module Debugging: Make sure that anonymous tag decls that define global
variables are visited.

This shouldn't encourage anyone to put global variables into clang modules.
rdar://problem/24199640

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258250 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 23:42:44 +00:00
Adrian Prantl ed2c14216c Module Debugging: Defer the emission of anonymous tag decls
until we are visiting their declcontext.

This fixes a regression introduced in r256962:
When building debug info for a typdef'd anonymous tag type, we would be
visiting the inner anonymous type first thus creating a "typedef changes
linkage of anonymous type, but linkage was already computed" error.

rdar://problem/24199640

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258152 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 18:02:47 +00:00
Douglas Katzman adbb8c2aef Stop messing with the 'g' group of options in CompilerInvocation.
With this change, most 'g' options are rejected by CompilerInvocation.
They remain only as Driver options. The new way to request debug info
from cc1 is with "-debug-info-kind={line-tables-only|limited|standalone}"
and "-dwarf-version={2|3|4}". In the absence of a command-line option
to specify Dwarf version, the Toolchain decides it, rather than placing
Toolchain-specific logic in CompilerInvocation.

Also fix a bug in the Windows compatibility argument parsing
in which the "rightmost argument wins" principle failed.

Differential Revision: http://reviews.llvm.org/D13221

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249655 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 04:24:12 +00:00
Reid Kleckner 34f0bee2b2 Use Itanium C++ ABI triple for new modules+debug test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247438 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 17:50:14 +00:00
Adrian Prantl 2532f2149e Module Debugging: Emit forward declarations for types that are defined in
clang modules, if -dwarf-ext-refs (DebugTypesExtRefs) is specified.

This reimplements r247369 in about a third of the amount of code.
Thanks to David Blaikie pointing this out in post-commit review!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247432 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 17:23:08 +00:00
Adrian Prantl d5dd152695 Revert "Module Debugging: Emit forward declarations for types that are defined in"
This reverts commit r247369 to facilitate reviewing of the following patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 17:23:03 +00:00
NAKAMURA Takumi d2dc884a74 clang/test/Modules/ExtDebugInfo.cpp: Use %itanium_abi_triple.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247397 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 08:56:12 +00:00
NAKAMURA Takumi c91b888e6b clang/test/Modules/ExtDebugInfo.cpp: Use [[@LINE]].
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247396 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 08:53:29 +00:00
Adrian Prantl 53a314a227 Module Debugging: Emit forward declarations for types that are defined in
clang modules, if -dwarf-ext-refs (DebugTypesExtRefs) is specified.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247369 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-11 01:03:26 +00:00