================
@@ -780,12 +780,10 @@ static void populateSymbolInfo(SymbolInfo &I, const T *D, 
const FullComment *C,
     MangledStream << D->getNameAsString();
   // A 250 length limit was chosen since 255 is a common limit across
   // different filesystems, with a 5 character buffer for file extensions.
-  if (MangledName.size() > 250)
-    // File creation fails if the mangled name is too long, so default to the
-    // USR. We should look for a better check since filesystems differ in
-    // maximum filename length
-    I.MangledName = llvm::toStringRef(llvm::toHex(I.USR));
-  else
+  if (MangledName.size() > 250) {
+    auto SymbolID = llvm::toStringRef(llvm::toHex(I.USR)).str();
+    I.MangledName = MangledName.substr(0, 250 - SymbolID.size()) + SymbolID;
----------------
evelez7 wrote:

I tried this but I need to know the hex version of the USR's length to 
subtract, not the Info's hashed SymbolID. I think the hex value is guaranteed 
to be at most 40. Do you know if that's an upper limit? There's a reference to 
that in the YAML generator. If it is a constant, this would work and be better 
than querying for the length since anything greater than that would break this 
anyways. The test has a 40 character hex.

https://github.com/llvm/llvm-project/pull/159490
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to