Commit Graph

1085 Commits

Author SHA1 Message Date
David Blaikie fd07c604a9 Only emit debug info for implicit members that actually get codegen, not just ODR use.
This includes special members (copy/default ctor, copy assign, default
ctor) and template specializations for member function templates.

Good for a 5% decrease (1.80 to 1.71 GB) in size on Clang+LLVM's .dwo
files (when using fission).

llvm-svn: 188085
2013-08-09 17:20:05 +00:00
David Blaikie 79af384d72 DebugInfo: Don't prefer declarations over definitions in -flimit-debug-info in C
Without an ODR, the -flimit-debug-info debug info size optimization of
emitting declarations for fully defined types when only a declaration is
needed by the TU, is incorrect. Emit the full definition whenever it's
available in non-C++.

llvm-svn: 187611
2013-08-01 20:57:40 +00:00
David Blaikie 4a5b8958a8 DebugInfo: Emit template arguments for limited types used for context.
We emit definitions with no members when a nested type is
referenced/required (GCC does the same, to be fair) but failed to attach
the template arguments in such a case.

llvm-svn: 187608
2013-08-01 20:31:40 +00:00
David Blaikie 6f8f6008c2 Reduce a variable's scope (no functionality change)
llvm-svn: 187594
2013-08-01 18:23:24 +00:00
Adrian Prantl 49a78563d2 Debug Info: Fix an oversight of r186553. Ensure that the function prologue
of an artificial function gets an artificial location as well.

llvm-svn: 187074
2013-07-24 20:34:39 +00:00
Adrian Prantl ead2ba4649 Implement a better fix for r186894 by setting the appropriate type for __byref_variable_layout.
rdar://problem/14386148

llvm-svn: 186898
2013-07-23 00:12:14 +00:00
Adrian Prantl 52f5b2502f Debug Info: Acknowledge the alignment when locating byref block variables.
Fixes rdar://problem/14386148

llvm-svn: 186894
2013-07-22 23:44:26 +00:00
Eric Christopher 978c839315 Update createCompileUnit call for llvm changes.
llvm-svn: 186638
2013-07-19 00:51:58 +00:00
Adrian Prantl b75016d299 s/BuiltinLocation/ArtificialLocation/
llvm-svn: 186557
2013-07-18 01:36:04 +00:00
Eric Christopher f8bc4d878c Instead of checking against some version of "isType()" go ahead and
use the conversion to bool to check if we've managed to get a type
that isn't default constructed - as we meant to in the first place.

llvm-svn: 186556
2013-07-18 00:52:50 +00:00
Adrian Prantl 593f10ed81 Fix a compile error caught by bb-chapuni.
llvm-svn: 186555
2013-07-18 00:47:12 +00:00
Adrian Prantl 9aab9002a6 Fix a compile error caught by bb-chapuni.
llvm-svn: 186554
2013-07-18 00:43:29 +00:00
Adrian Prantl 2e0637ff63 Replace llvm::DIBuilder::DisableDebugLocations() with two RAII interfaces
inspired by CodegenFunction::LexicalScope.
- NoLocation temporarily turns off debug locations altogether.
  This is useful for emitting instructions that should be
  counted towards the function prologue.
- BuiltinLocation temporarily switches to an artificial debug location
  that has a valid scope, but no line information. This is useful when
  emitting compiler-generated helper functions that have no source
  location associated with them.

llvm-svn: 186552
2013-07-18 00:28:02 +00:00
Adrian Prantl 02c0caa198 Clarified documentation.
llvm-svn: 186551
2013-07-18 00:27:59 +00:00
Adrian Prantl b1b3bfc068 Simplify logic by using the appropriate function.
llvm-svn: 186550
2013-07-18 00:27:56 +00:00
Eric Christopher ffdeb1eb03 80-column fixes.
llvm-svn: 186542
2013-07-17 22:52:53 +00:00
Eric Christopher 324bbbd16a Move BlockLiteralGeneric earlier in CGDebugInfo and remove
BlockLiteralGenericSet and replace with a call to isType() on the
BlockLiteralGeneric.

llvm-svn: 186293
2013-07-14 21:12:44 +00:00
Eric Christopher 35f1f9fc28 Update a few comments and reformat a decl for clarity.
llvm-svn: 186292
2013-07-14 21:00:07 +00:00
David Blaikie 48ad6dc463 PR16214, PR14467: DebugInfo: use "RequireCompleteType" to decide when to emit the full definition of a type in -flimit-debug-info
This simplifies the core benefit of -flimit-debug-info by taking a more
systematic approach to avoid emitting debug info definitions for types
that only require declarations. The previous ad-hoc approach (3 cases
removed in this patch) had many holes.

The general approach (adding a bit to TagDecl and callback through
ASTConsumer) has been discussed with Richard Smith - though always open
to revision.

llvm-svn: 186262
2013-07-13 21:08:14 +00:00
David Blaikie 66ed89d07f Correctly classify pack expansions as NON_CANONICAL_UNLESS_DEPENDENT
Test coverage for non-dependent pack expansions doesn't demonstrate a
failure prior to this patch (a follow-up commit improving debug info
will cover this commit specifically) but covers a related hole in our
test coverage.

Reviewed by Richard Smith & Eli Friedman.

llvm-svn: 186261
2013-07-13 21:08:08 +00:00
Adrian Prantl 7278788ffe Reapply an improved version of r180816/180817.
Do not generate VLAs as complex variables any more, as they are now
correctly represented as breg+0 locations in the backend.

(Paired commit with LLVM: r185966)

rdar://problem/13658587

llvm-svn: 185967
2013-07-09 20:29:03 +00:00
Manman Ren 0d441f1853 Debug Info: clean up usage of Verify.
No functionality change. It should suffice to check the type of a debug info
metadata, instead of calling Verify.

llvm-svn: 185463
2013-07-02 19:01:53 +00:00
Peter Collingbourne 5c5e6179a0 Use the zero-argument DIBuilder::createNullPtrType in Clang.
Differential Revision: http://llvm-reviews.chandlerc.com/D1051

llvm-svn: 185115
2013-06-27 22:51:01 +00:00
Eli Friedman 2782dacfbc Rewrite record layout for ms_struct structs.
The old implementation of ms_struct in RecordLayoutBuilder was a
complete mess: it depended on complicated conditionals which didn't
really reflect the underlying logic, and placed a burden on users of
the resulting RecordLayout. This commit rips out almost all of the
old code, and replaces it with simple checks in
RecordLayoutBuilder::LayoutBitField.

This commit also fixes <rdar://problem/14252115>, a bug where class
inheritance would cause us to lay out bitfields incorrectly.

llvm-svn: 185018
2013-06-26 20:50:34 +00:00
Reid Kleckner 8a36502a60 [AST] Introduce a new DecayedType sugar node
The goal of this sugar node is to be able to look at an arbitrary
FunctionType and tell if any of the parameters were decayed from an
array or function type.  Ultimately this is necessary to implement
Microsoft's C++ name mangling scheme, which mangles decayed arrays
differently from normal pointers.

Reviewers: rsmith

Differential Revision: http://llvm-reviews.chandlerc.com/D1014

llvm-svn: 184763
2013-06-24 17:51:48 +00:00
David Blaikie ce1ae387d6 DebugInfo: ensure negative enumerators are emitted as such
There's still a problem here - since we're not appropriately using the
signedness/range of the enum to chooset the encoding and emission of
enumerators, but GCC has some bugs around this too so I assume that's
not /such/ a high priority though I may get to it soon out of
completeness.

llvm-svn: 184695
2013-06-24 07:13:13 +00:00
David Blaikie 47c1150f50 DebugInfo: Support (using GNU extensions) for template template parameters and parameter packs
llvm-svn: 184644
2013-06-22 18:59:18 +00:00
David Blaikie 18cfbc53ee DebugInfo: Random tidying up/simplification
No functionality change intended.

llvm-svn: 184614
2013-06-22 00:09:36 +00:00
David Blaikie 940ca4d462 PR16214: Debug info for types first used via pointers or qualified types & later require definitions
llvm-svn: 184594
2013-06-21 21:03:11 +00:00
David Blaikie f7bcb0c279 Fix all the silly things I committed in r184509
llvm-svn: 184512
2013-06-21 00:59:44 +00:00
David Blaikie b8f2fbbe97 Alternative fix for r184473.
This just seems a bit tidier/more principled. Based on a patch provided
by Adrian - with the only minor tweak that it needed to use
"getTypeOrNull" rather than "getCompletedTypeOrNull" since we don't
store declarations in the CompletedTypes cache.

No intended functionality change.

llvm-svn: 184509
2013-06-21 00:40:50 +00:00
Adrian Prantl dba725c0be Debug Info: Attempt to resolve forward declarations if we are not emitting
limited debug info.

This is another small addendum to r184252.

rdar://problem/14101097

llvm-svn: 184473
2013-06-20 21:17:24 +00:00
David Blaikie b9c667d808 Debug Info: PR14763/r183329 - specify that non-trivial pass-by-value parameters are stored indirectly
This is to fix the location information for such parameters to refer to
the object accessible through the pointer rather than to the pointer
parameter itself.

llvm-svn: 184367
2013-06-19 21:53:53 +00:00
Adrian Prantl 1f56b2a4f1 Add some comments to r184252.
rdar://problem/14101097

llvm-svn: 184259
2013-06-18 23:32:21 +00:00
Adrian Prantl c1a3fe7f9b Emit forward decls for structs with declarations only when we are
limiting debug info.

FIXME: There is still work left to do here, the testcase should work even with -flimit-debug-info.

rdar://problem/14101097

llvm-svn: 184252
2013-06-18 23:01:56 +00:00
Eric Christopher 1ecc5634d6 80-column fixup after recent change to getOrCreateType.
llvm-svn: 183586
2013-06-07 22:54:39 +00:00
Adrian Prantl a4ce906bc0 address some comments on r183474:
- factor the name construction part out from constructSetterName
- rename constructSetterName to the more appropriate constructSetterSelector

no functionality change intended.
rdar://problem/14035789

llvm-svn: 183582
2013-06-07 22:29:12 +00:00
Adrian Prantl 817bbb3a81 documentation: remove confusing reference to properties.
llvm-svn: 183475
2013-06-07 01:10:48 +00:00
Adrian Prantl b8fad1a37c ObjC Debug Info: Emit the names of accessors whenever they diverge from
the default names, not just when the isImplicit flag is set.

rdar://problem/14035789

llvm-svn: 183474
2013-06-07 01:10:45 +00:00
Adrian Prantl c4de1ef38c Improve documentation.
llvm-svn: 183473
2013-06-07 01:10:41 +00:00
David Blaikie 205a30d83d PR14763: Debug info for non-trivial record parameters
There seems to have been some erroneous code attempting to describe the
ABI of parameters (non-trivial record parameters are passed by
reference). This would break the type of the function (especially when
it caused a mismatch between the type of a declaration & a definition)
causing PR14763 and PR14645.

llvm-svn: 183329
2013-06-05 18:30:31 +00:00
David Blaikie e36464c2f6 PR16214: Debug Info: -flimit-debug-info doesn't omit definitions for types used via typedefs
In an effort to make -flimit-debug-info more consistent I over-shot the
mark & made types used via typedefs never produce definitions in the
debug info (even if the type was used in a way that would require a
definition).

The fix for this is to do exactly what I was hoping to do at some point
- plumb the declaration/definition choice through the various layers of
"CreateType" in CGDebugInfo. In this way we can produce declarations
whenever they are sufficient & definitions otherwise - including when
qualifiers are used, for example (discovered in PR14467). This may not
be complete (there may be other types/situations where we need to
propagate the "declaration/definition" choice) but it lays the basic
foundation which we can enhance in future iterations.

