================
@@ -138,15 +138,9 @@ std::string getNamespaceScope(const Decl *D) {
 
 std::string printDefinition(const Decl *D, PrintingPolicy PP,
                             const syntax::TokenBuffer &TB) {
-  if (auto *VD = llvm::dyn_cast<VarDecl>(D)) {
-    if (auto *IE = VD->getInit()) {
-      // Initializers might be huge and result in lots of memory allocations in
-      // some catostrophic cases. Such long lists are not useful in hover cards
-      // anyway.
-      if (200 < TB.expandedTokens(IE->getSourceRange()).size())
-        PP.SuppressInitializers = true;
-    }
-  }
+  // Initializers might be huge and result in lots of memory allocations in 
some
+  // catostrophic cases. Such long lists are not useful in hover cards anyway.
+  PP.EntireContentsOfLargeArray = false;
----------------
rwols wrote:

> a more concrete approach could be based on counting number of "total" 
> elements in the initializer list, and setting the suppression flag based on 
> that. i'd actually lean towards such a solution, WDYT?

I agree, but don't know where to start on this. Since TokenBuffer doesn't have 
tokens from the preamble, what alternatives are there?

https://github.com/llvm/llvm-project/pull/79746
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to