[PATCH] D42940: Fix a crash when emitting DIEs for variable-length arrays

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 13:46:31 PST 2018


davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

LGTM. One minor comment inline. Feel free to decide whether you want to address & commit (no need for another round trip)



================
Comment at: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:576
+    return false;
+  return llvm::any_of(Array->getElements(), [&](DINode *El) {
+    if (auto *Subrange = dyn_cast<DISubrange>(El)) {
----------------
Terrific, looks much better now :)


================
Comment at: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:604
+  // Emit local variables.
+  std::stable_sort(Vars.Locals.begin(), Vars.Locals.end(), sortLocalVars);
+  for (DbgVariable *DV : Vars.Locals)
----------------
`sortLocalVars` can be an inline lambda, but hey, up to you.


https://reviews.llvm.org/D42940





More information about the llvm-commits mailing list