llvm-svn: 183296
2013-06-05 05:32:23 +00:00
David Blaikie 4583bea0b2 DebugInfo: Rename CreatePointerType to getOrCreateTypeDeclaration
To make this more consistent with 'getOrCreateType' & clarify the
distinction between the two. The only thing I couldn't quite communicate
in the name is that getOrCreateTypeDeclaration may actually produce a
full definition (in -fno-limit-debug-info) but the point is to call it
whenever only a declaration is needed & the implementation can choose
whether to provide a declaration or definition.

(also, unfortunately, getOrCreateType can produce declarations too - we
should sure this up by making it not do that - any caller that can
tolerate a declaration should be calling getOrCreateTypeDeclaration
instead)

llvm-svn: 182674
2013-05-24 21:33:22 +00:00
David Blaikie 22c460a051 PR16091: Error when attempting to emit debug info for undeduced auto return types
Perhaps we should just suppress this, rather than erroring, but since we
have the infrastructure for it I figured I'd use it - if this is
determined to be not the right thing we should probably remove that
infrastructure entirely. I guess it's lying around from the early days
of implementing debug info support.

llvm-svn: 182673
2013-05-24 21:24:35 +00:00
David Blaikie 469f07969e Debug Info: Handle function/method types using the most specific type
llvm-svn: 182533
2013-05-22 23:22:42 +00:00
Adrian Prantl 5f3601016c Comment and cleanup.
rdar://problem/13359718

llvm-svn: 182524
2013-05-22 21:37:49 +00:00
Adrian Prantl ef6fca5536 Bugfix for r181629:
- The return type should be a pointer to the class type.
- Make the condition more specific.

rdar://problem/13359718

llvm-svn: 182504
2013-05-22 19:10:15 +00:00
David Blaikie 8e5939b605 Debug Info: Simplify the code changed in r182403 to reduce indent & avoid a duplicate lookup in the insertion case
llvm-svn: 182404
2013-05-21 18:29:40 +00:00
David Blaikie 77a887bacb Debug Info: don't bother reinserting elements into maps we just retrieved them from
(no intended behavior change)

llvm-svn: 182403
2013-05-21 18:08:19 +00:00
David Blaikie fefc7f7a5d Fix whitespace
llvm-svn: 182400
2013-05-21 17:58:54 +00:00
David Blaikie f121b9302e PR14606: Debug Info for namespace aliases/DW_TAG_imported_module
This resolves the last of the PR14606 failures in the GDB 7.5 test
suite. (but there are still unresolved issues in the imported_decl case
- we need to implement optional/lazy decls for functions & variables
like we already do for types)

llvm-svn: 182329
2013-05-20 22:50:41 +00:00
David Blaikie bd4837665b Revert "Revert "Debug Info: Using declarations/DW_TAG_imported_declaration of variables, types, and functions.""
This reverts commit r181947 (git d2990ce56a16050cac0d7937ec9919ff54c6df62 )

This addresses one of the two issues identified in r181947, ensuring
that types imported via using declarations only result in a declaration
being emitted for the type, not a definition. The second issue (emitting
using declarations that are unused) is hopefully an acceptable increase
as the real fix for this would be a bit difficult (probably at best we
could record which using directives were involved in lookups - but may
not have been the result of the lookup).

This also ensures that DW_TAG_imported_declarations (& directives) are
not emitted in line-tables-only mode as well as ensuring that typedefs
only require/emit declarations (rather than definitions) for referenced
types.

llvm-svn: 182231
2013-05-20 04:58:53 +00:00
Adrian Prantl b39fc142fd Drop the const from the isa test.
llvm-svn: 182178
2013-05-17 23:58:45 +00:00
Adrian Prantl 6e785ec019 ObjC Debug Info: Emit the correct method names for accessors for
properties declared in a protocol.

rdar://problem/13798000

llvm-svn: 182176
2013-05-17 23:49:10 +00:00
Eric Christopher 0fdcb315e3 80-columns.
llvm-svn: 181965
2013-05-16 00:52:20 +00:00
Eric Christopher 75e1768b46 Replace a pile of calls with an instance variable that's set
once. Should be no functional change.

llvm-svn: 181964
2013-05-16 00:45:23 +00:00
Eric Christopher b2a008c615 Whitespace.
llvm-svn: 181960
2013-05-16 00:45:12 +00:00
David Blaikie db35281468 Revert "Debug Info: Using declarations/DW_TAG_imported_declaration of variables, types, and functions."
This reverts commit r181393 (git 3923d6a87fe7b2c91cc4a7dbd90c4ec7e2316bcd).

This seems to be emitting too much extra debug info for two (known)
reasons:
* full class definitions are emitted when only declarations are expected
* unused using declarations still produce DW_TAG_imported_declarations

llvm-svn: 181947
2013-05-15 23:46:19 +00:00
David Blaikie 11ecabf4eb PR15956: Debug Info: Include the appropriate file location in types created due to using declarations
We might benefit from API refactoring here (why pass in a value that's
derived from another parameter?) but this is the immediate issue.

llvm-svn: 181747
2013-05-14 00:34:20 +00:00
David Blaikie d900f98bdf Debug Info: PR14992: Support values for non-type template parameters of function type
llvm-svn: 181685
2013-05-13 06:57:50 +00:00
David Blaikie 4cb63df342 Debug Info: Comment changes in r181393 by request of echristo
llvm-svn: 181672
2013-05-12 18:05:52 +00:00
David Blaikie 2b93c54c4a Debug Info: correct comment
Eric's code review feedback to r181644

llvm-svn: 181650
2013-05-10 23:36:06 +00:00
David Blaikie 7e4c8b0642 Debug Info: Silently accept template argument packs
We could support the GCC extension DW_TAG_GNU_template_parameter_pack if
we're feeling adventurous, at some point - but I don't think GDB's doing
anything useful with it yet anyway.

llvm-svn: 181644
2013-05-10 22:53:25 +00:00
David Blaikie 38079fd26f PR14992: Debug Info: Support more non-type template parameters
* Provide DW_TAG_template_value_parameter for pointers, function
  pointers, member pointers, and member function pointers (still missing
  support for template template parameters which GCC encodes as a
  DW_TAG_GNU_template_template_param)
* Provide values for all but the (member & non-member) function pointer case.
  Simple constant integer values for member pointers (offset within the
  object) and address for the value pointer case. GCC doesn't provide a
  value for the member function pointer case so I'm not sure how, if at
  all, GDB supports encoding that. & non-member function pointers should
  follow shortly in a subsequent patch.
* Null pointer value encodings of all of these types, including
  correctly encoding null data member pointers as -1.

llvm-svn: 181634
2013-05-10 21:53:14 +00:00
Adrian Prantl 7bec903850 ObjC debug info: Substitute the class type for methods that return
a related type (e.g., if they use the instancetype keyword).

rdar://problem/13359718

llvm-svn: 181629
2013-05-10 21:08:31 +00:00
David Blaikie f03b2e8385 Debug Info: Remove unnecessary check for dependent array types
This was added, untested (though the relevant crash was tested), in
r128725/PR9600. Removing it doesn't cause failures & nothing I can
imagine could cause this check to ever return 'true' (we should never be
dealing with dependent types here). The subsequent change to check
"isIncompleteType" (r128855/PR9608) makes a lot more sense.

llvm-svn: 181542
2013-05-09 20:48:12 +00:00
Adrian Prantl c20237d21f typo
llvm-svn: 181485
2013-05-08 23:37:22 +00:00
David Blaikie b0b645cad1 Debug Info: Using declarations/DW_TAG_imported_declaration of variables, types, and functions.
Basic support is implemented here - it still doesn't account for
declared-but-not-defined variables or functions. It cannot handle out of
order (declared, 'using', then defined) cases for variables, but can
handle that for functions (& can handle declared, 'using'd, and not
defined at all cases for types).

llvm-svn: 181393
2013-05-08 06:01:46 +00:00
David Blaikie fd5aa13549 DebugInfo: Support imported modules (using directives) within lexical blocks.
llvm-svn: 181272
2013-05-06 23:33:13 +00:00
Adrian Prantl ab067ae8b0 Revert 180817 because 180816 was reverted.
llvm-svn: 180823
2013-04-30 22:45:09 +00:00
Adrian Prantl 7e2b05c378 Do not generate VLAs as complex variables any more, as they are now
correctly represented as breg+0 locations in the backend.

(Paired commit with LLVM: r180815)

rdar://problem/13658587

llvm-svn: 180817
2013-04-30 22:17:36 +00:00
David Blaikie 9f88fe865c Revert "Revert "PR14606: Debug info for using directives/DW_TAG_imported_module""
This reverts commit 179839 now that the corresponding LLVM patch has been fixed.

llvm-svn: 179997
2013-04-22 06:13:21 +00:00
Adrian Prantl c60dc718c0 Emit the underlying type in the debug info for all kinds of fixed enums
instead of only C++11-scoped-with-class-tag enums.

rdar://problem/13463793

llvm-svn: 179879
2013-04-19 19:56:39 +00:00
Eric Christopher 3669c3c603 Revert "PR14606: Debug info for using directives/DW_TAG_imported_module"
This reverts commit r179837 as it seems to be causing test failures.

llvm-svn: 179839
2013-04-19 07:46:36 +00:00
David Blaikie cf5e5bade1 PR14606: Debug info for using directives/DW_TAG_imported_module
More changes later for using declarations/DW_TAG_imported_declaration.

llvm-svn: 179837
2013-04-19 07:04:02 +00:00
David Blaikie bfa5274df5 Give CGDebugInfo::getContextDescriptor a more specific return type
Not that the DI* hierarchy is terribly type safe, but this makes the contract a
little clearer I think.

llvm-svn: 179835
2013-04-19 06:56:38 +00:00
John McCall c8e0170578 Standardize accesses to the TargetInfo in IR-gen.
Patch by Stephen Lin!

llvm-svn: 179638
2013-04-16 22:48:15 +00:00
Eric Christopher 5c7ee8b996 Revert "Revert r178079, it caused PR15637."
This reverts commit r178497 since the backend has been fixed.

Also add a test to ensure that we're emitting template information for unions.

llvm-svn: 178587
2013-04-02 22:59:11 +00:00
Nico Weber 0f27c6079b Revert r178079, it caused PR15637.
Also add a test for PR15637.

llvm-svn: 178497
2013-04-01 20:33:18 +00:00
Adrian Prantl 0f6df00e4d Bugfix/Followup for r177086.
* Store the .block_descriptor (instead of self) in the alloca so we
  can guarantee that all captured variables are available at -O0.
* Add the missing OpDeref for the alloca.
rdar://problem/12767564

llvm-svn: 178361
2013-03-29 19:20:35 +00:00
Adrian Prantl de17db30d8 Improvement on r177086.
* Let DIType for block-captured self to point to the completed cached
  interface type.
rdar://problem/12767564

llvm-svn: 178360
2013-03-29 19:20:29 +00:00
David Blaikie 49ae6a7cf8 Remove magic number usage from CGDebugInfo with new DICompositeType::setContainingType
llvm-svn: 178092
2013-03-26 23:47:35 +00:00
David Blaikie 2ebf08ecbd Debug Info: remove use of magic numbers to tweak specific debug info metadata fields
llvm-svn: 178079
2013-03-26 22:09:53 +00:00
Nick Lewycky c02bbb61e1 Make clang emit linkage names in debug info for subprograms when coverage info
is enabled. Also add a new -test-coverage cc1 flag which makes testing coverage
possible and add our first clang-side coverage test.

llvm-svn: 177470
2013-03-20 01:38:16 +00:00
Adrian Prantl 616bef4ad1 Always declare the .block_descriptor parameter, not just the local copy.
Un-breaks gdb's invoke-block behavior.

llvm-svn: 177118
2013-03-14 21:52:59 +00:00
Adrian Prantl 51936dd0bc Allocate stack storage for .block_descriptor and captured self at -O0.
This way the register allocator will not optimize away the debug info
for captured variables.

Fixes rdar://problem/12767564

llvm-svn: 177086
2013-03-14 17:53:33 +00:00
Adrian Prantl c782242a12 Force column info to be generated for call expressions so we can
differentiate multiple inlined call sites on the same line
in the debug info.

