[clang-tools-extra] [clang] [clangd] Prevent printing huge initializer lists in hover definitions (PR #79746)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 00:41:13 PST 2024


================
@@ -1720,6 +1720,12 @@ void StmtPrinter::VisitInitListExpr(InitListExpr* Node) {
   OS << "{";
   for (unsigned i = 0, e = Node->getNumInits(); i != e; ++i) {
     if (i) OS << ", ";
+    // TODO: There is duplicated functionality in APValue::printPretty.
+    // Would be good to consolidate the two.
+    if (!Policy.EntireContentsOfLargeArray && i == 10) {
----------------
kadircet wrote:

i am not sure if usage of this flag is actually appropriate here. it specifically says "contents of large arrays" but here we have an initializer list, not necessarily an array.

moreover this fix is in clang, independent of clangd, so I think it deserves its own patch, with relevant owners from clang. can you separate it out? i'd like to hear their opinion on using this flag.

https://github.com/llvm/llvm-project/pull/79746


More information about the cfe-commits mailing list