summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/debug-info-line.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert "re-land [DebugInfo] Add debug location to stubs generated by ↵Alexandre Ganea2019-11-151-1/+1
| | | | | | CGDeclCXX and mark them as artificial" This reverts commit 9c1baa23526c6d7d06eafefbf82d73bfe9bb3aaf.
* re-land [DebugInfo] Add debug location to stubs generated by CGDeclCXX and ↵Alexandre Ganea2019-11-151-1/+1
| | | | | | mark them as artificial Differential Revision: https://reviews.llvm.org/D66328
* Revert: [DebugInfo] Add debug location to stubs generated by CGDeclCXX and ↵Alexandre Ganea2019-09-051-1/+1
| | | | | | mark them as artificial llvm-svn: 371113
* [DebugInfo] Add debug location to stubs generated by CGDeclCXX and mark them ↵Alexandre Ganea2019-09-051-1/+1
| | | | | | | | as artificial Differential Revision: https://reviews.llvm.org/D66328 llvm-svn: 371080
* Fix PCC test failures for source location builtinsEric Fiselier2019-05-161-1/+1
| | | | llvm-svn: 360943
* Implement __builtin_LINE() et. al. to support source location capture.Eric Fiselier2019-05-161-0/+7
| | | | | | | | | | | | | | | | | Summary: This patch implements the source location builtins `__builtin_LINE(), `__builtin_FUNCTION()`, `__builtin_FILE()` and `__builtin_COLUMN()`. These builtins are needed to implement [`std::experimental::source_location`](https://rawgit.com/cplusplus/fundamentals-ts/v2/main.html#reflection.src_loc.creation). With the exception of `__builtin_COLUMN`, GCC also implements these builtins, and Clangs behavior is intended to match as closely as possible. Reviewers: rsmith, joerg, aaron.ballman, bogner, majnemer, shafik, martong Reviewed By: rsmith Subscribers: rnkovacs, loskutov, riccibruno, mgorny, kunitoki, alexr, majnemer, hfinkel, cfe-commits Differential Revision: https://reviews.llvm.org/D37035 llvm-svn: 360937
* [DEBUGINFO] Add support for emission of the debug directives only.Alexey Bataev2018-08-311-0/+2
| | | | | | | | | | | | | | | | Summary: Added option -gline-directives-only to support emission of the debug directives only. It behaves very similar to -gline-tables-only, except that it sets llvm debug info emission kind to llvm::DICompileUnit::DebugDirectivesOnly. Reviewers: echristo Subscribers: aprantl, fedor.sergeev, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D51177 llvm-svn: 341212
* Update clang test to accomendate discriminator change in ↵Dehao Chen2016-10-071-2/+2
| | | | | | | | | | | | | | https://reviews.llvm.org/D25132 Summary: https://reviews.llvm.org/D25132 added discriminator even add -g0. This leads to test fail which is addressed in thie patch. Reviewers: davidxl, dnovillo Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25133 llvm-svn: 283564
* Port some more debug info tests on WindowsReid Kleckner2016-06-301-3/+1
| | | | llvm-svn: 274245
* Stop messing with the 'g' group of options in CompilerInvocation.Douglas Katzman2015-10-081-2/+2
| | | | | | | | | | | | | | | | With this change, most 'g' options are rejected by CompilerInvocation. They remain only as Driver options. The new way to request debug info from cc1 is with "-debug-info-kind={line-tables-only|limited|standalone}" and "-dwarf-version={2|3|4}". In the absence of a command-line option to specify Dwarf version, the Toolchain decides it, rather than placing Toolchain-specific logic in CompilerInvocation. Also fix a bug in the Windows compatibility argument parsing in which the "rightmost argument wins" principle failed. Differential Revision: http://reviews.llvm.org/D13221 llvm-svn: 249655
* Account for calling convention specifiers in function definitions in IR test ↵David Blaikie2015-06-291-1/+1
| | | | | | | | | | | | | cases Several tests wouldn't pass when executed on an armv7a_pc_linux triple due to the non-default arm_aapcs calling convention produced on the function definitions in the IR output. Account for this with the application of a little regex. Patch by Ying Yi. llvm-svn: 240971
* DebugInfo: Metadata constructs now start with DI*Duncan P. N. Exon Smith2015-04-291-29/+29
| | | | | | | | | | LLVM r236120 renamed debug info IR constructs to use a `DI` prefix, now that the `DIDescriptor` hierarchy has been gone for about a week. This commit was generated using the rename-md-di-nodes.sh upgrade script attached to PR23080, followed by running clang-format-diff.py on the `lib/` portion of the patch. llvm-svn: 236121
* DR1748: the reserved placement allocation functions have undefined behavior ifRichard Smith2015-02-141-2/+1
| | | | | | | they're given a null pointer as an argument, so we do not need to emit null checks on their results. llvm-svn: 229213
* DebugInfo: Suppress the location of instructions in complex default arguments.David Blaikie2015-02-091-0/+9
| | | | llvm-svn: 228589
* DebugInfo: Suppress the location of instructions in aggregate default arguments.David Blaikie2015-02-091-0/+12
| | | | | | | | Matches the existing code for scalar default arguments. Complex default arguments probably need the same handling too (test/fix to that coming next). llvm-svn: 228588
* Tweak clang/test/CodeGenCXX/debug-info-line.cpp for -Asserts.NAKAMURA Takumi2015-02-051-1/+1
| | | | | | | | | | | | CHECK: call {{.*}}src matched %call = invoke dereferenceable(4) i32* @_Z3srcv() I don't think it was intentional. llvm-svn: 228245
* DebugInfo: Attribute cleanup code to the end of the scope, not the end of ↵David Blaikie2015-02-041-0/+15
| | | | | | | | | | | | | | | | | | the function. Now if you break on a dtor and go 'up' in your debugger (or you get an asan failure in a dtor) during an exception unwind, you'll have more context. Instead of all dtors appearing to be called from the '}' of the function, they'll be attributed to the end of the scope of the variable, the same as the non-exceptional dtor call. This doesn't /quite/ remove all uses of CurEHLocation (which might be nice to remove, for a few reasons) - it's still used to choose the location for some other work in the landing pad. It'd be nice to attribute that code to the same location as the exception calls within the block and to remove CurEHLocation. llvm-svn: 228181
* DebugInfo: Ensure calls to functions with default arguments which themselves ↵David Blaikie2015-02-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | have default arguments, still have locations. To handle default arguments in C++ in the debug info, we disable code updating the debug location during the emission of default arguments. This code was buggy in the case of default arguments which, themselves, have default arguments - the inner default argument would re-enable debug info when it was finished, but before the outer default argument was finished. This was already a bug, but got worse (because a crasher instead of just a quality bug) with the recent improvements to debug info line quality because... The ApplyDebugLocation scoped device would find the debug info disabled and not save any debug location. But then in ~ApplyDebugLocation it would find the debug info had been enabled and would then apply the no-location. Then the outer function call would be emitted without any location. That's bad. Arguably we could /also/ fix the ApplyDebugLocation to assert on this situation (where debug info was disabled in the ctor and enabled in the dtor, or the other way around) but this is at least the necessary fix regardless. (also, I imagine this disabling behavior might need to be in-place for CGExprComplex and CGExprAgg too, maybe... ?) And I seem to recall seeing some weird default arg stepping behavior recently which might be related to this too... I'll have to look into it. llvm-svn: 228053
* DebugInfo: Attribute implicit boolean tests to the expression being tested, ↵David Blaikie2015-01-281-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | not to the outer use of that expression. This is half a fix for a GDB test suite failure that expects to start at 'a' in the following code: void func(int a) if (a && b) ... But instead, without this change, the comparison was assigned to '&&' (well, worse actually - because there was a chained 'a && b && c' and it was assigned to the second '&&' because of a recursive application of this bug) and then the load folded into the comparison so breaking on the function started at '&&' instead of 'a'. The other part of this needs to be fixed in LLVM where it's ignoring the location of the icmp and instead using the location of the branch instruction. The fix to the conditional operator is actually a no-op currently, because the conditional operator's location coincides with 'a' (the start of the conditional expression) but should probably be '?' instead. See the FIXME in the test case that mentions the ARCMigration tool failures when I tried to make that change. llvm-svn: 227356
* DebugInfo: Attribute calls to overloaded operators with the operator, not ↵David Blaikie2015-01-251-2/+4
| | | | | | the start of the whole expression llvm-svn: 227028
* DebugInfo: Use the preferred location rather than the start location for ↵David Blaikie2015-01-251-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expression line info This causes things like assignment to refer to the '=' rather than the LHS when attributing the store instruction, for example. There were essentially 3 options for this: * The beginning of an expression (this was the behavior prior to this commit). This meant that stepping through subexpressions would bounce around from subexpressions back to the start of the outer expression, etc. (eg: x + y + z would go x, y, x, z, x (the repeated 'x's would be where the actual addition occurred)). * The end of an expression. This seems to be what GCC does /mostly/, and certainly this for function calls. This has the advantage that progress is always 'forwards' (never jumping backwards - except for independent subexpressions if they're evaluated in interesting orders, etc). "x + y + z" would go "x y z" with the additions occurring at y and z after the respective loads. The problem with this is that the user would still have to think fairly hard about precedence to realize which subexpression is being evaluated or which operator overload is being called in, say, an asan backtrace. * The preferred location or 'exprloc'. In this case you get sort of what you'd expect, though it's a bit confusing in its own way due to going 'backwards'. In this case the locations would be: "x y + z +" in lovely postfix arithmetic order. But this does mean that if the op+ were an operator overload, say, and in a backtrace, the backtrace will point to the exact '+' that's being called, not to the end of one of its operands. (actually the operator overload case doesn't work yet for other reasons, but that's being fixed - but this at least gets scalar/complex assignments and other plain operators right) llvm-svn: 227027
* DebugInfo: Correct the line location of geps on array accessesDavid Blaikie2015-01-241-0/+9
| | | | llvm-svn: 227023
* Disable warnings in an IRGen test to make test failures less noisyDavid Blaikie2015-01-231-2/+2
| | | | llvm-svn: 226954
* DebugInfo: Attribute complex expressions to the source location of the ↵David Blaikie2015-01-181-0/+10
| | | | | | | | | expression Just as r225956 did for scalar expressions (CGExprScalar::Visit), do the same for complex expressions. llvm-svn: 226390
* DebugInfo: Attribute aggregate expressions to the source location of the ↵David Blaikie2015-01-181-6/+13
| | | | | | | | | expression Just as r225956 did for scalar expressions (CGExprScalar::Visit), do the same for aggregate expressions. llvm-svn: 226388
* Refactor test so it's not lazily emitted on a global, simplifying ordering ↵David Blaikie2015-01-181-4/+5
| | | | | | when more test cases are added llvm-svn: 226384
* DebugInfo: Correct the debug location of non-static data member initializersDavid Blaikie2015-01-181-4/+4
| | | | | | | | | | This was causing some trouble for otherwise dead code removed in r225085 (reverted in r225361). The location being set for function arguments was leaking out to the call which wasn't setting its own location (so a quality bug turned into a crasher with r225085). Fix this so r225085 can be recommitted. llvm-svn: 226382
* Isolate test for PR22096 to clang.David Blaikie2015-01-161-9/+27
| | | | | | | | | | | Emitting inlinable calls without debug locations (in functions with debug info, to functions with debug info) is problematic for debug info when inlining occurs. Test specifically that we don't do that in this case - thus the test isn't simply "don't crash", it's "include debug location for this call" (granted it's the wrong location - fix for that is coming) llvm-svn: 226337
* IR: Move MDLocation into place (clang testcases)Duncan P. N. Exon Smith2015-01-141-19/+19
| | | | | | Update testcases to match LLVM change in r226048. llvm-svn: 226049
* Reapply r225000 (reverted in r225555): DebugInfo: Generalize debug info ↵David Blaikie2015-01-141-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | location handling (and follow-up commits). Several pieces of code were relying on implicit debug location setting which usually lead to incorrect line information anyway. So I've fixed those (in r225955 and r225845) separately which should pave the way for this commit to be cleanly reapplied. The reason these implicit dependencies resulted in crashes with this patch is that the debug location would no longer implicitly leak from one place to another, but be set back to invalid. Once a call with no/invalid location was emitted, if that call was ever inlined it could produce invalid debugloc chains and assert during LLVM's codegen. There may be further cases of such bugs in this patch - they're hard to flush out with regression testing, so I'll keep an eye out for reports and investigate/fix them ASAP if they come up. Original commit message: Reapply "DebugInfo: Generalize debug info location handling" Originally committed in r224385 and reverted in r224441 due to concerns this change might've introduced a crash. Turns out this change fixes the crash introduced by one of my earlier more specific location handling changes (those specific fixes are reverted by this patch, in favor of the more general solution). Recommitted in r224941 and reverted in r224970 after it caused a crash when building compiler-rt. Looks to be due to this change zeroing out the debug location when emitting default arguments (which were meant to inherit their outer expression's location) thus creating call instructions without locations - these create problems for inlining and must not be created. That is fixed and tested in this version of the change. Original commit message: This is a more scalable (fixed in mostly one place, rather than many places that will need constant improvement/maintenance) solution to several commits I've made recently to increase source fidelity for subexpressions. This resetting had to be done at the DebugLoc level (not the SourceLocation level) to preserve scoping information (if the resetting was done with CGDebugInfo::EmitLocation, it would've caused the tail end of an expression's codegen to end up in a potentially different scope than the start, even though it was at the same source location). The drawback to this is that it might leave CGDebugInfo out of sync. Ideally CGDebugInfo shouldn't have a duplicate sense of the current SourceLocation, but for now it seems it does... - I don't think I'm going to tackle removing that just now. I expect this'll probably cause some more buildbot fallout & I'll investigate that as it comes up. Also these sort of improvements might be starting to show a weakness/bug in LLVM's line table handling: we don't correctly emit is_stmt for statements, we just put it on every line table entry. This means one statement split over multiple lines appears as multiple 'statements' and two statements on one line (without column info) are treated as one statement. I don't think we have any IR representation of statements that would help us distinguish these cases and identify the beginning of each statement - so that might be something we need to add (possibly to the lexical scope chain - a scope for each statement). This does cause some problems for GDB and possibly other DWARF consumers. llvm-svn: 225956
* DebugInof: Correct the location of exception cleanups in global ctors/dtors ↵David Blaikie2015-01-141-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | and ObjC methods Without setting the CurEHLocation these cleanups would be attributed to whatever the last active debug line location was (the 'fn' call in the included test cases). By setting CurEHLocation correctly the line information is improved/corrected. This quality bug turned into a crasher with r225000 when, instead of allowing the last location to persist, it would be zero'd out. This could lead to a function call (such as the dtor) being made without a debug location - if that call was subsequently inlined (and the caller and callee had debug info, just not the call instruction) the inliner would violate important constraints about the debug location chains by not updating the inlined instructions to chain up to the callee locations. So, by fixing this bug, I am addressing the assertion failures introduced by r225000 and should be able to recommit that patch with impunity... llvm-svn: 225955
* Remove unnecessary/incorrect XFAIL after the revert of 225000David Blaikie2015-01-091-2/+0
| | | | llvm-svn: 225561
* Revert "DebugInfo: Generalize debug info location handling" and related commitsDavid Blaikie2015-01-091-30/+0
| | | | | | | | | | | | This reverts commit r225000, r225021, r225083, r225086, r225090. The root change (r225000) still has several issues where it's caused calls to be emitted without debug locations. This causes assertion failures if/when those calls are inlined. I'll work up some test cases and fixes before recommitting this. llvm-svn: 225555
* DebugInfo: Fix cases where location failed to be updated after r225000David Blaikie2015-01-021-0/+10
| | | | | | | | | | | | | The optimization (that appears to have been here since the earliest implementation (r50848) & has become more complicated over the years) to avoid recreating the debugloc if it would be the same was out of date because ApplyDebugLocation was not re-updating the CurLoc/PrevLoc. This optimization doesn't look terribly beneficial/necessary, so I'm removing it - if it turns up in benchmarks, I'm happy to reconsider/reimplement this with justification, but for now it just seems to add complexity/problems. llvm-svn: 225083
* XFAIL test on win32 due to missing __complex supportDavid Blaikie2014-12-311-0/+2
| | | | llvm-svn: 225051
* Handle PPC64 return type (signext i32 rather than plain i32) in test caseDavid Blaikie2014-12-311-1/+1
| | | | llvm-svn: 225021
* Reapply "DebugInfo: Generalize debug info location handling"David Blaikie2014-12-301-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally committed in r224385 and reverted in r224441 due to concerns this change might've introduced a crash. Turns out this change fixes the crash introduced by one of my earlier more specific location handling changes (those specific fixes are reverted by this patch, in favor of the more general solution). Recommitted in r224941 and reverted in r224970 after it caused a crash when building compiler-rt. Looks to be due to this change zeroing out the debug location when emitting default arguments (which were meant to inherit their outer expression's location) thus creating call instructions without locations - these create problems for inlining and must not be created. That is fixed and tested in this version of the change. Original commit message: This is a more scalable (fixed in mostly one place, rather than many places that will need constant improvement/maintenance) solution to several commits I've made recently to increase source fidelity for subexpressions. This resetting had to be done at the DebugLoc level (not the SourceLocation level) to preserve scoping information (if the resetting was done with CGDebugInfo::EmitLocation, it would've caused the tail end of an expression's codegen to end up in a potentially different scope than the start, even though it was at the same source location). The drawback to this is that it might leave CGDebugInfo out of sync. Ideally CGDebugInfo shouldn't have a duplicate sense of the current SourceLocation, but for now it seems it does... - I don't think I'm going to tackle removing that just now. I expect this'll probably cause some more buildbot fallout & I'll investigate that as it comes up. Also these sort of improvements might be starting to show a weakness/bug in LLVM's line table handling: we don't correctly emit is_stmt for statements, we just put it on every line table entry. This means one statement split over multiple lines appears as multiple 'statements' and two statements on one line (without column info) are treated as one statement. I don't think we have any IR representation of statements that would help us distinguish these cases and identify the beginning of each statement - so that might be something we need to add (possibly to the lexical scope chain - a scope for each statement). This does cause some problems for GDB and possibly other DWARF consumers. llvm-svn: 225000
* Revert "DebugInfo: Generalize debug info location handling"David Blaikie2014-12-291-9/+0
| | | | | | | | | Asserting when building compiler-rt when using a GCC host compiler. Reverting while I investigate. This reverts commit r224941. llvm-svn: 224970
* Reapply "DebugInfo: Generalize debug info location handling"David Blaikie2014-12-291-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally committed in r224385 and reverted in r224441 due to concerns this change might've introduced a crash. Turns out this change fixes the crash introduced by one of my earlier more specific location handling changes (those specific fixes are reverted by this patch, in favor of the more general solution). Original commit message: This is a more scalable (fixed in mostly one place, rather than many places that will need constant improvement/maintenance) solution to several commits I've made recently to increase source fidelity for subexpressions. This resetting had to be done at the DebugLoc level (not the SourceLocation level) to preserve scoping information (if the resetting was done with CGDebugInfo::EmitLocation, it would've caused the tail end of an expression's codegen to end up in a potentially different scope than the start, even though it was at the same source location). The drawback to this is that it might leave CGDebugInfo out of sync. Ideally CGDebugInfo shouldn't have a duplicate sense of the current SourceLocation, but for now it seems it does... - I don't think I'm going to tackle removing that just now. I expect this'll probably cause some more buildbot fallout & I'll investigate that as it comes up. Also these sort of improvements might be starting to show a weakness/bug in LLVM's line table handling: we don't correctly emit is_stmt for statements, we just put it on every line table entry. This means one statement split over multiple lines appears as multiple 'statements' and two statements on one line (without column info) are treated as one statement. I don't think we have any IR representation of statements that would help us distinguish these cases and identify the beginning of each statement - so that might be something we need to add (possibly to the lexical scope chain - a scope for each statement). This does cause some problems for GDB and possibly other DWARF consumers. llvm-svn: 224941
* IR: Make metadata typeless in assembly, clang sideDuncan P. N. Exon Smith2014-12-151-14/+14
| | | | | | Match LLVM changes from r224257. llvm-svn: 224259
* DebugInfo: More accurate line information for placement new.David Blaikie2014-12-141-3/+5
| | | | | | | | | | | This actually came up as a break in UBSan tests (look for a follow-up commit to this one to see the UBSan test fallout) when I tried a broader fix to location information. I have some other ideas about how to do that broader change & will keep looking into it. llvm-svn: 224221
* Make test case 32/64 bit neutralDavid Blaikie2014-12-101-1/+1
| | | | llvm-svn: 223938
* DebugInfo: Location information for scalar new expressionsDavid Blaikie2014-12-101-0/+11
| | | | llvm-svn: 223937
* DebugInfo: Correct location information for array accesses to elements of ↵David Blaikie2014-12-101-0/+10
| | | | | | variable array type. llvm-svn: 223902
* DebugInfo: Fix another case of array access line informationDavid Blaikie2014-12-101-0/+10
| | | | llvm-svn: 223897
* DebugInfo: Correct the location of array accessesDavid Blaikie2014-12-101-0/+10
| | | | | | | Especially relevant to ASan when dealing with complex expressions containing multiple array accesses. See PR21737. llvm-svn: 223872
* Tweak test case from r223842 to make it pass on Windows MSVCReid Kleckner2014-12-101-6/+3
| | | | | | We can't mangle __complex yet, and there is no C1 emission. llvm-svn: 223870
* DebugInfo: Correct location of aggregate assignmentDavid Blaikie2014-12-091-0/+12
| | | | llvm-svn: 223854
* DebugInfo: Correct location of initialization of auto __complexDavid Blaikie2014-12-091-0/+8
| | | | llvm-svn: 223842
* DebugInfo: Correct the location of initializations of auto.David Blaikie2014-12-091-0/+8
| | | | llvm-svn: 223839
OpenPOWER on IntegriCloud