Fixes rdar://problem/13036237

llvm-svn: 176895
2013-03-12 20:43:25 +00:00
Adrian Prantl 73409ce90f Improve the caching of debuginfo Objective C interface types.
Generate forward declarations that are RAUW'd by finalize().
We thus avoid outputting the same type several times in multiple
stages of completion.

llvm-svn: 176820
2013-03-11 18:33:46 +00:00
Adrian Prantl a03a85a425 Ensure that DIType is regenerated after we visit an implementation
that adds ivars to an interface.

Fixes rdar://13175234

This is an update to r176116 that performs a smart caching of interfaces.

llvm-svn: 176584
2013-03-06 22:03:30 +00:00
Adrian Prantl 68a5750d5d Temporarily revert r176116 for compile-time performance regression.
This reverts commit ea95e4587fd13606fbf63b10a07a7d02026aa39c.

llvm-svn: 176151
2013-02-27 01:31:55 +00:00
Adrian Prantl 71510db7bc Ensure that DIType is regenerated after we visited an implementation that adds ivars to an interface. Fixes rdar://13175234
llvm-svn: 176116
2013-02-26 20:01:46 +00:00
David Blaikie 6d4fe1592d Update Clang for a minor DIBuilder breaking change.
llvm-svn: 176003
2013-02-25 01:07:08 +00:00
Eric Christopher f1545838d7 Propagate the split dwarf file information through into the backend
and through to the debug info in the module. In order to make the
testcase a bit more efficient allow the filename to go through
compilation for compile and not assemble jobs and turn off the
extract for cases where we don't create an object.

llvm-svn: 175935
2013-02-22 23:50:16 +00:00
Benjamin Kramer 9170e914fc Streamify getNameForDiagnostic and remove the string versions of PrintTemplateArgumentList.
llvm-svn: 175894
2013-02-22 15:46:01 +00:00
Eric Christopher c0c5d46c81 Fix formatting and tabs in file.
llvm-svn: 175815
2013-02-21 22:35:08 +00:00
Fariborz Jahanian 65f1fa1bb2 Patch for debug info of qualified-id types is 'id'
By Adrian Pranti.

llvm-svn: 175793
2013-02-21 20:42:11 +00:00
Guy Benyei 610541989a Add OpenCL samplers as Clang builtin types and check sampler related restrictions.
llvm-svn: 174601
2013-02-07 10:55:47 +00:00
David Blaikie b7d1e1ff57 Revert r174246, accidentally committed.
This reverts commit 1513eb9284c23acfd19cf742b95996fbb11ca741.

llvm-svn: 174249
2013-02-02 00:39:32 +00:00
David Blaikie ef50169a03 Basics
llvm-svn: 174246
2013-02-02 00:34:16 +00:00
David Blaikie 357aafb566 Fix exception handling line table problems introduced by r173593
r173593 made us a little too eager to associate all code at the end of a
function with the user-written 'return' line. This caused problems with
breakpoints as they'd be set in exception handling code preceeding the
actual non-exception return handling code, leading to the breakpoint never
being hit in non-exceptional execution.

This change restores the pre-r173593 exception handling line information where
the cleanup code is associated with the '}' not the return line.

llvm-svn: 174206
2013-02-01 19:09:49 +00:00
David Blaikie 0a21d0da17 PR14566: Debug Info: avoid top level lexical blocks in functions
One of the gotchas (see changes to CodeGenFunction) was due to the fix in
r139416 (for PR10829). This only worked previously because the top level
lexical block would set the location to the end of the function, the debug
location would be updated (as per r139416), the location would be set to
the end of the function again (but that would no-op, since it was the same
as the previous location), then the return instruction would be emitted using
the debug location.

Once the top level lexical block was no longer emitted, the end-of-function
location change was causing the debug loc to be updated, regressing that bug.

llvm-svn: 173593
2013-01-26 22:16:26 +00:00
NAKAMURA Takumi 3e0a363021 CGDebugInfo.cpp: Fix a warning. [-Wunused-variable]
llvm-svn: 173022
2013-01-21 10:51:28 +00:00
David Blaikie 0549106d88 PR14472: Preserve qualifiers while unwrapping types for debug info
Looks like r161368 fixed this for one case but not all. This change generalizes
the solution over all the unwrapping cases. Now that preserving the qualifiers
is done independent of the particular type being unwrapped I won't bother
adding test cases for each one but at least demonstrate that this change was
necessary & sufficient to fix the bug.

llvm-svn: 173002
2013-01-21 04:37:12 +00:00
Guy Benyei 1b4fb3e08b Implement OpenCL event_t as Clang builtin type, including event_t related OpenCL restrictions (OpenCL 1.2 spec 6.9)
llvm-svn: 172973
2013-01-20 12:31:11 +00:00
David Blaikie d42917f01c The last of PR14471: Debug info support for inline in-class initializer for float static members
llvm-svn: 172942
2013-01-20 01:19:17 +00:00
David Blaikie 2c705ca98d Emit the function type of member function pointer types the same as member functions.
Adding the pseudo first parameter to a member function pointer's function type
and mark it as artificial.

