[libc-commits] [clang-tools-extra] [libc] [llvm] [clang] [libunwind] [lld] [libcxx] [lldb] [compiler-rt] [libcxxabi] [mlir] [flang] PR#72453 : Exceeding maximum file name length (PR #72654)

Todd A. Anderson via libc-commits libc-commits at lists.llvm.org
Mon Nov 20 08:41:38 PST 2023


================
@@ -83,10 +85,29 @@ struct DOTGraphTraitsViewer
   StringRef Name;
 };
 
+static void shortenFileName(std::string &FN, unsigned char len = 250) {
+
+  FN = FN.substr(0, len);
+  if (nameObj.empty())
+    nameObj.push_back(FN);
+
+  else {
+    for (auto it = nameObj.begin(); it != nameObj.end(); it++) {
+      if (*it == FN) {
+        FN = FN.substr(0, --len);
----------------
DrTodd13 wrote:

@shahidiqbal13 Thanks for the changes. Just one minor point, you don't need the initial "if" to check for empty set anymore.  The first time through the loop if it isn't found in the set then it will add it.  Also, I don't know how much we need to consider this but sometimes ordering will be reversed and so the filename assigned to a function would be different in your approach based on which function is encountered first.  With the hash approach this wouldn't happen.  At this point, we need input from regular LLVM devs in terms of how they like to do things.

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


More information about the libc-commits mailing list