Commit Graph

3635 Commits

Author SHA1 Message Date
Adrian McCarthy 992429843b Emit debug info for dynamic classes if they are imported from a DLL.
With -debug-info-kind=limited, we omit debug info for dynamic classes that live in other TUs. This reduces duplicate type information. When statically linked, the type information comes together. But if your binary has a class derived from a base in a DLL, the base class info is not available to the debugger.

The decision is made in shouldOmitDefinition (CGDebugInfo.cpp). Per a suggestion from rnk, I've tweaked the decision so that we do include definitions for classes marked as DLL imports. This should be a relatively small number of classes, so we don't pay a large price for duplication of the type info, yet it should cover most cases on Windows.

Essentially this makes debug info for DLLs independent, but we still assume that all TUs within the same DLL will be consistently built with (or without) debug info and the debugger will be able to search across the debug info within that scope to resolve any declarations into definitions, etc.

llvm-svn: 278861
2016-08-16 22:11:18 +00:00
Richard Smith 39a7c4c65a Add a triple to this test to make buildbots happier.
llvm-svn: 278647
2016-08-15 02:24:00 +00:00
Richard Smith da38363784 P0217R3: code generation support for decomposition declarations.
llvm-svn: 278642
2016-08-15 01:33:41 +00:00
David Blaikie 2a58a18d67 PR26423: Assert on valid use of using declaration of a function with an undeduced auto return type
For now just disregard the using declaration in this case. Suboptimal,
but wiring up the ability to have declarations of functions that are
separate from their definition (we currently only do that for member
functions) and have differing return types (we don't have any support
for that) is more work than seems reasonable to at least fix this crash.

llvm-svn: 277852
2016-08-05 19:03:01 +00:00
Reid Kleckner 755220bcef [codeview] Skip injected class names in nested record emission
We were already trying to do this, but our check wasn't quite right.

Fixes PR28790

llvm-svn: 277367
2016-08-01 18:56:13 +00:00
Reid Kleckner 939119dcb2 Fix naked.cpp test on 32-bit Windows
llvm-svn: 277205
2016-07-29 19:43:28 +00:00
Justin Lebar ed4f172c00 Don't crash when generating code for __attribute__((naked)) member functions.
Summary:
Previously this crashed inside EmitThisParam().  There should be no
prelude for naked functions, so just skip the whole thing.

Reviewers: majnemer

Subscribers: llvm-commits

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

llvm-svn: 276925
2016-07-27 22:04:24 +00:00
David Majnemer 0ed275c773 Update test to account for r276604
llvm-svn: 276607
2016-07-25 04:47:45 +00:00
Anna Thomas 142ea99832 Clang changes for overloading invariant.start and end intrinsics
This change depends on the corresponding LLVM change at:
https://reviews.llvm.org/D22519

The llvm.invariant.start and llvm.invariant.end intrinsics currently
support specifying invariant memory objects only in the default address
space.

With this LLVM change, these intrinsics are overloaded for any adddress space
for memory objects and we can use these llvm invariant intrinsics in
non-default address spaces.

Example: llvm.invariant.start.p1i8(i64 4, i8 addrspace(1)* %ptr)

This overloaded intrinsic is needed for representing final or invariant
memory in managed languages.

llvm-svn: 276448
2016-07-22 17:50:08 +00:00
Erik Pilkington 1ac8adfcab [CodeGen] Fix a crash when constant folding switch statement
Differential revision: https://reviews.llvm.org/D22542

llvm-svn: 276350
2016-07-21 22:31:40 +00:00
Adrian McCarthy ab1e786503 Reroll "Include unreferenced nested types in member list only for CodeView"
Another attempt at r276271, hopefully without breaking ModuleDebugInfo test.

llvm-svn: 276317
2016-07-21 18:43:20 +00:00
Adrian McCarthy a9a89ae77f Revert "Include unreferenced nested types in member list only for CodeView"
Patch broke ModuleDebugInfo test on the build bots (but not locally).  Again.

svn revision:  r276271

This reverts commit 9da8a1b05362bc96f2855fb32b5588b89407685d.