Combined with a fix to GDB ( http://sourceware.org/bugzilla/show_bug.cgi?id=14998 )
this fixes gdb.cp/member-ptr.exp with Clang.

llvm-svn: 172911
2013-01-19 19:20:56 +00:00
Eric Christopher 91a3190a28 Collect both normal and static data members of a class in source
order. Describe static data members to metadata using new interfaces.

Part of PR14471.

Patch by Paul Robinson!

llvm-svn: 172591
2013-01-16 01:22:32 +00:00
David Blaikie 7eb0685969 Extract the instance-method case for debug info out into a separate function.
This is in preparation for using this to construct the function type for
pointers to member functions to include the implicit/artificial 'this'
parameter in that case as well. (feedback from GDB indicates that this might be
all that's necessary to get it to behave well with Clang's pointer-to-member
function debug output)

llvm-svn: 171809
2013-01-07 23:06:35 +00:00
David Blaikie 2aaf065103 Simplify computing debug info type for static member functions.
No (intended) functional change.

llvm-svn: 171800
2013-01-07 22:24:59 +00:00
David Blaikie 18f7c59946 PR14759: Improve/correct support for debug info for C++ member pointers.
Using added LLVM functionality in r171698. This works in GDB for member
variable pointers but not member function pointers. See the LLVM commit and
GDB bug 14998 for details.

Un-xfailing cases in the GDB 7.5 test suite will follow.

llvm-svn: 171699
2013-01-07 05:55:03 +00:00
David Blaikie 219c7d9f64 PR14573: Unnamed parameters in debug info, Part 2
Catch some cases I'd missed in r171605 related to unnamed parameters of record
type. This resolves all remaining cases of PR14573 suppression in the GDB 7.5
test suite. Fix to the test suite to follow.

llvm-svn: 171633
2013-01-05 20:03:07 +00:00
David Blaikie a76a7c902a Emit debug info for unnamed parameters.
LLVM ignores this data for now - patch for that to follow.

llvm-svn: 171605
2013-01-05 05:58:35 +00:00
Eric Christopher 0f75943780 Fix fieldNo usage for lambdas. No behavior change since the
field number was 0 anyhow.

llvm-svn: 171472
2013-01-04 17:59:07 +00:00
Chandler Carruth ffd5551bc7 Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate to
reflect the migration in r171366.

Re-sort the #include lines to reflect the new paths.

llvm-svn: 171369
2013-01-02 11:45:17 +00:00
Guy Benyei d8a08ea98d Re-commit r170428 changes with Linux style file endings.
Add OpenCL images as clang builtin types.

llvm-svn: 170432
2012-12-18 14:38:23 +00:00
Guy Benyei 11169dded0 Revert changes from r170428, as I accidentally changed the line endings of these files to Windows style.
llvm-svn: 170431
2012-12-18 14:30:41 +00:00
Guy Benyei b13abb952a Add OpenCL images as clang builtin types.
llvm-svn: 170428
2012-12-18 12:30:03 +00:00
David Blaikie 831c9927e8 Debug Info: Emit vtables pointer members as artificial.
I wasn't sure where to put the test case for this, but this seemed like as good
a place as any. I had to reorder the tests here to make them legible while
still matching the order of metadata output in the IR file (for some reason
making it virtual changed the ordering).

Relevant commit to fix up LLVM to actually respect 'artificial' member
variables is coming once I write up a test case for it.

llvm-svn: 170154
2012-12-13 22:29:06 +00:00
Bill Wendling 751afdc3d1 Use the 'count' attribute to calculate the upper bound of an array.
The count attribute is more accurate with regards to the size of an array. It
also obviates the upper bound attribute in the subrange. We can also better
handle an unbound array by setting the count to -1 instead of the lower bound to
1 and upper bound to 0.

llvm-svn: 169311
2012-12-04 21:33:58 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Bill Wendling 1ca9862cfb Add a 'count' field to the DWARF subrange.
The count field is necessary because there isn't a difference between the 'lo'
and 'hi' attributes for a one-element array and a zero-element array. When the
count is '0', we know that this is a zero-element array. When it's >=1, then
it's a normal constant sized array. When it's -1, then the array is unbounded.

llvm-svn: 169219
2012-12-04 06:21:27 +00:00
Fariborz Jahanian 998f0a3360 objective-C blocks: Make sure that identical logic is used
in deciding a copy/dispose field is needed in a byref structure
and when generating the copy/dispose helpers. In certain
cases, these fields were being added but no copy/dispose was
being generated. This was uncovered in ARC, but not in MRR.
// rdar://12759433

llvm-svn: 168825
2012-11-28 23:12:17 +00:00
Richard Smith 1648847248 A step towards sorting out handling of triviality of special members in C++11.
Separate out the notions of 'has a trivial special member' and 'has a
non-trivial special member', and use them appropriately. These are not
opposites of one another (there might be no special member, or in C++11 there
might be a trivial one and a non-trivial one). The CXXRecordDecl predicates
continue to produce incorrect results, but do so in fewer cases now, and
they document the cases where they might be wrong.

No functionality changes are intended here (they will come when the predicates
start producing the right answers...).

llvm-svn: 168119
2012-11-16 00:53:38 +00:00
Dmitri Gribenko b2aa9234b6 Use empty parens for empty function parameter list instead of '(void)'.
llvm-svn: 168041
2012-11-15 14:28:07 +00:00
Fariborz Jahanian cad7e371d0 Fix 80-column violation.
llvm-svn: 167932
2012-11-14 17:27:27 +00:00
Fariborz Jahanian a9d4464baf objective-C blocks: Provide layout map for byref
variables captured in a block. // rdar://12184410

llvm-svn: 167931
2012-11-14 17:15:51 +00:00
Eric Christopher 175c72656f Revert "Use the 'count' attribute instead of the 'upper_bound' attribute."
temporarily since it breaks the gdb bots.

This reverts commit r167807/30305bec25cac981c6d4a3b8be004401310a82a7.

llvm-svn: 167887
2012-11-13 23:30:57 +00:00
Bill Wendling 2415b3b6b0 Use the 'count' attribute instead of the 'upper_bound' attribute.
If we have a type 'int a[1]' and a type 'int b[0]', the generated DWARF is the
same for both of them because we use the 'upper_bound' attribute. Instead use
the 'count' attrbute, which gives the correct number of elements in the array.
<rdar://problem/12566646>

llvm-svn: 167807
2012-11-13 02:31:58 +00:00
Eli Friedman 8593748ed5 Put something sane in the DWARF offset field for bitfield ObjC ivars.
This is useful because unnamed bitfields can have effects on the
offsets which are not otherwise reflected in the DWARF information.

<rdar://problem/12629719>

llvm-svn: 167503
2012-11-06 23:40:48 +00:00
David Blaikie 8ed46b9935 Emit debug info for C++ struct definitions as DW_TAG_structure_type (instead of class_type).
llvm-svn: 167336
2012-11-02 23:40:00 +00:00
David Blaikie d37bbc3e00 Fix debug tag type of forward declarations of struct/class in C++.
llvm-svn: 167308
2012-11-02 20:49:01 +00:00
Richard Smith 9c6890a792 Simplify: replace getContext().getLangOpts() with just getLangOpts().
llvm-svn: 167261
2012-11-01 22:30:59 +00:00
Alexey Samsonov 9b502e512c Initialize debug info for special cases of functions that lack declarations and are generated by Clang (global initializers/destructors, thunks) . Fixes PR13942.
llvm-svn: 166676
2012-10-25 10:18:50 +00:00
Douglas Gregor b0eea8b54b Switch CodeGenOptions over to a .def file, like we do with LangOptions.
llvm-svn: 166497
2012-10-23 20:05:01 +00:00
Eric Christopher 56b8a200e1 Fix up comment and invert order. Most simple check first.
llvm-svn: 166240
2012-10-18 22:08:02 +00:00
Eric Christopher a2f7eb7c52 Add a new option for and disable column number information as there
are no known current users of column info. Robustify and fix up
a few tests in the process. Reduces the size of debug information
by a small amount.

Part of PR14106

llvm-svn: 166236
2012-10-18 21:52:18 +00:00
Eric Christopher 086da34119 Revert r158009 since there are some uses of artificial functions in
debug info.

llvm-svn: 166109
2012-10-17 17:37:17 +00:00
Eli Friedman 9ee2d04753 Make -mms-bitfields behave consistently.
Patch by Jeremiah Zanin.

llvm-svn: 165849
2012-10-12 23:29:20 +00:00
Micah Villmow 083189730e Add in the first iteration of support for llvm/clang/lldb to allow variable per address space pointer sizes to be optimized correctly.
llvm-svn: 165726
2012-10-11 17:21:41 +00:00
Micah Villmow dd31ca10ef Move TargetData to DataLayout.
llvm-svn: 165395
2012-10-08 16:25:52 +00:00
Eli Friedman 9018ef709e Make sure to generate the right kind of MDNode for enum forward declarations.
PR14029, clang part.

llvm-svn: 165289
2012-10-05 01:49:33 +00:00
Eric Christopher a52a6a8351 Mark the passed in "self" for a block as an object pointer so
that the backend can mark it as the representative pointer for
the block.

rdar://12001329

llvm-svn: 164418
2012-09-21 22:18:42 +00:00
Eric Christopher 173d91092a Grammar.
llvm-svn: 164260
2012-09-19 22:40:44 +00:00
Eric Christopher bdb1abb72a Update and expand comment.
llvm-svn: 164254
2012-09-19 22:01:42 +00:00
Eric Christopher 7106ec3ecb Handle a captured this for the debug information as well.
llvm-svn: 164253
2012-09-19 21:47:34 +00:00
Eric Christopher 0f143ae8af Fix awkward comment.
llvm-svn: 164252
2012-09-19 21:47:29 +00:00
Eric Christopher 31ce693f93 Reapply:
Make clang emit a flag for DW_AT_object_pointer for the artificial
    args where it should (implicit first arguments). FileCheck-ize a
    test as well and update tests to take into account the object
    pointer flag.

    rdar://9797999

llvm-svn: 163755
2012-09-12 23:36:49 +00:00
Eric Christopher 48f782bbd2 Revert "Make clang emit a flag for DW_AT_object_pointer for the artificial"
this should be done on the subprogram, not the variable.

llvm-svn: 163733
2012-09-12 18:42:10 +00:00
Eric Christopher 1d292e59d3 Make clang emit a flag for DW_AT_object_pointer for the artificial
args where it should (implicit first arguments). FileCheck-ize a
test as well and update tests to take into account the object
pointer flag.

rdar://9797999

llvm-svn: 163668
2012-09-12 00:27:32 +00:00
Eric Christopher 13453d32ff Update comment and space.
llvm-svn: 163586
2012-09-11 01:36:56 +00:00
Eric Christopher 5296db0805 The type of the self and cmd variables should be artificial. (Note
that the types aren't artificial the args are, but this is currently
represented by an artificial type.)

Found by inspection.

llvm-svn: 163585
2012-09-11 01:36:54 +00:00
Roman Divacky e637711ae0 Dont cast away const needlessly. Found by gcc48 -Wcast-qual.
llvm-svn: 163325
2012-09-06 15:59:27 +00:00
Joao Matos e9a3ed4d71 Normalize line endings of r163013 (part 2).
llvm-svn: 163032
2012-08-31 22:18:20 +00:00
Joao Matos dc86f94f62 Improved MSVC __interface support by adding first class support for it, instead of aliasing to "struct" which had some incorrect behaviour. Patch by David Robins.
llvm-svn: 163013
2012-08-31 18:45:21 +00:00
Eric Christopher 4a903df403 Reapply:
Author: Eric Christopher <echristo@apple.com>
Date:   Thu Aug 16 23:50:46 2012 +0000

    Add some caching here for the builtin types.

    rdar://12117935

    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162066 91177308-0d34-0410-b5e6-96231b3b80d8

after fixing a thinko.

llvm-svn: 162243
2012-08-20 23:32:17 +00:00
Eric Christopher ff5760132d Reapply:
Make isa part of objc_object at metadata generation time.

Noticed on inspection.

llvm-svn: 162145
2012-08-17 22:54:57 +00:00
Eric Christopher 8d9ccdc7a5 Temporarily revert r162066 and r162062 to see if it brings the gdb
bots back.

llvm-svn: 162080
2012-08-17 04:42:07 +00:00
Richard Smith 122a3a8e6f Fix undefined behavior in debug info emission: operator* on WeakVH returns a
reference, so &* on an empty WeakVH binds a reference to a dereferenced null
pointer. So don't do that; we have a perfectly good implicit conversion to
Value*.

llvm-svn: 162079
2012-08-17 04:17:54 +00:00
Eric Christopher 476e5a3c9e Add some caching here for the builtin types.
rdar://12117935

llvm-svn: 162066
2012-08-16 23:50:46 +00:00
Eric Christopher 11b4463a94 Make isa part of objc_object at metadata generation time.
Noticed on inspection.

llvm-svn: 162062
2012-08-16 23:50:35 +00:00
Eric Christopher 921cf137b3 This is always going to be true so the cast isn't necessary.
llvm-svn: 161744
2012-08-13 02:07:42 +00:00
Eric Christopher 06d29572e1 If we don't have a complete type for the array type yet either then
just let the alignment be zero.

PR13531

llvm-svn: 161379
2012-08-07 00:48:43 +00:00
Eric Christopher 5b3ec2630a Remove some unintended changes from my last patch.
llvm-svn: 161369
2012-08-07 00:18:40 +00:00
Eric Christopher 33becaa77a Make sure when we get the replacement type for a template argument
that we attach the lost qualifiers.

Fixes rdar://11882155

llvm-svn: 161368
2012-08-07 00:14:25 +00:00
Benjamin Kramer e073177e06 Simplify code, no functionality change.
llvm-svn: 161303
2012-08-04 17:00:46 +00:00
Eric Christopher 08af4c8461 Fix the name of this variable.
llvm-svn: 161287
2012-08-04 00:11:22 +00:00
Eric Christopher 47cff54422 Update comment to accurately reflect what should happen.
llvm-svn: 161286
2012-08-04 00:11:20 +00:00
Eric Christopher f8b9809fab Temporarily revert this to see if it brings the gdb bot back.
llvm-svn: 160049
2012-07-11 15:32:13 +00:00
Eric Christopher 2977378974 The end of a block doesn't necessarily need a line table entry unless
there's something going on there. Remove the unconditional line entry
and only add one if we're emitting cleanups (any other statements
would be handled normally).

Fixes rdar://9199234

llvm-svn: 160033
2012-07-11 01:49:26 +00:00
Benjamin Kramer 2ef3031496 Remove get(V)BaseClassOffsetInBits, the CharUnit functions should be used instead.
No functionality change.

llvm-svn: 159719
2012-07-04 18:45:14 +00:00
Eric Christopher c939e50846 Fix grammar.
llvm-svn: 159321
2012-06-28 01:20:05 +00:00
Benjamin Kramer e6dcf106b2 Don't circumvent the debug info type cache when emitting info for EnumConstantDecl.
CreateEnumType doesn't participate in caching so the descriptor for the enum
gets recomputed for every reference of an element of an enum, only to get
discarded when it gets turned into an MDNode.

No functionality change except performance.

llvm-svn: 158832
2012-06-20 18:11:18 +00:00
John McCall 5fb5df9c83 Restructure how the driver communicates information about the
target Objective-C runtime down to the frontend:  break this
down into a single target runtime kind and version, and compute
all the relevant information from that.  This makes it
relatively painless to add support for new runtimes to the
compiler.  Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z,
available at the driver level as a better and more general
alternative to -fgnu-runtime and -fnext-runtime.  This new
concept of an Objective-C runtime also encompasses what we
were previously separating out as the "Objective-C ABI", so
fragile vs. non-fragile runtimes are now really modelled as
different kinds of runtime, paving the way for better overall
differentiation.

As a sort of special case, continue to accept the -cc1 flag
-fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak.

I won't go so far as to say "no functionality change", even
ignoring the new driver flag, but subtle changes in driver
semantics are almost certainly not intended.

llvm-svn: 158793
2012-06-20 06:18:46 +00:00
Bill Wendling d4da16c193 Remove unused variable.
llvm-svn: 158353
2012-06-12 06:53:25 +00:00
Michael J. Spencer d1e09a4282 [C++11 Compat] Fix breaking change in C++11 pair copyctor.
While this code is valid C++98, it is not valid C++11. The problem can be
reduced to:

class MDNode;

class DIType {
  operator MDNode*() const {return 0;}
};

class WeakVH {
  WeakVH(MDNode*) {}
};

int main() {
  DIType di;
  std::pair<void*, WeakVH> p(std::make_pair((void*)0, di)));
}

This was not detected by any of the bots we have because they either compile
C++98 with libstdc++ (which allows it), or C++11 with libc++ (which incorrectly
allows it). I ran into the problem when compiling with VS 2012 RC.

Thanks to Richard for explaining the issue.

llvm-svn: 158245
2012-06-08 23:47:12 +00:00
Benjamin Kramer 6003ad5848 Plug a long standing memory leak in TemplateArgument.
The integral APSInt value is now stored in a decomposed form and the backing
store for large values is allocated via the ASTContext. This way its not
leaked as TemplateArguments are never destructed when they are allocated in
the ASTContext. Since the integral data is immutable it is now shared between
instances, making copying TemplateArguments a trivial operation.

Currently getting the integral data out of a TemplateArgument requires creating
a new APSInt object. This is cheap when the value is small but can be expensive
if it's not. If this turns out to be an issue a more efficient accessor could
be added.

llvm-svn: 158150
2012-06-07 15:09:51 +00:00
David Blaikie 40ed29730b Revert Decl's iterators back to pointer value_type rather than reference value_type
In addition, I've made the pointer and reference typedef 'void' rather than T*
just so they can't get misused. I would've omitted them entirely but
std::distance likes them to be there even if it doesn't use them.

This rolls back r155808 and r155869.

Review by Doug Gregor incorporating feedback from Chandler Carruth.

llvm-svn: 158104
2012-06-06 20:45:41 +00:00
Eric Christopher beafa44be8 Reapply "Only emit debug information for methods that are user defined, there's"
As the failing testcase has been fixed.

This reverts commit 0637f407e6ee7fdccde17fbf9a5fcc4853187b3e.

llvm-svn: 158009
2012-06-05 18:16:22 +00:00
John McCall 65485d7694 Revert "Only emit debug information for methods that are user defined, there's"
This reverts r157970, which was not passing on
  clang-x86_64-darwin10-nobootstrap-RA

