Commit Graph

277 Commits

Author SHA1 Message Date
Dan Gohman 196f71006e Introduce a new temporary MDNode concept. Temporary MDNodes are
not part of the IR, are not uniqued, and may be safely RAUW'd.
This replaces a variety of alternate mechanisms for achieving
the same effect.

llvm-svn: 111682
2010-08-20 22:02:57 +00:00
Devang Patel dc866e119c Simplify code and add comments, in code that generate debug info for constant integer globals, based on Chris's feedback.
llvm-svn: 110694
2010-08-10 17:53:33 +00:00
Devang Patel e03edfd3e7 Even if a constant's evaluated value is used, emit debug info for the constant variable.
llvm-svn: 110660
2010-08-10 07:24:25 +00:00
Devang Patel 4f6e73b168 Always use current working directory for DW_AT_comp_dir.
llvm-svn: 109535
2010-07-27 20:49:59 +00:00
Devang Patel 6014edd117 Reapply 109303.
llvm-svn: 109507
2010-07-27 15:17:16 +00:00
Devang Patel 6005082354 Revert 109303.
llvm-svn: 109426
2010-07-26 18:49:27 +00:00
Devang Patel 268ad093a7 Untangle filename/dirname confusion. Store constructed strings on the side. Avoid use of Path.makeAbsolute().
DW_TAG_compile_unit uses two attributes DW_AT_name and DW_AT_comp_dir. Their expected values are:

$ clang foo.c -g
  DW_AT_name - foo.c
  DW_AT_comp_dir - `pwd`

$ clang one/two/foo.c -g
  DW_AT_name - one/two/foo.c
  DW_AT_comp_dir - `pwd`

$ clang /tmp/one/foo.c -g
  DW_AT_name - /tmp/one/foo.c
  DW_AT_comp_dir - empty

llvm-svn: 109303
2010-07-24 00:59:16 +00:00
Devang Patel 0884a60eb5 Keep track of artificial scopes introduced by line directives. For example,
#line 41 "bar.c"
  dummy (1, i);
#line 24 "bar.h"
  i = f2 (i);
#line 44 "bar.c"

This is tested by step-line.exp in gdb testsuite.

llvm-svn: 109189
2010-07-22 22:29:16 +00:00
Devang Patel 11a42a4655 Remove unused argument.
llvm-svn: 108946
2010-07-20 22:20:10 +00:00
Devang Patel 6c01820900 Print template argument names for template class.
llvm-svn: 108916
2010-07-20 20:24:18 +00:00
John McCall 8b07ec253d Substantially alter the design of the Objective C type AST by introducing
ObjCObjectType, which is basically just a pair of
  one of {primitive-id, primitive-Class, user-defined @class}
with
  a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared).  ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.

Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType.  Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet.  Remove some number of methods that are no
longer used, at least after this patch.

By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.

llvm-svn: 103870
2010-05-15 11:32:37 +00:00
Devang Patel c5ffabc94f If given location is invalid then use current location.
This fixes recent regressions reported by gdb testsuite. 
Tighter verification of debug info generated by FE found these regressions.

Refactor code to extract line number and column number from SourceLocation.

llvm-svn: 103678
2010-05-12 23:46:38 +00:00
Benjamin Kramer 20f2d4382f Fix pasto, add a comment.
llvm-svn: 102263
2010-04-24 20:26:20 +00:00
Benjamin Kramer bbb5deace6 Factor code. No functionality change.
llvm-svn: 102262
2010-04-24 20:19:58 +00:00
Anders Carlsson 11e5140db9 Vtable -> VTable renames across the board.
llvm-svn: 101666
2010-04-17 20:15:18 +00:00
Benjamin Kramer 9e2e1c9024 Minor include pruning.
llvm-svn: 100007
2010-03-31 15:04:05 +00:00
Ted Kremenek dbb8cd1d34 Cache results computed by CGDebugInfo::getOrCreateFile() in a DenseMap.
This reduces '-c -g' time on one file in 403.gcc by 12%.