llvm-svn: 276279
2016-07-21 13:41:25 +00:00
Adrian McCarthy e89c62a102 Include unreferenced nested types in member list only for CodeView
Unreferenced nested structs and classes were omitted from the debug info.  In DWARF, this was intentional, to avoid bloat.  But for CodeView, we want this information to be consistent with what Microsoft tools would produce and expect.

llvm-svn: 276271
2016-07-21 13:16:14 +00:00
John McCall 4c7718d51b When copying an array into a lambda, destroy temporaries from
the copy-constructor immediately and enter a partial array
cleanup for previously-copied elements.

Fixes PR28595.

llvm-svn: 276180
2016-07-20 21:02:43 +00:00
David Majnemer 24547108d6 Let FuncAttrs infer the 'returned' argument attribute
This reverts commit r275756.

llvm-svn: 276014
2016-07-19 19:59:24 +00:00
NAKAMURA Takumi 966bde50c3 Revert r275678, "Revert "Revert r275027 - Let FuncAttrs infer the 'returned' argument attribute""
This reverts also r275029, "Update Clang tests after adding inference for the returned argument attribute"

It broke LTO build. Seems miscompilation.

llvm-svn: 275756
2016-07-18 03:23:25 +00:00
Hal Finkel 81cdef31e6 Revert "Revert r275029 - Update Clang tests after adding inference for the returned argument attribute"
This reverts commit r275043 after reapplying the underlying LLVM commit.

llvm-svn: 275679
2016-07-16 07:22:09 +00:00
Richard Smith a547eb27fa P0305R0: Semantic analysis and code generation for C++17 init-statement for 'if' and 'switch':
if (stmt; condition) { ... }

Patch by Anton Bikineev! Some minor formatting and comment tweets by me.

llvm-svn: 275350
2016-07-14 00:11:03 +00:00
David Majnemer f763b6711e Fix for the mingw builder
llvm-svn: 275191
2016-07-12 16:56:33 +00:00
David Majnemer 6d2b60a2be [ItaniumMangle] Correctly mangle BuiltinTemplateDecls
A BuiltinTemplateDecl has no underlying templated decl and as such they
cannot be relied upon for mangling.  The ItaniumMangler had some bugs
here which lead to crashes.

This fixes PR28519.

llvm-svn: 275190
2016-07-12 16:48:17 +00:00
David Majnemer 526793d14c [MS ABI] Support throwing/catching __unaligned types
We need to mark the appropriate bits in ThrowInfo and HandlerType so
that the personality routine can correctly handle qualification
conversions.

llvm-svn: 275154
2016-07-12 04:42:50 +00:00
Hal Finkel 9a17d7ac6e Revert r275029 - Update Clang tests after adding inference for the returned argument attribute
The associated backend change is causing miscompiles from the AArch64 backend.

llvm-svn: 275043
2016-07-11 04:52:07 +00:00
David Majnemer 60e5bdc470 [CodeGen] Treat imported static local variables as declarations
Imported variables cannot really be definitions for the purposes of
IR generation.

llvm-svn: 275040
2016-07-11 04:28:21 +00:00
Hal Finkel 617c962752 Update Clang tests after adding inference for the returned argument attribute
Adjusting tests after r275027.

llvm-svn: 275029
2016-07-10 22:26:52 +00:00
Adrian McCarthy 20128d94e5 Revert "Retry "Include debug info for nested structs and classes""
Reverting because it causes a test failure on build bots (Modules/ModuleDebugInfo.cpp).  Failure does not reproduce locally.

svn revision: rL274698

This reverts commit 3c5ed6599b086720aab5b8bd6941149d066806a6.

llvm-svn: 274706
2016-07-06 23:28:34 +00:00
Adrian McCarthy 0a8cb648c9 Retry "Include debug info for nested structs and classes"
This should work now that the LLVM-side of the change has landed successfully.

Original Differential Revision: http://reviews.llvm.org/D21705

This reverts commit a30322e861c387e1088f47065d0438c6bb019879.

llvm-svn: 274698
2016-07-06 22:39:15 +00:00
Adrian McCarthy 743f7f1aff Revert "Include debug info for nested structs and classes"
This reverts commit 0af5ee9631c7c167dc40498b415876553e314c95.