llvm-svn: 157983
2012-06-05 06:10:39 +00:00
Eric Christopher f5dad49a65 Only emit debug information for methods that are user defined, there's
not much reason to emit for constructors and destructors that aren't
user defined.

rdar://11593099

llvm-svn: 157970
2012-06-05 00:15:06 +00:00
Eric Christopher 31a1fc6654 Support C++11 enum forward declarations.
Part of rdar://11570854

llvm-svn: 157787
2012-06-01 00:22:57 +00:00
Eric Christopher a91af14b8d Emit C++11 enum class information if it exists.
Part of rdar://11496790

llvm-svn: 157304
2012-05-23 00:09:47 +00:00
Eric Christopher 246bb99397 Revert r115805. An array type is required to have a range type,
however, the range can be unknown for the upper bound.

Testcase to follow.

Part of rdar://11457152

llvm-svn: 157212
2012-05-21 22:13:23 +00:00
Eric Christopher fe0913b026 Update API usage for llvm DIBuilder changes for rvalue reference
types and ensure we are actually creating the type.

rdar://11479676

llvm-svn: 157095
2012-05-19 01:36:50 +00:00
Eric Christopher de098cd08f Remove unnecessary temporary.
llvm-svn: 156953
2012-05-16 22:02:36 +00:00
Eric Christopher c0e7a3d78c The address of a vla is actually complex and requires a dereference.
Part of rdar://11352000

llvm-svn: 156407
2012-05-08 18:56:47 +00:00
Eric Christopher 40d057fd7d Whitespace.
llvm-svn: 156406
2012-05-08 18:56:42 +00:00
Argyrios Kyrtzidis bbff3da622 Make BuiltinType::getName return a StringRef and introduce BuiltinType::getNameAsCString
to get a const char* if necessary.

This avoids unnecessary conversions when we want to use the result of getName as
a StringRef.

Part of rdar://10796159

llvm-svn: 156227
2012-05-05 04:20:28 +00:00
Alexey Samsonov 74a3868dbb This patch adds a new Clang compiler flag "-gline-tables-only".
It reduces the amount of emitted debug information:
1) DIEs in .debug_info have types DW_TAG_compile_unit, DW_TAG_subprogram,
DW_TAG_inlined_subroutine (for opt builds) and DW_TAG_lexical_block only.
2) .debug_str contains only function names.
3) No debug data for types/namespaces/variables is emitted.
4) The data in .debug_line is enough to produce valid stack traces with
function names and line numbers.

Reviewed by Eric Christopher.

llvm-svn: 156160
2012-05-04 07:39:27 +00:00
David Blaikie 2d7c57ec1d Remove the ref/value inconsistency in filter_decl_iterator.
filter_decl_iterator had a weird mismatch where both op* and op-> returned T*
making it difficult to generalize this filtering behavior into a reusable
library of any kind.

This change errs on the side of value, making op-> return T* and op* return
T&.

(reviewed by Richard Smith)

llvm-svn: 155808
2012-04-30 02:36:29 +00:00
Alexey Samsonov 486e1fe954 Use enum to set debug info size generated by Clang
llvm-svn: 155697
2012-04-27 07:24:20 +00:00
Eric Christopher 3cc207bbcc Forward declarations should take a context. This helps the debugger
find forward declarations in the context that the actual definition
will occur.

rdar://11291658

llvm-svn: 155381
2012-04-23 19:00:24 +00:00
Benjamin Kramer 6d3f11142d Avoid string thrashing when we can concatenate them in the final buffer.
llvm-svn: 154678
2012-04-13 18:00:37 +00:00
Eric Christopher db1554c035 static functions have a need for mangled name debug information too.
The mangler doesn't like non-prototyped functions so only use a mangled
name for prototyped functions.

rdar://11079003

llvm-svn: 154570
2012-04-12 00:35:06 +00:00
Eric Christopher 3d19de9910 Enable debug info for objective c implementations that may not have
an explicit instance variable.

rdar://10590352

llvm-svn: 154481
2012-04-11 05:56:05 +00:00
Eric Christopher f3dd713bce Only emit the getter and setter names if they're not the default
synthesized ones. Reasonable debug info size reduction for objc.

rdar://11179756

llvm-svn: 154129
2012-04-05 22:03:32 +00:00
Eric Christopher b7e821a6aa Change location information for synthesized properties to be at the
property file/line rather than the @synthesize file/line. Avoids
some nasty confusing-ness with conflating the file from the scope
and the line from the original declaration. Use    the current scope
location as a separate parameter so that we can    match it up
better in the line table with the beginning of the scope.

Update a couple of testcases accordingly since I had to change
that we actually use the passed in location in EmitFunctionStart
and for the new metadata parameter and add a new testcase to
make sure we've got the right line numbers for synthesized
properties.

Part of rdar://11026482

llvm-svn: 153917
2012-04-03 00:44:15 +00:00
Eric Christopher fef37f81b4 Revert previous commit changing location information to see if this
is causing the gdb test failures on the bots.

llvm-svn: 153727
2012-03-30 05:42:12 +00:00
Eric Christopher df02b36a2c Change location information for synthesized properties to be at the
property file/line rather than the @synthesize file/line. Avoids
some nasty confusing-ness with conflating the file from the scope
and the line from the original declaration.

Update a couple of testcases accordingly since I had to change
that we actually use the passed in location in EmitFunctionStart.

Fixes rdar://11026482

llvm-svn: 153714
2012-03-30 01:07:48 +00:00
Eric Christopher bd9c910c8c Go back to using just the selector name for the getter and setter
in the property debug info. Any more isn't necessary after all.

rdar://11144023

llvm-svn: 153659
2012-03-29 17:31:33 +00:00
Eric Christopher eb03169b9a Add support for objc property decls according to the page at:
http://llvm.org/docs/SourceLevelDebugging.html#objcproperty

    including type and DECL. Expand the getter and setter names
    into the fully qualified names.

    rdar://11144023

llvm-svn: 153640
2012-03-29 08:43:37 +00:00
Benjamin Kramer e894e09e70 Simplify some users of DenseMap::erase.
llvm-svn: 153389
2012-03-24 18:22:12 +00:00
Eric Christopher 6dde3e1450 Update comment.
llvm-svn: 153149
2012-03-20 23:28:32 +00:00
Benjamin Kramer 8cc491a601 Debug info: Tighten up uses of plain MDNode pointers which don't survive replaceOperandWith.
TrackingVH notices when it gets RAUW'd. Fixes PR12305 and PR12315.

llvm-svn: 153115
2012-03-20 19:49:14 +00:00
Eric Christopher d36ad66785 Add support to mangle templated member function names with template
args.

Fixes rdar://11042577

llvm-svn: 152691
2012-03-14 00:25:46 +00:00
Eric Christopher 947bb5a1f1 When adding member functions to a class add any specializations of
function templates as well.

A future commit will mangle the added name with the template args
like classes are mangled.

Fixes rdar://10986010

llvm-svn: 152683
2012-03-13 23:40:48 +00:00
David Blaikie bbafb8a745 Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).
The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

llvm-svn: 152536
2012-03-11 07:00:24 +00:00
Eric Christopher 4b6753cf10 Reapply r151702 with a small fix for a failure to cut and paste
correctly.

Still rdar://10900684

llvm-svn: 151838
2012-03-01 21:36:52 +00:00
Daniel Dunbar c2f9dc91c1 Revert r151702, "Add support for handling captured variables in lambda debug
info.", which broke some -O0 -g tests.

llvm-svn: 151730
2012-02-29 16:28:29 +00:00
Eric Christopher 3203f6b9da Add support for handling captured variables in lambda debug info.
This currently doesn't handle capturing the 'this' pointer for any
enclosing class.

Steal the lambda-expressions.cpp testcase and debugify it and try
to use more variables to proof it against random changes.

Part of rdar://10900684

llvm-svn: 151702
2012-02-29 03:25:30 +00:00
Eric Christopher 7a5fdd8746 ObjcInterfaceTypes are also complete types for the type cache.
Fixes rdar://10934887

llvm-svn: 151519
2012-02-27 08:23:23 +00:00
Eric Christopher 55b2bfa7c1 Add a quick TODO.
llvm-svn: 151217
2012-02-23 00:43:12 +00:00
Eric Christopher 8678a4a987 Formatting.
llvm-svn: 150996
2012-02-20 23:02:36 +00:00
Eric Christopher 66562a4a54 Remove the type retaining from the clang frontend. This is now
handled by the caching and rauw. Also fix one cache that wasn't
being added to highlighted by this patch. Update all testcases
accordingly.

This should fix the deall failure.

llvm-svn: 150977
2012-02-20 18:05:24 +00:00
Eric Christopher e908a7a92c Make forward declarations for objective-c types use the new
temporary forward declaration nodes. Fixes a problem building
Chrome.

llvm-svn: 150976
2012-02-20 18:05:04 +00:00
Eric Christopher 1c3785aae9 Add in a caching mechanism so that forward declarations are replaced
with full types if they exist.

rdar://10809898 and rdar://10209967 and rdar://10400981

llvm-svn: 150858
2012-02-18 00:50:17 +00:00
Eric Christopher 1a0c882a22 Formatting.
llvm-svn: 150857
2012-02-18 00:50:14 +00:00
Eric Christopher 71006f2378 Remove UpdateCompletedType from the debug info emission. We now
emit less than complete types on purpose on occasion and so
our caches aren't useful for this kind of lazy emitting.

llvm-svn: 150856
2012-02-18 00:50:08 +00:00
Eric Christopher 2939e6e136 Index "12" holds the vtable, not "9".
Fixes lots of gdb testsuite failures.

llvm-svn: 150797
2012-02-17 07:09:48 +00:00
Eric Christopher 4c006e557d Reapply r150631:
"Add a completed/incomplete type difference. This allows us to have
    partial types for contexts and forward decls while allowing us to
    complete types later on for debug purposes.

    This piggy-backs on the metadata replacement and rauw changes
    for temporary nodes and takes advantage of the incremental
    support I added in earlier. This allows us to, if we decide,
    to limit adding methods and variables to structures in order
    to limit the amount of debug information output into a .o file.

    The caching is a bit complicated though so any thoughts on
    untangling that are welcome."

with a fix:

 - Remove all RAUW during type construction by adding stub versions
   of types that we later complete.

and some TODOs:

 - Add an RAUW cache for forward declared types so that we can replace
   them at the end of compilation.
 - Remove the code that updates on completed types because we no
   longer need to have that happen. We emit incomplete types on
   purpose and only want to know when we want to complete them.

llvm-svn: 150752
2012-02-16 22:54:45 +00:00
Eric Christopher 9a89705d03 Revert "Add a completed/incomplete type difference. This allows us to have"
This reverts commit 9a68d4584afcd0853b930bd80235b58736e785b4.

llvm-svn: 150637
2012-02-15 23:51:20 +00:00
Eric Christopher 7381907e65 Add a completed/incomplete type difference. This allows us to have
partial types for contexts and forward decls while allowing us to
complete types later on for debug purposes.

This piggy-backs on the metadata replacement and rauw changes
for temporary nodes and takes advantage of the incremental
support I added in earlier. This allows us to, if we decide,
to limit adding methods and variables to structures in order
to limit the amount of debug information output into a .o file.

The caching is a bit complicated though so any thoughts on
untangling that are welcome.

llvm-svn: 150631
2012-02-15 23:25:18 +00:00
Eric Christopher fe52523b4c Add back in the code to create forward decls using temporary mdnodes.
llvm-svn: 150390
2012-02-13 15:08:45 +00:00
Eric Christopher 8a41bd88d7 Temporarily walk back a few of my recent debug info limiting changes
while reworking how we handle wanting to emit only parts of structures.

Fixes PR11970.

llvm-svn: 150388
2012-02-13 14:56:11 +00:00
Eric Christopher 39e39c8efe Don't cache the artificial type for the this pointer, there's no
difference in the qual type. This is a workaround for the fact that
the type isn't artificial but the this decl is, however, we don't
have any way of representing it in the current metadata. For now,
however, just don't cache the full type.