llvm-svn: 99857
2010-03-30 00:27:51 +00:00
Ted Kremenek ac031880af Remove FIXME comment.
llvm-svn: 99828
2010-03-29 19:10:41 +00:00
Ted Kremenek 23c29f0cbe Change 'TypeCache' from being an std::map to a llvm::DenseMap. This reduces codegen time
on one .i file from 403.gcc by 0.5%.

llvm-svn: 99823
2010-03-29 18:29:57 +00:00
Devang Patel 4f26205ba8 More then one anonymous aggregates on one line creates chaos when MDNode uniquness is combined with RAUW operation. Right solution is to avoid using RAUW.
This fixes PR 6554.

llvm-svn: 98083
2010-03-09 21:32:27 +00:00
Devang Patel 408dcf60aa Start using DIFile. Corresponding llvm patch is r98020.
llvm-svn: 98021
2010-03-09 00:44:50 +00:00
Devang Patel b407338fe2 Emit debug info for VectorType.
llvm-svn: 96999
2010-02-23 22:59:39 +00:00
Devang Patel 535fdaf020 Refactor code that generates debug info for variables that has BlocksAttr.
llvm-svn: 95786
2010-02-10 18:49:08 +00:00
Devang Patel 973f2eb0cd Emit debug info for namespaces.
llvm-svn: 94991
2010-02-01 19:16:32 +00:00
Devang Patel 92e2541599 Maintain a map of regions (lexical scopes) and use it to find context for a global variable.
llvm-svn: 94817
2010-01-29 18:11:03 +00:00
Devang Patel 7bfc596fcf s/CGDebugInfo::getContext/CGDebugInfo::getContextDescriptor/g to avoid confusion.
llvm-svn: 94760
2010-01-28 23:15:27 +00:00
Devang Patel 0d61eebd81 s/FunctionNames/DebugInfoNames/g
llvm-svn: 94753
2010-01-28 18:21:00 +00:00
Devang Patel 84033fb240 Emit vtable info.
llvm-svn: 94751
2010-01-28 18:11:52 +00:00
Devang Patel 3d4e6d9dd0 Include "this" pointer argument while emitting debug info for a C++ method.
llvm-svn: 94710
2010-01-28 00:28:01 +00:00
Anders Carlsson 17ed0496c5 Fix the test I broke, and also fix a crash when declaring a virtual destructor. Add debug info support for pure virtual member functions.
llvm-svn: 94519
2010-01-26 05:19:50 +00:00
Anders Carlsson b85f0ab976 Factor creating the DISubprogram for a member function out into a separate function.
llvm-svn: 94513
2010-01-26 04:49:33 +00:00
Devang Patel c54353d935 First cut at emitting inheritance info.
llvm-svn: 94473
2010-01-25 23:32:18 +00:00
Devang Patel 7a12ad0dc1 First cut at emitting debugging information for C++ member functions.
There is lot more work to do in this area.

llvm-svn: 93836
2010-01-19 01:54:44 +00:00
Devang Patel 889ce76f41 Refactor.
llvm-svn: 93814
2010-01-19 00:00:59 +00:00
Devang Patel 934661ed73 Emit human readable names for c/c++ functions. Avoid emitting linkage name if it matches regular name.
llvm-svn: 93383
2010-01-14 00:36:21 +00:00
Benjamin Kramer ba8451b243 Use StringRef in CGDebugInfo::EmitFunctionStart.
llvm-svn: 90856
2009-12-08 14:04:35 +00:00
Anders Carlsson 3efc6e6f46 Add rudimentary support for member pointers to CGDebugInfo.
llvm-svn: 90711
2009-12-06 18:00:51 +00:00
Devang Patel b40f295037 Do not store DIDescriptor directly into a container. Store MDNode directly, through TrackingVH.
llvm-svn: 88677
2009-11-13 19:10:24 +00:00
Anders Carlsson 443f677302 Simplify the debug info code, handle lvalue references and template specializations.
llvm-svn: 86277
2009-11-06 19:19:55 +00:00
Mike Stump ae2559a221 Fixup the return type of functions.
llvm-svn: 84922
2009-10-23 01:52:13 +00:00
Devang Patel 5d90d62701 Add support to attach debug info to an instruction.
This is not yet enabled.

