[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-02-09 Thread Carlos Alberto Enciso via Phabricator via cfe-commits
CarlosAlbertoEnciso added a comment. Hi @sdesmalen! For the following test case int main() { int size = 2; int var[size]; var[1] = 1; return 0; } I compared the DWARF generated by GCC and it looks like DW_TAG_variable "var" DW_AT_location ... DW_AT_type

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-02-09 Thread Carlos Alberto Enciso via Phabricator via cfe-commits
CarlosAlbertoEnciso added a comment. Hi @sdesmalen! First of all my apologies for commenting after the issue has been closed, but I do not have an account to add a comment to the associated bugzilla. I have found what it seems to be an issue with the current implementation. For the given test

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-02-01 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL323952: [DebugInfo] Enable debug information for C99 VLA types (authored by s.desmalen, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit:

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-02-01 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC323952: [DebugInfo] Enable debug information for C99 VLA types (authored by s.desmalen, committed by ). Changed prior to commit: https://reviews.llvm.org/D41698?vs=132275=132350#toc Repository: rC

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-02-01 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen marked an inline comment as done. sdesmalen added a comment. Thanks for your review @aprantl! https://reviews.llvm.org/D41698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-31 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl accepted this revision. aprantl added inline comments. This revision is now accepted and ready to land. Comment at: lib/CodeGen/CGDecl.cpp:994 + cast(VlaSize.NumElts)->getName()); + auto QT = getContext().getIntTypeForBitwidth(VlaSize.NumElts->getType() +

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-31 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen updated this revision to Diff 132275. sdesmalen added a comment. - Now always emit an alloca for a VLA dimension expression (regardless of whether -g is passed). - Fixed up some more tests since it now also triggers for all tests with variable length arrays that don't pass -g. -

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-31 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl requested changes to this revision. aprantl added a comment. This revision now requires changes to proceed. The correct way to fix this is to generate the stack object unconditionally (it will get optimized away by mem2reg when optimizations are enabled) and only emit the dbg.declare

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-31 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:990 + D.getLocation(), D.getLocation(), , QT, + getContext().CreateTypeSourceInfo(QT), SC_Auto); + aprantl wrote: > sdesmalen wrote: > > aprantl wrote: > > > I think it does,

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-30 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added inline comments. Comment at: lib/CodeGen/CGDecl.cpp:990 + D.getLocation(), D.getLocation(), , QT, + getContext().CreateTypeSourceInfo(QT), SC_Auto); + sdesmalen wrote: > aprantl wrote: > > I think it does, but can you assert me

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-30 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen updated this revision to Diff 131990. sdesmalen marked 4 inline comments as done. sdesmalen added a comment. Herald added a subscriber: jholewinski. - Changed return type of getVLASize() to a struct with named members. - EmitDeclare and EmitDeclareOfAutoVariable now return a

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-30 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen added inline comments. Comment at: lib/CodeGen/CGDebugInfo.h:474 + CGBuilderTy , + llvm::Metadata **MetadataDecl = nullptr); aprantl wrote: > same here. Why not just use a return value? Initially I thought it would

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-26 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added inline comments. Comment at: lib/CodeGen/CGDebugInfo.h:395 + CGBuilderTy , + llvm::Metadata **MetadataDecl = nullptr); I think ``` llvm::DILocalVariable*

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-26 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen added a comment. Just a gentle reminder that this patch still needs to be accepted (the LLVM support for it has been merged). https://reviews.llvm.org/D41698 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-16 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added inline comments. Comment at: lib/CodeGen/CGDebugInfo.h:86 + /// represented by instantiated Metadata nodes. + llvm::SmallDenseMap SizeExprCache; + sdesmalen wrote: > aprantl wrote: > > I'm expecting VLA's to not be

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-16 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen marked 3 inline comments as done. sdesmalen added inline comments. Comment at: lib/CodeGen/CGDebugInfo.cpp:2358 +if (auto *SizeNode = getVLASizeExpressionForType(EltTy)) + Subscripts.push_back(DBuilder.getOrCreateSubrange(0, SizeNode)); +else

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-16 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen updated this revision to Diff 129943. sdesmalen added a comment. Refactoring based on @aprantl's suggestions. https://reviews.llvm.org/D41698 Files: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h lib/CodeGen/CGDecl.cpp lib/CodeGen/CodeGenFunction.cpp

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-03 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added a comment. It would be awesome if you could also add an end-to-end test to the debuginfo-tests repository so we can verify that this actually works in LLDB and GDB. Comment at: lib/CodeGen/CGDebugInfo.cpp:2358 +if (auto *SizeNode =

[PATCH] D41698: [DebugInfo] Enable debug information for C99 VLA types

2018-01-03 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen created this revision. sdesmalen added reviewers: echristo, aprantl, dexonsmith, clayborg, pcc, kristof.beyls. Herald added a subscriber: JDevlieghere. This patch enables debugging of C99 VLA types by generating more precise LLVM Debug metadata, using the extended DISubrange 'count'