Fixes rdar://10831526 and probably a couple of others.

llvm-svn: 150159
2012-02-09 07:26:21 +00:00
Eric Christopher b2db8e47e2 Constify the getClassName routine and variables that come out of it,
and then use it for forward decl names.

Part of rdar://10209967 and rdar://10400981

llvm-svn: 150040
2012-02-08 01:53:14 +00:00
Eric Christopher 75b90c4a86 Use the new forward declaration scheme for records. Also add more
caching of results after we create them.

Fixes rdar://10809898

llvm-svn: 150025
2012-02-08 00:23:18 +00:00
Devang Patel 00fca3a106 Remove tabs.
llvm-svn: 150021
2012-02-08 00:10:20 +00:00
Benjamin Kramer 7ec12c928a Revert my patches which removed Diagnostic.h includes by moving some operator overloads out of line.
This seems to negatively affect compile time onsome ObjC tests
(which use a lot of partial diagnostics I assume). I have to come
up with a way to keep them inline without including Diagnostic.h
everywhere. Now adding a new diagnostic requires a full rebuild
of e.g. the static analyzer which doesn't even use those diagnostics.

This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99.
This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789.
This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7.
This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f.
This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5.

llvm-svn: 150006
2012-02-07 22:29:24 +00:00
Devang Patel 56a321df0b Remove tabs.
llvm-svn: 149996
2012-02-07 18:55:08 +00:00
Devang Patel 37a5c9564d Emit debug info for properites that are not backed by an ivar.
llvm-svn: 149995
2012-02-07 18:40:30 +00:00
Chris Lattner ece0409a1a simplify a bunch of code to use the well-known LLVM IR types computed by CodeGenModule.
llvm-svn: 149943
2012-02-07 00:39:47 +00:00
Devang Patel f93d0b8b28 Relax valid location check. This fixes a clang crash while emitting debug info for properties that are synthesized by the compiler by default.
llvm-svn: 149929
2012-02-06 23:24:13 +00:00
Devang Patel 60fc242545 Let an ivar directly refer property TAG.
llvm-svn: 149881
2012-02-06 18:20:02 +00:00
Dylan Noblesmith 2c1dd2716a Basic: import SmallString<> into clang namespace
(I was going to fix the TODO about DenseMap too, but
that would break self-host right now. See PR11922.)

llvm-svn: 149799
2012-02-05 02:13:05 +00:00
Benjamin Kramer 3307c508c9 Move various diagnostic operator<< overloads out of line and remove includes of Diagnostic.h.
Fix all the files that depended on transitive includes of Diagnostic.h.
With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer.

llvm-svn: 149781
2012-02-04 12:31:12 +00:00
Devang Patel a21bbb2423 Create new tag for the property. This is a work in progress.
llvm-svn: 149734
2012-02-04 01:15:04 +00:00
Andrew Trick 877d5a712d unnecessary include of TargetMachine.h?
llvm-svn: 149638
2012-02-02 22:36:19 +00:00
Eric Christopher c9e6924fb2 r149474 went a bit too far when combined with type caching. If we want
a full type go ahead and emit it if we currently only have a forward
declaration.

Fixes gdb bots for gdb1090.exp and call-ar-st.exp.

llvm-svn: 149560
2012-02-01 23:39:00 +00:00
Eric Christopher 25a11e6dbd Remove duplicated comment.
llvm-svn: 149544
2012-02-01 21:48:10 +00:00
Eric Christopher ee4ab93906 For pass-by-value record arguments to functions emit a forward decl
instead of the entire class definition.

llvm-svn: 149474
2012-02-01 06:07:23 +00:00
Eric Christopher f59218e5d9 Use createRecordFwdDecl here since that's what we're doing.
llvm-svn: 149051
2012-01-26 07:11:58 +00:00
Eric Christopher 8913bd6c63 Revert previous patch unifying all of the C++ record prep in one area,
the gdb testsuite complains too much about the ordering of items printed,
even if the offsets in the debug info are correct.

This reverts commit 027cb30af828f07750f9185782822297a5c57231.

llvm-svn: 149049
2012-01-26 07:01:04 +00:00
Eric Christopher 5720033cc1 Remove another duplicated variable.
llvm-svn: 149047
2012-01-26 06:20:57 +00:00
Eric Christopher 9f94fa368a Tidy and remove some unused variables.
llvm-svn: 149015
2012-01-26 02:05:28 +00:00
Eric Christopher 5bfde1aa42 Collect this information together. No reason to have it split.
llvm-svn: 149013
2012-01-26 01:57:29 +00:00
Eric Christopher a15e6352fe Refactor into its own function.
llvm-svn: 149012
2012-01-26 01:57:13 +00:00
Eric Christopher bfecca3331 Clean up comment.
llvm-svn: 148982
2012-01-25 21:47:09 +00:00
Eric Christopher 000b14e796 Refactor the record decl forward declaration code a bit.
llvm-svn: 148904
2012-01-25 02:06:59 +00:00
Eric Christopher 45c4d47b8a When adding types to the context chain for record types, just emit
a forward declaration unless we already have a type. We can fill it in
later if it's actually used.

Fixes PR11345

llvm-svn: 148584
2012-01-20 22:10:15 +00:00
David Blaikie e4d798f078 More dead code removal (using -Wunreachable-code)
llvm-svn: 148577
2012-01-20 21:50:17 +00:00
Richard Smith dafff94759 constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,
APValue::Array and APValue::MemberPointer. All APValue values can now be emitted
as constants.

Add new CGCXXABI entry point for emitting an APValue MemberPointer. The other
entrypoints dealing with constant member pointers are no longer necessary and
will be removed in a later change.

Switch codegen from using EvaluateAsRValue/EvaluateAsLValue to
VarDecl::evaluateValue. This performs caching and deals with the nasty cases in
C++11 where a non-const object's initializer can refer indirectly to
previously-initialized fields within the same object.

Building the intermediate APValue object incurs a measurable performance hit on
pathological testcases with huge initializer lists, so we continue to build IR
directly from the Expr nodes for array and record types outside of C++11.

llvm-svn: 148178
2012-01-14 04:30:29 +00:00
Eric Christopher 8c363622d3 Formatting.
llvm-svn: 147989
2012-01-12 01:26:58 +00:00
Eric Christopher ffbc4d0b68 Formatting.
llvm-svn: 147988
2012-01-12 01:26:51 +00:00
Richard Smith 5fab0c9e1a Small refactoring and simplification of constant evaluation and some of its
clients. No functionality change.

llvm-svn: 147318
2011-12-28 19:48:30 +00:00
Eric Christopher cd88813dbf When in a limited debug information situation if we can find the original
declaration for the type then go ahead and use that, it's still smaller
than creating an all new derived type.

Part of rdar://10335756 and others.

llvm-svn: 146779
2011-12-16 23:40:18 +00:00
Eric Christopher ea225fb412 Start down the path of getting clang to internally agree on structs versus
classes.

Part of rdar://10520586 and a couple others.

llvm-svn: 146778
2011-12-16 23:40:14 +00:00
Douglas Gregor c8b0c9d8fd When generating debug info for an ObjCInterfaceDecl, try to dig out the definition.
llvm-svn: 146705
2011-12-15 23:32:29 +00:00
Douglas Gregor dc9166c8e1 Keep track of all declarations of an Objective-C class (both forward
declarations and definitions) as ObjCInterfaceDecls within the same
redeclaration chain. This new representation matches what we do for
C/C++ variables/functions/classes/templates/etc., and makes it
possible to answer the query "where are all of the declarations of
this class?"

llvm-svn: 146679
2011-12-15 20:29:51 +00:00
Eric Christopher 607fb70750 Make sure that forward declarations are marked as such in the debug info
for the structure type.

rdar://10499337

llvm-svn: 145461
2011-11-29 23:57:40 +00:00
Eric Christopher 459532e1d5 Use the canonical decl to index so that we can really find it later.
Fixes rdar://10433202

llvm-svn: 144938
2011-11-17 23:45:00 +00:00
Eric Christopher 04832b9210 Fixup comment.
llvm-svn: 144548
2011-11-14 18:55:02 +00:00
Nick Lewycky 1679035122 Reflow lines, remove else-if after returns, rename variable "TydefContext" to
"TypedefContext". No functionality change.

llvm-svn: 144248
2011-11-10 00:34:02 +00:00
Nick Lewycky 6aad6df4d1 Reflow one line I missed in previous cleanup commit. No functionality change.
llvm-svn: 144168
2011-11-09 04:27:23 +00:00
Nick Lewycky 2219ef0b68 Minor cleanup, mostly reindenting. Remove one helper function that just called
the other helper functions, since we already differentiated the cases it was
testing between. No functionality change.

llvm-svn: 144167
2011-11-09 04:25:21 +00:00
Richard Smith 7b553f1b19 Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it will
implicitly perform an lvalue-to-rvalue conversion if used on an lvalue
expression. Also improve the documentation of Expr::Evaluate* to indicate which
of them will accept expressions with side-effects.

llvm-svn: 143263
2011-10-29 00:50:52 +00:00
Devang Patel fa59ac363e In case of template specialization, do not try to delay emitting debug info for concrete type in -flimit-debug-info mode. This fixes some of the failures from bs15503.exp tests in gdb testsuite.
llvm-svn: 143227
2011-10-28 21:12:13 +00:00
Devang Patel 242ce91ecc Do not drop type qualifiers in -flimit-debug-info mode.
llvm-svn: 142873
2011-10-24 23:15:17 +00:00
Nick Lewycky ba743b75cb Take DW_AT_comp_dir from $PWD when it's present and starts with a '/'. This is
closer to what GCC does, except that GCC also checks that the inodes for $PWD
and '.' match.

llvm-svn: 142633
2011-10-21 02:32:14 +00:00
John McCall e314e27c58 Macro metaprogramming for builtin types.
llvm-svn: 142420
2011-10-18 21:02:43 +00:00
John McCall 8a6b59ad97 Add a new placeholder type to represent "unbridged"
casts in ARC.

No semantic analysis yet.

llvm-svn: 142208
2011-10-17 18:09:15 +00:00
Anton Korobeynikov f0c267e6e0 Provide half floating point support as a storage only type.
Lack of half FP was a regression compared to llvm-gcc.

llvm-svn: 142016
2011-10-14 23:23:15 +00:00
Benjamin Kramer 47b5b31e61 Simplify code to avoid a useless string copy.
llvm-svn: 141970
2011-10-14 18:45:16 +00:00
Benjamin Kramer fd0b05f341 Upgrade to PathV2.
llvm-svn: 141969
2011-10-14 18:45:11 +00:00
Benjamin Kramer 13481e27cb Add parens to pacify GCC.
llvm-svn: 141968
2011-10-14 18:45:06 +00:00
Eric Christopher 7cdf948601 Recommit:
Start handling debug line and scope information better:

    Migrate most of the location setting within the larger API in CGDebugInfo and
    update a lot of callers.
    Remove the existing file/scope change machinery in UpdateLineDirectiveRegion
    and replace it with DILexicalBlockFile usage.

    Finishes off the rest of rdar://10246360

after fixing a few bugs that were exposed in gdb testsuite testing.

llvm-svn: 141893
2011-10-13 21:45:18 +00:00
Eric Christopher 93663b3c62 Revert file/scope handling patches. gdb testing revealed a couple of bugs.
llvm-svn: 141796
2011-10-12 18:39:35 +00:00
Eric Christopher 663b7f353e Remember to set the location in EmitGlobalVariable to the current decl
if we're going to delete the setLocation as we did in 141732.

llvm-svn: 141762
2011-10-12 01:11:30 +00:00
Eric Christopher 498b7fd7fe Start handling debug line and scope information better:
Migrate most of the location setting within the larger API in CGDebugInfo and
update a lot of callers.
Remove the existing file/scope change machinery in UpdateLineDirectiveRegion
and replace it with DILexicalBlockFile usage.

