summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "DebugInfo: Emit the definition of enums when the definition preceeds ↵David Blaikie2014-05-061-29/+0
| | | | | | | | | | | the declaration and initial use." This is breaking the compiler-rt build. Reverting while I investigate/fix. This reverts commit r208065. llvm-svn: 208106
* DebugInfo: Emit the definition of enums when the definition preceeds the ↵David Blaikie2014-05-061-0/+29
| | | | | | | | | | | | declaration and initial use. This regressed a little further 208055 though it was already a little broken. While the requiresCompleteType optimization should be implemented here. Future (possibly near future) work. llvm-svn: 208065
* PR19598: Ensure temporary metadata nodes used in debug info are destroyed.David Blaikie2014-05-061-38/+32
| | | | | | | | | | | | | | | | | | | CGDebugInfo and DIBuilder were lax in their handling of temporary MDNodes. All temporary nodes need to be deleted, which means they need to be RAUW'd with a permanent node. This was not happening. To ensure this, leverage DIBuilder's new ability to create both permanent and temporary declarations. Ensure all temporary declarations are RAUW'd, even with itself. (DIDescriptor::RAUW handles the case where it is replaced with itself and creates a new, duplicate permanent node to replace itself with) This means that all temporary declarations must be added to the ReplacementMap even if they're never upgraded to definitions - so move the point of insertion into the map to the point of creation of the declarations. llvm-svn: 208055
* Build debug info for ObjC interface types at the end of the translation unit ↵David Blaikie2014-05-051-101/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | to ensure all ivars are included. This takes a different approach than the completedType/requiresCompleteType work which relies on AST callbacks to upgrade the type declaration to a definition. Instead, just defer constructing the definition to the end of the translation unit. This works because the definition is never needed by other debug info (so far as I know), whereas the definition of a struct may be needed by other debug info before the end of the translation unit (such as emitting the definition of a member function which must refer to that member function's declaration). If we had a callback for whenever an IVar was added to an ObjC interface we could use that, and remove the need for the ObjCInterfaceCache, which might be nice. (also would need a callback for when it was more than just a declaration so we could get properties, etc). A side benefit is that we also don't need the CompletedTypeCache anymore. Just rely on the declaration-ness of a type to decide whether its definition is yet to be emitted. There's still the PR19562 memory leak, but this should hopefully make that a bit easier to approach. llvm-svn: 208015
* Simplify replacement map by avoiding duplicate values and ensuring the ↵David Blaikie2014-05-051-15/+9
| | | | | | | | | | | | | values it does contain are necessary. Items were being redundantly added to the replacement map (both when the declaration was created, and then again when its definition was constructed) which caused extra handling to be required when walking the map (as elements may've already been replaced due to prior entries). By avoiding adding the duplicates, the checks in the replacement handling can be replaced with assertions. llvm-svn: 208000
* PR19623: Support typedefs (and alias templates) of void.David Blaikie2014-05-011-3/+0
| | | | llvm-svn: 207781
* [Modules] Remove the only use of the DEBUG(...) macro in the compilerChandler Carruth2014-04-211-1/+0
| | | | | | | | parts of Clang. I don't really have any opinion about whether using that macro is good or bad, but its odd that this is the only one, and Eric seemed happy with just nuking it for now. llvm-svn: 206806
* Further simplify r206430.Adrian Prantl2014-04-171-13/+4
| | | | | | rdar://problem/16636569. llvm-svn: 206434
* Debug info: When collecting the parameters of C++ partial templateAdrian Prantl2014-04-171-4/+10
| | | | | | | | | | | | specializations collect all arguments and not just the ones from the class template partial specialization from which this class template specialization was instantiated. The debug info does not represent the partial specialization otherwise and so specialized parameters would go missing. rdar://problem/16636569. llvm-svn: 206430
* Debug info: (Bugfix) Make sure artificial functions like _GLOBAL__I_aAdrian Prantl2014-04-101-21/+12
| | | | | | | | | | | | | | | | are not associated with any source lines. Previously, if the Location of a Decl was empty, EmitFunctionStart would just keep using CurLoc, which would sometimes be correct (e.g., thunks) but in other cases would just point to a hilariously random location. This patch fixes this by completely eliminating all uses of CurLoc from EmitFunctionStart and rather have clients explicitly pass in a SourceLocation for the function header and the function body. rdar://problem/14985269 llvm-svn: 205999
* Add global static variables for anonymous union fields. This makesEric Christopher2014-04-101-6/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sure that a debugger can find them when stepping through code, for example from the included testcase: 12 int test_it() { 13 c = 1; 14 d = 2; -> 15 a = 4; 16 return (c == 1); 17 } 18 (lldb) p a (int) $0 = 2 (lldb) p c (int) $1 = 2 (lldb) p d (int) $2 = 2 and a, c, d are all part of the file static anonymous union: static union { int c; int d; union { int a; }; struct { int b; }; }; Fixes PR19221. llvm-svn: 205952
* DebugInfo: Support type alias templatesDavid Blaikie2014-04-061-4/+35
| | | | | | | | We already got the type alias correct (though I've included a test case here) since Clang represents that like any other typedef - but type alias templates weren't being handled. llvm-svn: 205691
* DebugInfo: emit namespace aliases as named imported declarations instead of ↵David Blaikie2014-04-061-2/+2
| | | | | | | | named imported entities Apparently that's how DWARF4 suggests they be emitted. So let's do that. llvm-svn: 205686
* Reapply r205655, DebugInfo: Place global constants in their appropriate context.David Blaikie2014-04-051-1/+4
| | | | | | | This was reverted in 205664 and seems to be fixed by 205668... though that may be more by accident than anything well founded. llvm-svn: 205669
* DebugInfo: Avoid emitting constnants for every useDavid Blaikie2014-04-051-1/+5
| | | | | | | | While the folding set would deduplicate the nodes themselves and LLVM would handle not emitting the same global twice, it still meant creating a long/redundant list of global variables. llvm-svn: 205668
* Revert "DebugInfo: Place global constants in their appropriate context."David Blaikie2014-04-051-4/+1
| | | | | | | | | This reverts commit r205655. Breaks the compiler-rt build with an assertion failure in LLVM... reverting while I investigate. llvm-svn: 205664
* DebugInfo: Place global constants in their appropriate context.David Blaikie2014-04-041-1/+4
| | | | | | | We also don't need to duplicate the name in the LinkageName field. Just leave it empty. llvm-svn: 205655
* DebugInfo: PR19298: function local const variables duplicated in the root scopeDavid Blaikie2014-04-041-0/+3
| | | | | | | | | | | | | | See the comment for CodeGenFunction::tryEmitAsConstant that describes how in some contexts (lambdas) we must not emit references to the variable, but instead use the constant directly - because of this we end up emitting a constant for the variable, as well as emitting the variable itself. Should we just skip putting the variable on the stack at all and omit the debug info for the constant? It's not clear to me - what if the address of the local is taken? llvm-svn: 205651
* DebugInfo: Include default template arguments in template type namesDavid Blaikie2014-04-021-22/+8
| | | | | | | | | | | | | | | This was committed 4 years ago in 108916 with insufficient testing to explain why the "getTypeAsWritten" case was appropriate. Experience says that it isn't - the presence or absence of an explicit instantiation declaration was causing this code to generate either i<int> or i<int, int>. That didn't seem to be a useful distinction, and omitting the template arguments was destructive to debuggers being able to associate the two types across translation units or across compilers (GCC, reasonably, never omitted the arguments). llvm-svn: 205447
* Partially revert r204517 and fix a different way:Eric Christopher2014-04-011-6/+15
| | | | | | | | | | | | | We don't want to encourage the code to emit a lexical block for a function that needs one in order for the line table to change, we need to grab the line information from the body of the pattern that we were instantiated from, this code should do that. Modify the test case to ensure that we're still looking in the right place for all of the scopes and also that we haven't created a lexical block where we didn't need one. llvm-svn: 205368
* Debug info: fix a crash when emitting IndirectFieldDecls, which wereAdrian Prantl2014-04-011-1/+1
| | | | | | | previously not handled at all. rdar://problem/16348575 llvm-svn: 205331
* Adapt CGDebugInfo to interface changes in DIBuilder/DIImportedEntity.Adrian Prantl2014-04-011-4/+4
| | | | | | | The Decl field in a DIImportedEntity is now a DIRef. Paired commit with LLVM. llvm-svn: 205278
* Add an explanatory comment and FIXME about the function declarationEric Christopher2014-03-271-0/+5
| | | | | | for a subprogram DIE. llvm-svn: 204949
* Revert "Just call getContextDescriptor to get the context for subprograms"Eric Christopher2014-03-271-3/+8
| | | | | | | | while I investigate as it seems to be causing issues with the gdb bot. This reverts commit r204874. llvm-svn: 204896
* Just call getContextDescriptor to get the context for subprogramsEric Christopher2014-03-261-8/+3
| | | | | | | | instead of rolling an inefficient version of the function. This changes some order of emission of metadata nodes, fix up those testcases and make them more flexible to some changes. llvm-svn: 204874
* CGDebugInfo: At the end of EmitFunctionStart, Initialize PrevLoc to theAdrian Prantl2014-03-211-1/+4
| | | | | | | | location that the next call emitLocation() would default to. Otherwise setLocation() may wrongly believe that the current source file didn't change, when in fact it did. llvm-svn: 204517
* [C++11] Replacing BlockDecl iterators capture_begin() and capture_end() with ↵Aaron Ballman2014-03-141-4/+1
| | | | | | iterator_range captures(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203958
* [C++11] Replacing FunctionTemplateDecl iterators spec_begin() and spec_end() ↵Aaron Ballman2014-03-141-4/+2
| | | | | | with iterator_range specializations(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203938
* Renaming the recently-created (r203830) props() range API to properties() ↵Aaron Ballman2014-03-131-1/+1
| | | | | | for clarity. llvm-svn: 203835
* [C++11] Replacing ObjCContainerDecl iterators prop_begin() and prop_end() ↵Aaron Ballman2014-03-131-3/+1
| | | | | | with iterator_range props(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203830
* [C++11] Replacing CXXRecordDecl iterators bases_begin() and bases_end() with ↵Aaron Ballman2014-03-131-6/+5
| | | | | | iterator_range bases(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203803
* [C++11] Replacing RecordDecl iterators field_begin() and field_end() with ↵Aaron Ballman2014-03-081-4/+1
| | | | | | iterator_range fields(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203355
* [C++11] Replacing EnumDecl iterators enumerator_begin() and enumerator_end() ↵Aaron Ballman2014-03-081-3/+1
| | | | | | with iterator_range enumerators(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203353
* [C++11] Replacing DeclBase iterators decls_begin() and decls_end() with ↵Aaron Ballman2014-03-071-9/+6
| | | | | | iterator_range decls(). The same is true for the noload versions of these APIs. Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203278
* [C++11] Replacing ObjCMethodDecl iterators param_begin() and param_end() ↵Aaron Ballman2014-03-071-3/+2
| | | | | | with iterator_range params(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203255
* [C++11] Replacing iterators redecls_begin() and redecls_end() with ↵Aaron Ballman2014-03-061-3/+1
| | | | | | iterator_range redecls(). Updating all of the usages of the iterators with range-based for loops, which allows the begin/end forms to be removed entirely. llvm-svn: 203179
* DebugInfo: Refix r202888 (a fix to r202769) in a different way, ensuring ↵David Blaikie2014-03-041-2/+7
| | | | | | types aren't needlessly built during -gmlt llvm-svn: 202900
* Fix unconditional dereference of a WeakVH in CGDebugInfo TypeCacheReid Kleckner2014-03-041-1/+2
| | | | | | | | | | | | This fails an "isa<> used with null pointer" assert during a clang-cl self-host on Windows. This was caused by r202769, and I'm currently reducing a test case. Reviewers: dblaikie Differential Revision: http://llvm-reviews.chandlerc.com/D2944 llvm-svn: 202888
* DebugInfo: Improvements/corrections to conservative emission of types in ↵David Blaikie2014-03-041-1/+2
| | | | | | | | | explicit template instantiation declarations * detect out of line definitions correctly * detect member function explicit specializations correctly llvm-svn: 202779
* DebugInfo: Emit only the declaration of a class template that has an ↵David Blaikie2014-03-031-18/+51
| | | | | | | | | | | | | | | | | | | | | | | explicit instantiation declaration (& always emit such a type when there's an explicit instantiation definition) We should only have this optimization fire when the explicit instantiation definition would cause at least one member function to be emitted, thus ensuring that even a compiler not performing this optimization would still emit the full type information elsewhere. But we should also pessimize output still by always emitting the definition when the explicit instantiation definition appears so that at some point in the future we can depend on that information even when no code had to be emitted in that TU. (this shouldn't happen very often, since people mostly use explicit spec decl/defs to reduce code size - but perhaps one day they could use it to explicitly reduce debug info size too) This was worth about 2% for Clang and LLVM - so not a huge win, but a win. It looks really great for simple STL programs (include <string> and just declare a string - 14k -> 1.4k of .dwo) llvm-svn: 202769
* Update call DIBuilder::createLexicalBlock.Diego Novillo2014-03-031-1/+2
| | | | | | Create lexical blocks with discriminator value 0 by default. llvm-svn: 202737
* [C++11] Replace llvm::tie with std::tie.Benjamin Kramer2014-03-021-1/+1
| | | | llvm-svn: 202639
* Pass down the debug emission kind into the compile unit for codeEric Christopher2014-02-271-4/+6
| | | | | | | generation purposes. Paired with a commit to llvm. llvm-svn: 202334
* 80-col and bad line ending fixups.Eric Christopher2014-02-261-8/+8
| | | | llvm-svn: 202219
* Address review comments for r202185, no functionality changes.Adrian Prantl2014-02-251-2/+3
| | | | llvm-svn: 202208
* Debug info: Generate debug info for variadic functions.Adrian Prantl2014-02-251-0/+16
| | | | | | | | Paired commit with LLVM. rdar://problem/13690847 llvm-svn: 202185
* DebugInfo: Avoid unnecessarily looking up the context when the declaration ↵David Blaikie2014-02-181-3/+2
| | | | | | | | is already built. No functional change intended. llvm-svn: 201602
* Debug info: fix a crasher when when emitting debug info forAdrian Prantl2014-02-041-3/+4
| | | | | | | | not-yet-completed templated types. getTypeSize() needs a complete type. rdar://problem/15931354 llvm-svn: 200797
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-251-2/+2
| | | | | | | | | | | | | | | A return type is the declared or deduced part of the function type specified in the declaration. A result type is the (potentially adjusted) type of the value of an expression that calls the function. Rule of thumb: * Declarations have return types and parameters. * Expressions have result types and arguments. llvm-svn: 200082
* Debug info: use the file a typedef is defined in as its decl_file insteadAdrian Prantl2014-01-211-2/+4
| | | | | | | | | of the current compilation unit. As a side effect this enables many more LTO uniquing opportunities. This reapplies r199757 with a better testcase. llvm-svn: 199760
OpenPOWER on IntegriCloud