llvm-svn: 274633
2016-07-06 15:15:38 +00:00
Adrian McCarthy 73d726a6cc Include debug info for nested structs and classes
This includes nested types in the member list, even if there are no members of that type. Note that structs and classes have themselves as an "implicit struct" as the first member, so we skip implicit ones.

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

llvm-svn: 274628
2016-07-06 14:46:42 +00:00
Richard Smith d9b9009c61 PR28394: For compatibility with c++11 and c++14, if a static constexpr data
member is redundantly redeclared outside the class definition in code built in
c++17 mode, ensure we emit a non-discardable definition of the data member for
c++11 and c++14 compilations to use.

llvm-svn: 274416
2016-07-02 01:32:16 +00:00
David Majnemer bc5976ad58 [CodeView] Include MSVC style names for unnamed types
The CodeView printer expects to be able to generate fully qualified
names from the debug info graph.  This means that we need to include the
MSVC-style name in the debug info for anonymous types.

llvm-svn: 274401
2016-07-01 23:12:54 +00:00
Tim Shen 421119fd89 [Temporary, Lifetime] Add lifetime marks for temporaries
With all MaterializeTemporaryExprs coming with a ExprWithCleanups, it's
easy to add correct lifetime.end marks into the right RunCleanupsScope.

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

llvm-svn: 274385
2016-07-01 21:08:47 +00:00
Reid Kleckner 31abd80fbe [codeview] Emit qualified display names if -gline-tables-only is on
When -gmlt is on, we don't emit namespace or class scope information,
and the CodeView emission code in LLVM can't compute the fully qualified
name. If we know LLVM won't be able to get the name right, go ahead and
emit the qualified name in the frontend.

We could change our -gmlt emission strategy to include those scopes when
emitting codeview, but that would increase memory usage and slow down
LTO and add more complexity to debug info emission.

The same problem exists when you debug a -gmlt binary with GDB, so we
should consider removing '&& EmitCodeView' from the condition here at
some point in the future after evaluating the impact on object file
size.

llvm-svn: 274246
2016-06-30 17:41:31 +00:00
Reid Kleckner 12e64d953f Port some more debug info tests on Windows
llvm-svn: 274245
2016-06-30 17:41:27 +00:00
Dmitry Polukhin 79e2673f25 Fix CodeGenCXX/mangle-abi-tag.cpp on clang-ppc64le-linux bot
llvm-svn: 274223
2016-06-30 11:15:52 +00:00
Dmitry Polukhin 90bb49e362 [GCC] PR23529 Mangler part of attrbute abi_tag support
Original patch by Stefan Bühler http://reviews.llvm.org/D12834

Difference between original and this one:
- fixed all failing tests
- fixed mangling for global variable outside namespace
- emit ABI tags for guards and local names
- clang-format + other stylistic changes
- significantly reworked patch according to Richard's suggestions

Sema part, committed before http://reviews.llvm.org/D17567

Differential revision: http://reviews.llvm.org/D18035

llvm-svn: 274222
2016-06-30 09:40:38 +00:00
David Majnemer 02d57cc92c [MS ABI] Pick an inheritance model if we resolve an overload set
We didn't assign an inheritance model for 'Foo' if the event an
exrepssion like '&Foo::Bar' occured if 'Bar' could resolve to multiple
functions.

Once the overload set is resolved to a particular member, we enforce a
specific inheritance model.

This fixes PR28360.

llvm-svn: 274202
2016-06-30 03:02:03 +00:00
David Majnemer b4b671e4a8 [CodeView] Implement support for bitfields in Clang
Emit the underlying storage offset in addition to the starting bit
position of the field.

This fixes PR28162.

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

llvm-svn: 274201
2016-06-30 03:01:59 +00:00
Reid Kleckner ad1e22bf33 Re-land "[MS] Don't expect vftables to be provided for extern template instantiations"
Reverts r273305 and re-instates r273296.

We needed to fix a bug in Sema::MarkVTableUsed to ensure that operator
delete lookup occurs when the vtable is referenced. We already had a
special case to look up operator delete when dllimport was used, but I
think should really mark virtual destructors referenced any time the
vtable is used.