llvm-svn: 83399
2009-10-06 18:36:08 +00:00
Devang Patel faf7e9ad24 Set appropriate context for a global variable while emitting debug info.
llvm-svn: 83352
2009-10-06 00:35:31 +00:00
Mike Stump 2e722b915c Improve debugging information for BlockDeclRefExpr. WIP. Given this
scheme, we can switch the previous scheme over to using this code
path.  There's a bit of simplifications yet to do as well.

llvm-svn: 83138
2009-09-30 02:43:10 +00:00
John McCall 0cf155174e Fix an infinite loop arising when trying to generate debug information
for a ObjC class with an ivar of weak self type.

llvm-svn: 82745
2009-09-25 01:40:47 +00:00
Daniel Dunbar 9996138a80 Ok, an AssertingVH definitely doesn't work for now because we free our cache after the optimizer may have hacked on the module. Use a WeakVH instead.
llvm-svn: 82324
2009-09-19 20:17:48 +00:00
Daniel Dunbar 1cbaae56cf Switch CGDebugInfo type cache to using an AssertingVH.
llvm-svn: 82321
2009-09-19 19:27:24 +00:00
Daniel Dunbar de870bdcf2 Factor out CGDebugInfo::CreateTypeNode method.
- No functionality change.

llvm-svn: 82320
2009-09-19 19:27:14 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Devang Patel 9be7b20401 Revert 75648 for now. It is causing test failures.
llvm-svn: 75684
2009-07-14 21:31:22 +00:00
Devang Patel d6c256696b Use LLVM mangler to get mangled name for debug info entry.
llvm-svn: 75589
2009-07-14 02:47:58 +00:00
Daniel Dunbar f5c79709bc Update debug info generation for ObjCObjectPointer changes.
- Previously this would crash on recursive types, and it was also incorrectly
   stripping off a level of indirection.
 - I'm not 100% convinced this is all correct, but it should be a monotonic
   improvment.

llvm-svn: 75582
2009-07-14 01:20:56 +00:00
Devang Patel 0d425350b2 Revrt PR4228 fix for now.
llvm-svn: 74304
2009-06-26 18:32:22 +00:00
Devang Patel 9fc4341eec It is possible that main input file does not have any symbol with debug info. To handle this edge case, always create main compile unit first.
This fixes PR 4228.

llvm-svn: 73520
2009-06-16 18:02:02 +00:00
Mike Stump 31f099c8c2 Enhance debug information for block literals. Radar 6867696
llvm-svn: 71763
2009-05-14 02:03:51 +00:00
Devang Patel a6acb390e7 Handle corner case where clang-cc is invoked directly to compile preprocessed source file without -main-file-name. In this case, CDDebugInfo is not able identify correct main source file becase SM.isFromMainFile() returns true for locations from header files as well as locations from main source file.
This patch takes conservative approach by not emitting more then one compile unit with isMain bit set.

llvm-svn: 69902
2009-04-23 18:09:16 +00:00
Chris Lattner 7b0344f656 implement debug info for _Complex.
llvm-svn: 69873
2009-04-23 06:13:01 +00:00
Devang Patel 75009454e3 Appropriately set file name and directory name in debug info compile units.
llvm-svn: 69387
2009-04-17 21:06:59 +00:00
Devang Patel f4c205b2fa Add support to emit debug info for objective-c interfaces.
(This is not yet used.)

llvm-svn: 65573
2009-02-26 21:10:26 +00:00
Chris Lattner affb37337f reimplement debug info generation in terms of DebugInfo.h instead of
using MachineModuleInfo.  This runs at about the same speed as the old
code, but fixes a bunch of bugs and is simpler and shorter.