Finishes off the rest of rdar://10246360

llvm-svn: 141732
2011-10-11 23:00:55 +00:00
Eric Christopher fefafacf68 80-column and tab cleanup.
llvm-svn: 141731
2011-10-11 23:00:51 +00:00
Eric Christopher fb4cd4082c Reorder this to make it easier to add more changes for a location set.
llvm-svn: 141730
2011-10-11 23:00:45 +00:00
Richard Smith caf3390d44 Constant expression evaluation refactoring:
- Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions,
   and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert
   behaviour.
 - Factor out evaluation of bitfield bit widths.
 - Fix a few places which would evaluate an expression twice: once to determine
   whether it is a constant expression, then again to get the value.

llvm-svn: 141561
2011-10-10 18:28:20 +00:00
Eli Friedman 0dfb889575 Support for C1x _Atomic specifier (see testcase). This is primarily being committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic.
Thanks to Jeffrey Yasskin for the thorough review!

llvm-svn: 141330
2011-10-06 23:00:33 +00:00
Eric Christopher fab289a47d When constructing debug information for synthesized variables for the
non-fragile ABI we may not be able to lay out the type and the debugger
would ignore us even if we did put in the offset. Go ahead and just
put any value there and don't look up the offset since it may not exist.

rdar://10210157

llvm-svn: 141261
2011-10-06 00:31:18 +00:00
Eric Christopher 8c552308c6 Reformat comment.
llvm-svn: 141260
2011-10-06 00:30:52 +00:00
Argyrios Kyrtzidis b8c3aaf479 Allow getting all source locations of selector identifiers in a ObjCMethodDecl.
Instead of always storing all source locations for the selector identifiers
we check whether all the identifiers are in a "standard" position; "standard" position is

  -Immediately before the arguments: -(id)first:(int)x second:(int)y;
  -With a space between the arguments: -(id)first: (int)x second: (int)y;
  -For nullary selectors, immediately before ';': -(void)release;

In such cases we infer the locations instead of storing them.

llvm-svn: 140989
2011-10-03 06:37:04 +00:00
Eric Christopher 2f45aaa755 Change "Regions" to be "LexicalBlocks" since that's what they
correspond to.

llvm-svn: 140740
2011-09-29 00:00:45 +00:00
Eric Christopher bfa4dc5512 Rename EmitStopPoint in CGDebugInfo to EmitLocation. "stop points" don't
exist anymore.

llvm-svn: 140739
2011-09-29 00:00:41 +00:00
Eric Christopher 4fd315ffbd Reorder functions in the file.
llvm-svn: 140738
2011-09-29 00:00:37 +00:00
Eric Christopher e655657c94 Call UpdateLineDirectiveRegion every time we want to emit a stop
point in the code. Ensures that we don't miss any places and the
check is reasonably cheap.

llvm-svn: 140737
2011-09-29 00:00:35 +00:00
Eric Christopher 250511bc75 Update comment.
llvm-svn: 140736
2011-09-29 00:00:31 +00:00
Eric Christopher 9c13eeac99 Update comments.
llvm-svn: 140531
2011-09-26 15:03:22 +00:00
Peter Collingbourne a834166e48 Create a VTableContext class and start moving CodeGenVTables methods to it
llvm-svn: 140502
2011-09-26 01:56:30 +00:00
David Blaikie 9c902b5502 Rename Diagnostic to DiagnosticsEngine as per issue 5397
llvm-svn: 140478
2011-09-25 23:23:43 +00:00
David Blaikie aa347f9392 Removing a bunch of dead returns/breaks after llvm_unreachables.
llvm-svn: 140407
2011-09-23 20:26:49 +00:00
David Blaikie 83d382b1ca Switch assert(0/false) llvm_unreachable.
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Devang Patel 5a54065c4f Tighten check to match an ivar with corresponding property by using ObjCImplementationDecl.
Radar 10139522 - Part 1.

llvm-svn: 140038
2011-09-19 18:54:16 +00:00
Devang Patel ecaf9ac0bb Emit debug info for c++0x nullptr.
llvm-svn: 139752
2011-09-14 23:14:14 +00:00
Eric Christopher 19329c402f Formatting.
llvm-svn: 139681
2011-09-14 01:10:50 +00:00
Eric Christopher 47300ad6e4 Fix typo.
llvm-svn: 139668
2011-09-13 23:45:09 +00:00
Devang Patel b0fa5b57ac By popular demand, enumerate all builtin types!
llvm-svn: 139521
2011-09-12 18:50:21 +00:00
Devang Patel 33e097b699 Add an assert so that new builtins do not sneak without proper debug info.
llvm-svn: 139514
2011-09-12 18:24:46 +00:00
Devang Patel 98ca8aeca6 Fix debug info encodings for char16_t and char32_t.
llvm-svn: 139502
2011-09-12 17:11:58 +00:00
Devang Patel 964d758d17 Emit debug info for wchar_t.
llvm-svn: 139443
2011-09-10 00:44:49 +00:00
Douglas Gregor e8bbc12152 Extend the ASTContext constructor to delay the initialization of
builtin types (When requested). This is another step toward making
ASTUnit build the ASTContext as needed when loading an AST file,
rather than doing so after the fact. No actual functionality change (yet).

llvm-svn: 138985
2011-09-02 00:18:52 +00:00
Nick Lewycky 0112b11f5c Don't try to emit unsupported templated friend declarations. They're unsupported
and may very well be dependent-types, triggering an assertion in debug info
codegen.

llvm-svn: 138970
2011-09-01 21:49:51 +00:00
Chandler Carruth 35f5320d8e Mechanically rename SourceManager::getInstantiationLoc and
FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part
of the API and documentation update from 'instantiation' as the term for
macros to 'expansion'.

llvm-svn: 135914
2011-07-25 16:49:02 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Devang Patel 206f5093e3 Simplify.
llvm-svn: 135456
2011-07-19 00:52:18 +00:00
Devang Patel 11de9a966a Check column number also.
llvm-svn: 135437
2011-07-18 22:18:04 +00:00
Chris Lattner 2192fe50da de-constify llvm::Type, patch by David Blaikie!
llvm-svn: 135370
2011-07-18 04:24:23 +00:00
Devang Patel f0335ce632 Emit debug info for extended vectors.
llvm-svn: 135083
2011-07-13 21:23:30 +00:00
Devang Patel 15013e78c3 Fix struct member's scope. Patch by Xi Wang.
llvm-svn: 133829
2011-06-24 22:00:59 +00:00
John McCall 31168b077c Automatic Reference Counting.
Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.

llvm-svn: 133103
2011-06-15 23:02:42 +00:00
Devang Patel f1e2a7f0f0 Simplify.
llvm-svn: 132560
2011-06-03 17:23:47 +00:00
Devang Patel 597a730cb8 Fix typedef's context.
llvm-svn: 132557
2011-06-03 17:05:26 +00:00
Devang Patel 5c71c2154b Robustify objc method type description (subroutine type) by walking parameters directly.
llvm-svn: 132368
2011-05-31 22:21:11 +00:00
Devang Patel 7ce99c3637 List objective-c ineterfaces as public types in dwarf debug info output.
llvm-svn: 132361
2011-05-31 21:18:50 +00:00
Devang Patel 2780e4545a List c++ class type as public type in dwarf debug info output.
llvm-svn: 132357
2011-05-31 20:46:46 +00:00
Alexis Hunt e852b100e2 Implement a new type node, UnaryTransformType, designed to represent a
type that turns one type into another. This is used as the basis to
implement __underlying_type properly - with TypeSourceInfo and proper
behavior in the face of templates.

llvm-svn: 132017
2011-05-24 22:41:36 +00:00
Devang Patel f9076f3b45 Set up appropriate context for member function.
Radar 9440721

llvm-svn: 131441
2011-05-17 00:20:09 +00:00
Devang Patel e91b54cc56 Doug convinced me that DW_AT_APPLE_objc_complete_type is more appropriate name.
s/DW_AT_APPLE_objc_class_extension/DW_AT_APPLE_objc_complete_type/g

llvm-svn: 131245
2011-05-12 21:29:57 +00:00
Devang Patel 70d77d144b Do not add AT_APPLE_objc_class_extension attribute if @implementation is not seen.
llvm-svn: 131242
2011-05-12 21:14:54 +00:00
Devang Patel 36882c8f24 Use DW_AT_APPLE_objc_class_extension attribute to identify interfaces that represent class extension.
Radar 9423077.

llvm-svn: 131239
2011-05-12 19:07:41 +00:00
Devang Patel 979aba5d09 Do not drop uint128 on the floor.
llvm-svn: 130929
2011-05-05 17:06:30 +00:00
Fariborz Jahanian fc0fe6eb52 Finish off rules for z-length bitfields in ms_struct
structs. // rdar://8823265

llvm-svn: 130783
2011-05-03 20:21:04 +00:00
Devang Patel 04ab75c9ab Function with internal linkage name do not have mangled name.
llvm-svn: 130736
2011-05-02 22:49:30 +00:00
Devang Patel b7ff0da623 Do not try to get mangled name of block helpers. Apply a stopgap measure to fix SingleSource/UnitTests/block-copied-in-cxxobj compile time crash.
llvm-svn: 130734
2011-05-02 22:37:48 +00:00
Fariborz Jahanian eb39741c0b More rule enforcement of zero bitfields for ms_struct.
llvm-svn: 130696
2011-05-02 17:20:56 +00:00
Nick Lewycky fc49f72b58 Remove unused variable spotted by GCC.
Devang, can we remove this call entirely? If I try that, "make check" passes
but the call has a side-effect of ensuring that the block's context exists in
the debug info. getContextDescriptor() is used in a void context for that side-
effect elsewhere in this file. Please take a look!

llvm-svn: 130679
2011-05-02 01:41:48 +00:00
Devang Patel a3e3fded0a Tie constructor defintion with its declaration using AT_specification.
llvm-svn: 130561
2011-04-29 23:42:32 +00:00
Fariborz Jahanian 6d003c3041 Fixes debug info generation problem for ms_struct structs.
// rdar://8823265

llvm-svn: 130458
2011-04-28 23:43:23 +00:00
Devang Patel e67eca43d6 We need pointer size in bits here.
llvm-svn: 130244
2011-04-26 21:16:49 +00:00
Devang Patel 420c8de92e Emit intrinsic at current insert point, not at the end of current block.
llvm-svn: 130177
2011-04-25 23:52:27 +00:00
Devang Patel 4f325d1f0f Simplify. There is no need to have a method to just call another method.
llvm-svn: 130175
2011-04-25 23:43:36 +00:00
Jay Foad dbf81d8ddf PR9214: Convert the DIBuilder API to use ArrayRef.
llvm-svn: 130086
2011-04-24 10:11:03 +00:00
Devang Patel a6cb0642b2 Tie debug information for method declaration with debug information for method definition.
llvm-svn: 130037
2011-04-23 00:08:01 +00:00
Ken Dyck bbe3862d95 Eliminate some literal 8s from EmitDeclare by converting to CharUnits. No
change in functionality intended.

llvm-svn: 129999
2011-04-22 17:41:34 +00:00
Ken Dyck 8159c1f2df Use CharUnits to eliminate some literal 8s in
EmitTypeForVarWithBlocksAttr(). No change in functionality intended.

llvm-svn: 129998
2011-04-22 17:34:18 +00:00
Devang Patel 43cfa5dce1 Fix typo in comment.
llvm-svn: 129703
2011-04-18 17:30:25 +00:00
Eli Friedman 2e2ff8894d Hack to turn the valgrind buildbot green, until Devang can address it
properly.