llvm-svn: 274147
2016-06-29 18:29:21 +00:00
Richard Smith 183b3014a4 Fix unreasonably-precise CHECK.
llvm-svn: 274050
2016-06-28 19:09:30 +00:00
Richard Smith 5179eb7821 P0136R1, DR1573, DR1645, DR1715, DR1736, DR1903, DR1941, DR1959, DR1991:
Replace inheriting constructors implementation with new approach, voted into
C++ last year as a DR against C++11.

Instead of synthesizing a set of derived class constructors for each inherited
base class constructor, we make the constructors of the base class visible to
constructor lookup in the derived class, using the normal rules for
using-declarations.

For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived
class that tracks the requisite additional information. We create shadow
constructors (not found by name lookup) in the derived class to model the
actual initialization, and have a new expression node,
CXXInheritedCtorInitExpr, to model the initialization of a base class from such
a constructor. (This initialization is special because it performs real perfect
forwarding of arguments.)

In cases where argument forwarding is not possible (for inalloca calls,
variadic calls, and calls with callee parameter cleanup), the shadow inheriting
constructor is not emitted and instead we directly emit the initialization code
into the caller of the inherited constructor.

Note that this new model is not perfectly compatible with the old model in some
corner cases. In particular:
 * if B inherits a private constructor from A, and C uses that constructor to
   construct a B, then we previously required that A befriends B and B
   befriends C, but the new rules require A to befriend C directly, and
 * if a derived class has its own constructors (and so its implicit default
   constructor is suppressed), it may still inherit a default constructor from
   a base class

llvm-svn: 274049
2016-06-28 19:03:57 +00:00
Peter Collingbourne cee7dce0dc Fix bad test expectation.
llvm-svn: 273760
2016-06-25 00:37:14 +00:00
Peter Collingbourne 0ca0363d05 CodeGen: Start emitting checked loads when both trapping CFI and -fwhole-program-vtables are enabled.
Differential Revision: http://reviews.llvm.org/D21122

llvm-svn: 273757
2016-06-25 00:24:06 +00:00
Richard Smith 62f19e700d Implement C++17 P0386R2, inline variables. (The 'inline' specifier gives a
variable weak discardable linkage and partially-ordered initialization, and is
implied for constexpr static data members.)

llvm-svn: 273754
2016-06-25 00:15:56 +00:00
Peter Collingbourne 8dd14da0dc CodeGen: Update Clang to use the new type metadata.
Differential Revision: http://reviews.llvm.org/D21054

llvm-svn: 273730
2016-06-24 21:21:46 +00:00
Richard Smith b130fe7d31 Implement p0292r2 (constexpr if), a likely C++1z feature.
llvm-svn: 273602
2016-06-23 19:16:49 +00:00
Reid Kleckner c4871eddb7 [codeview] Set the new IntroducedVirtual debug info flag
llvm-svn: 273454
2016-06-22 18:34:45 +00:00
Hans Wennborg 44d061a471 Add support for /Ob1 and -finline-hint-functions flags
Add support for /Ob1 (and equivalent -finline-hint-functions), which enable
inlining only for functions marked inline, either explicitly (via inline
keyword, for example), or implicitly (function definition in class body,
for example).

This works by enabling inlining pass, and adding noinline attribute to
every function not marked inline.

Patch by Rudy Pons <rudy.pons@ilod.org>!

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

llvm-svn: 273440
2016-06-22 16:56:16 +00:00
Reid Kleckner f981bcb3a0 Revert "[MS] Don't expect vftables to be provided for extern template instantiations"
This reverts commit r273296, it broke the Windows self-host.

llvm-svn: 273305
2016-06-21 19:51:52 +00:00
Reid Kleckner 93b4b2e386 [MS] Don't expect vftables to be provided for extern template instantiations
MSVC doesn't provide them. PR28223

I left behind the machinery in case we want to resurrect available_externally
vftable emission to support devirtualization.

Reviewers: majnemer

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

llvm-svn: 273296
2016-06-21 18:39:55 +00:00
David Majnemer 1fb3fd9c8c r273237 fixed PR28220, not PR28216
llvm-svn: 273239
2016-06-21 03:43:11 +00:00