[Mlir-commits] [mlir] [libunwind] [clang-tools-extra] [lld] [lldb] [compiler-rt] [libcxxabi] [clang] [llvm] [libc] [flang] [libcxx] PR#72453 : Exceeding maximum file name length (PR #72654)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Nov 17 06:46:58 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Shahid Iqbal (shahidiqbal13)
<details>
<summary>Changes</summary>
This issue is raised by @<!-- -->DrTodd13
The code in include/llvm/Analysis/DOTGraphTraitsPass.h will exceed most normal file system's maximum filename length of 255 if, e.g., the function's name is that length.
---
Full diff: https://github.com/llvm/llvm-project/pull/72654.diff
2 Files Affected:
- (modified) clang/NOTES.txt (+2)
- (modified) llvm/include/llvm/Analysis/DOTGraphTraitsPass.h (+5-3)
``````````diff
diff --git a/clang/NOTES.txt b/clang/NOTES.txt
index f06ea8c70cd3409..c83dda52a1fc21e 100644
--- a/clang/NOTES.txt
+++ b/clang/NOTES.txt
@@ -4,6 +4,8 @@
//===---------------------------------------------------------------------===//
+//TESTING git infra//
+
To time GCC preprocessing speed without output, use:
"time gcc -MM file"
This is similar to -Eonly.
diff --git a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
index 07c08bc1cc3bcb6..f78d8ff52ee3932 100644
--- a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
+++ b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
@@ -17,6 +17,8 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/GraphWriter.h"
+#define MAX_FILENAME_LEN 255
+
namespace llvm {
/// Default traits class for extracting a graph from an analysis pass.
@@ -94,7 +96,7 @@ void printGraphForFunction(Function &F, GraphT Graph, StringRef Name,
raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
std::string GraphName = DOTGraphTraits<GraphT>::getGraphName(Graph);
- if (!EC)
+ if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
WriteGraph(File, Graph, IsSimple,
GraphName + " for '" + F.getName() + "' function");
else
@@ -280,7 +282,7 @@ class DOTGraphTraitsModulePrinterWrapperPass : public ModulePass {
raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
std::string Title = DOTGraphTraits<GraphT>::getGraphName(Graph);
- if (!EC)
+ if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
WriteGraph(File, Graph, IsSimple, Title);
else
errs() << " error opening file for writing!";
@@ -310,7 +312,7 @@ void WriteDOTGraphToFile(Function &F, GraphT &&Graph,
std::string GraphName = DOTGraphTraits<GraphT>::getGraphName(Graph);
std::string Title = GraphName + " for '" + F.getName().str() + "' function";
- if (!EC)
+ if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
WriteGraph(File, Graph, IsSimple, Title);
else
errs() << " error opening file for writing!";
``````````
</details>
https://github.com/llvm/llvm-project/pull/72654
More information about the Mlir-commits
mailing list