llvm-svn: 58971
2008-11-10 06:08:34 +00:00
Daniel Dunbar 238475c8ca Avoid redundant cast<>s / simplify type dispatch.
llvm-svn: 58892
2008-11-08 06:12:46 +00:00
Chris Lattner 7d7fff2303 privatize some methods.
llvm-svn: 58602
2008-11-03 09:11:11 +00:00
Daniel Dunbar cb4638599c Move IRBuilder type definition to common file.
- No functionality change.

llvm-svn: 58546
2008-11-01 01:53:16 +00:00
Daniel Dunbar d678ae2da3 Quick fix for PR2950, infinite loop generating debug info for
recursive types.
 - Style will be clean up in further patches.

llvm-svn: 58490
2008-10-31 04:04:54 +00:00
Daniel Dunbar a290ded36a Formatting tweaks.
- No functionality change.

llvm-svn: 58488
2008-10-31 03:54:29 +00:00
Daniel Dunbar 607f67b16c Map compilation units using FileEntry pointers instead of
FileIDs. This seems better conceptually and lets the SourceManager
handle details of mapping the location to a file ID.
 - In practice, fixes an assert because this code wasn't using
   getPhysicalLoc.

llvm-svn: 58055
2008-10-24 00:46:51 +00:00
Daniel Dunbar 354d278518 Debug info bug fix, function start wasn't getting generated correctly
for Obj-C methods.

llvm-svn: 57769
2008-10-18 18:22:23 +00:00
Daniel Dunbar b9fd902fdc Change CGDebugInfo::setLocation to just ignore invalid locations. This
simplifies clients.

Also, add assert that RegionStack is empty when the CGDebugInfo is
destroyed.

llvm-svn: 57684
2008-10-17 16:15:48 +00:00
Daniel Dunbar 48595de697 Update for IRBuilder template change (update LLVM!)
llvm-svn: 54642
2008-08-11 16:50:21 +00:00
Chris Lattner c893a67fe3 update to make IRBuilder API change.
llvm-svn: 54548
2008-08-08 19:57:58 +00:00
Sanjiv Gupta 224e8ea2bb Generate debug descriptors for array types while generating the debug info.
llvm-svn: 52140
2008-06-09 10:47:41 +00:00
Sanjiv Gupta 1929242a94 Create debug type descriptors for aggregate/enum types.
llvm-svn: 52070
2008-06-07 04:46:53 +00:00
Sanjiv Gupta 158143ad54 Emit debug information for global and static variables when -g is specified.
llvm-svn: 51993
2008-06-05 08:59:10 +00:00
Sanjiv Gupta 18de624ca0 Emit parameter and local variable debug information with -g.
llvm-svn: 51765
2008-05-30 10:30:31 +00:00
Eli Friedman b65ff27f53 A couple minor fixes to make debug info usable for arbitrary code: don't
emit incomplete types, because they crash llc, and always use the 
logical location as the current location so we don't crash doing invalid 
queries on CurLoc.

llvm-svn: 51675
2008-05-29 11:08:17 +00:00
Sanjiv Gupta 98070578bf Generate subprogram debug info with -g.
Also take care of freeing memory at the right places.

llvm-svn: 51553
2008-05-25 05:15:42 +00:00
Eli Friedman 1763075b9c Make debugging information usable. This is barebones, but it makes -g
actually work (instead of crashing llc), and there's enough info emitted 
to get line number information in gdb. This should hopefully be helpful 
for debugging non-working programs.

I got rid of the begin/endregion calls because the implementation wasn't 
working; someone who knows the debugging info a bit better might try to 
add it. I really have no clue how a compiler is supposed to emit them.

This commit shouldn't have any effect without -g.

llvm-svn: 51404
2008-05-22 01:40:10 +00:00
Sanjiv Gupta 15cb669039 Added -g command line options to clang for generating source level debug information. This patch currently enables generation of line number debug information (stoppoints) and region begin/end debug information. The new files CGDebugInfo.h and CGDebugInfo.cpp implements the debug info manager class CGDebugInfo.
llvm-svn: 50848
2008-05-08 08:54:20 +00:00