llvm-svn: 129657
2011-04-17 06:40:15 +00:00
Devang Patel 7294d74627 Emit proper selector name in debug info.
llvm-svn: 129626
2011-04-16 00:37:51 +00:00
Devang Patel 9d6c857862 Emit debug info for Objective-C properties.
llvm-svn: 129625
2011-04-16 00:12:55 +00:00
Nick Lewycky d85ae78c48 Apply explicit braces to avoid ambiguous 'else' [-Wparentheses]
llvm-svn: 129176
2011-04-09 00:25:15 +00:00
Devang Patel 0b37e79891 Do not use zero as an upper bound for unbounded array because upper bound zero also indicates one element array.
llvm-svn: 129157
2011-04-08 21:56:52 +00:00
Ken Dyck bb4e977218 [Reapply r128776, modified so that it does not break debug info.]
Change the return type of CodeGenVTables::getVirtualBaseOffsetOffset() to
CharUnits. No change in functionality intended.

llvm-svn: 129072
2011-04-07 12:37:09 +00:00
Devang Patel 78019ec14d Simplify.
llvm-svn: 128957
2011-04-05 23:26:36 +00:00
Devang Patel b87c428055 Emit debug info for function template parameters.
llvm-svn: 128948
2011-04-05 22:54:11 +00:00
Devang Patel e1dd424380 Remove unintentional check-in.
llvm-svn: 128928
2011-04-05 21:05:56 +00:00
Devang Patel 095421b4a8 Fix typo.
llvm-svn: 128921
2011-04-05 20:28:21 +00:00
Devang Patel 98d26c91da Use TemplateParameterList to extract template parameter name.
llvm-svn: 128915
2011-04-05 20:15:06 +00:00
Devang Patel 7522abd3ce Refactor.
llvm-svn: 128893
2011-04-05 17:30:54 +00:00
Devang Patel 44927690c3 Eliminate conservative check that is covered by isIncompleteType() check.
llvm-svn: 128857
2011-04-04 23:23:39 +00:00
Devang Patel a540f1462c Incomplete type does not have any size.
llvm-svn: 128855
2011-04-04 23:18:38 +00:00
Devang Patel 84852bbb42 Revert r128770, r128771, r128773 and r128776 for now. It breaks debug info.
llvm-svn: 128842
2011-04-04 20:36:06 +00:00
Ken Dyck 1473c9a7c4 Change the return type of CodeGenVTables::getVirtualBaseOffsetOffset() to
CharUnits. No change in functionality intended.

llvm-svn: 128776
2011-04-02 17:52:22 +00:00
Devang Patel 1ffe23464a Do not try calculate the size of forward-declared template type array.
llvm-svn: 128725
2011-04-01 19:02:33 +00:00
Devang Patel 945b8aed2a Update type cache when a type is completed.
Radar 9168773

llvm-svn: 128150
2011-03-23 16:29:39 +00:00
Peter Collingbourne 599cb8e430 Add support for language-specific address spaces. On top of that,
add support for the OpenCL __private, __local, __constant and
__global address spaces, as well as the __read_only, _read_write and
__write_only image access specifiers.  Patch originally by ARM;
language-specific address space support by myself.

llvm-svn: 127915
2011-03-18 22:38:29 +00:00
Anders Carlsson 829c4134b8 Correctly unwrap 'auto' types. Fixes PR9414.
llvm-svn: 127121
2011-03-06 16:43:04 +00:00
John McCall 4223a9ee7a Make AttributedTypes for GC-qualified types and fix some miscellaneous
bugs with such types.  Not sure this is quite how I want the desugaring
and a.k.a. logic to go, but it suffices.

llvm-svn: 126986
2011-03-04 04:00:19 +00:00
Devang Patel 68a1525290 Encode argument numbering in debug info so that code generator can emit them in order.
This fixes few blocks.exp regressions.

llvm-svn: 126960
2011-03-03 20:13:15 +00:00
Devang Patel bd6f7f9770 revert r126858.
llvm-svn: 126874
2011-03-02 20:31:22 +00:00
Devang Patel 31e5fb52d1 Encode argument numbering in debug info so that code generator can emit them in order.
This fixes few blocks.exp regressions.

Reapply r126795 with a fix (one character change) for gdb testsuite regressions.

llvm-svn: 126858
2011-03-02 19:11:22 +00:00
Devang Patel a54696de8a Revert r126794.
llvm-svn: 126848
2011-03-02 17:54:58 +00:00
John McCall 81a325e038 Hack in something so that we emit better debug information about
captured __block variables in the block-literal type.

llvm-svn: 126834
2011-03-02 06:57:14 +00:00
Devang Patel 3bc2dedb40 Encode argument numbering in debug info so that code generator can emit them in order.
This fixes few blocks.exp regressions.

llvm-svn: 126795
2011-03-01 22:59:40 +00:00
Devang Patel bbe4ff99e0 Use single code path to handle c++ structs and classes while generating debug info.
llvm-svn: 126691
2011-02-28 22:32:45 +00:00
John McCall 147d021b75 Emit the structure layout of the block literal parameter to a block
invocation function into the debug info.  Rather than faking up a class,
which is tricky because of the custom layout we do, we just emit a struct
directly from the layout information we've already got.

Also, don't emit an unnecessarily parameter alloca for this "variable".

llvm-svn: 126255
2011-02-22 22:38:33 +00:00
Devang Patel d7185b755d Use LLVM coding standard.
llvm-svn: 126232
2011-02-22 18:56:36 +00:00
Richard Smith 30482bc786 Implement the C++0x deduced 'auto' feature.
This fixes PR 8738, 9060 and 9132.

llvm-svn: 126069
2011-02-20 03:19:35 +00:00
Devang Patel 2d6390d47b Start using enums from DIBuilder.
llvm-svn: 125990
2011-02-18 23:29:22 +00:00
Devang Patel 1728c232d5 If preprocessed token introduced empty filename then use main translation unit's filename for debug info entries.
llvm-svn: 125672
2011-02-16 18:40:36 +00:00
Devang Patel 25468059e5 Simplify test to check an aggregate argument that has non trivial constructor or destructor.
This patch rewrites r125142.

llvm-svn: 125632
2011-02-16 01:11:51 +00:00
Devang Patel 49e3348e56 Only c++ class arguments with non trivial constructor or destructor needs a reference.
C struct arguments do not need this adjustment.
This fixes 7 failures in callfuncs.exp from gdb testsuite.

llvm-svn: 125615
2011-02-15 23:36:28 +00:00
Devang Patel 425909dd41 If an aggregate is returned as 'sret' argument then let debugger know about this.
llvm-svn: 125249
2011-02-10 00:40:52 +00:00
Devang Patel 84d40a431f Do not emit AT_MIPS_linkage_name for Objective-C method static variable i.
llvm-svn: 125210
2011-02-09 19:16:38 +00:00
Devang Patel 19ba2b4d6e Emit debug info for objc_selector.
llvm-svn: 125163
2011-02-09 03:15:05 +00:00
Devang Patel 14524e0f24 If an aggregate argument is passed indirectly because it has non trivial
destructor or copy constructor than let debug info know about it.

Radar 8945514.

llvm-svn: 125142
2011-02-09 00:37:30 +00:00
John McCall ad7c5c1657 Reorganize CodeGen{Function,Module} to eliminate the unfortunate
Block{Function,Module} base class.  Minor other refactorings.

Fixed a few address-space bugs while I was there.

llvm-svn: 125085
2011-02-08 08:22:06 +00:00
John McCall 351762cda2 A few more tweaks to the blocks AST representation:
- BlockDeclRefExprs always store VarDecls
  - BDREs no longer store copy expressions
  - BlockDecls now store a list of captured variables, information about
    how they're captured, and a copy expression if necessary
    
With that in hand, change IR generation to use the captures data in       
blocks instead of walking the block independently.        

Additionally, optimize block layout by emitting fields in descending
alignment order, with a heuristic for filling in words when alignment
of the end of the block header is insufficient for the most aligned
field.

llvm-svn: 125005
2011-02-07 10:33:21 +00:00
Devang Patel 84ffdd9ba3 Emit debug info for template value parameters.
llvm-svn: 124756
2011-02-02 22:36:18 +00:00
Devang Patel e3773c2f51 Emit debug info for template type parameters.
llvm-svn: 124753
2011-02-02 21:38:49 +00:00
Douglas Gregor b8c7fe9dc9 Debug info generation for rvalue references
llvm-svn: 124020
2011-01-22 01:58:15 +00:00
John McCall 424cec97bd Change QualType::getTypePtr() to return a const pointer, then change a
thousand other things which were (generally inadvertantly) relying on that.

llvm-svn: 123814
2011-01-19 06:33:43 +00:00
Devang Patel 283e89dd22 Simplify.
llvm-svn: 123682
2011-01-17 22:23:07 +00:00
Devang Patel bc47498973 Fix debug info for __block variable referenced outside of block.
llvm-svn: 123199
2011-01-11 00:30:27 +00:00
John McCall 8190451ddc Introduce an AttributedType, but don't actually use it anywhere yet.
The initial TreeTransform is a cop-out, but it's more-or-less equivalent
to what we were doing before, or rather what we're doing now and might
eventually stop doing in favor of using this type.
I am simultaneously intrigued by the possibilities of rebuilding a
dependent Attri

llvm-svn: 122942
2011-01-06 01:58:22 +00:00
Abramo Bagnara 924a8f3573 Added ParenType type node.
llvm-svn: 121488
2010-12-10 16:29:40 +00:00
John McCall 717d9b0e2f It's kindof silly that ExtQuals has an ASTContext&, and we can use that
space better.  Remove this reference.  To make that work, change some APIs
(most importantly, getDesugaredType()) to take an ASTContext& if they
need to return a QualType.  Simultaneously, diminish the need to return a
QualType by introducing some useful APIs on SplitQualType, which is
just a std::pair<const Type *, Qualifiers>.

llvm-svn: 121478
2010-12-10 11:01:00 +00:00
Devang Patel 8c44529c85 Remove unused parameter. getContextDescriptor() and getOrCreateNameSpace().
llvm-svn: 121333
2010-12-09 00:33:05 +00:00
Devang Patel 4591f7736a Remove unused parameter.
llvm-svn: 121326
2010-12-09 00:25:29 +00:00
Devang Patel 00afcbe366 Start using DIBuilder. It provides cleaner interface.
llvm-svn: 121302
2010-12-08 22:42:58 +00:00
Douglas Gregor 2f53a0bbf2 Harden CGDebugInfo::CreateType() a bit for cases where we couldn't generate type info for its component types
llvm-svn: 120401
2010-11-30 06:38:09 +00:00
Michael J. Spencer 8aaf49959c Merge System into Support.
llvm-svn: 120297
2010-11-29 18:12:39 +00:00
Anders Carlsson 7f95cd1817 Rename RecordLayout::getPrimaryBaseWasVirtual to isPrimaryBaseVirtual.
llvm-svn: 120133
2010-11-24 23:12:57 +00:00
Argyrios Kyrtzidis d004064864 Refactoring of Diagnostic class.
-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class.
-DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units.
-The rest of the state in Diagnostic object is considered related and tied to one translation unit.
-Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a
   SourceLocation instead of a FullSourceLoc.
-Reflect the changes to various interfaces.

llvm-svn: 119730
2010-11-18 20:06:41 +00:00
Douglas Gregor ad3832e213 Teach debug-info generation that SourceManager::getPresumedLoc() can
produce an invalid location even when given a valid location, if the
file system has changed underneath us. Recovery more gracefully.

llvm-svn: 118834
2010-11-11 20:45:16 +00:00
Douglas Gregor 1ccc8416a0 Remove broken support for variadic templates, along with the various
abstractions (e.g., TemplateArgumentListBuilder) that were designed to
support variadic templates. Only a few remnants of variadic templates
remain, in the parser (parsing template type parameter packs), AST
(template type parameter pack bits and TemplateArgument::Pack), and
Sema; these are expected to be used in a future implementation of
variadic templates.

But don't get too excited about that happening now.

llvm-svn: 118385
2010-11-07 23:05:16 +00:00
Devang Patel 86f30f5a1d Simplify. Builtin types' context is always implied.
llvm-svn: 117928
2010-11-01 16:52:40 +00:00