[PATCH] D100116: Reuse temporary files for print-changed=diff.

Jamie Schmeiser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 8 08:33:09 PDT 2021


jamieschmeiser created this revision.
jamieschmeiser added a reviewer: aeubanks.
Herald added a subscriber: hiraditya.
jamieschmeiser requested review of this revision.
Herald added a project: LLVM.

Make the file name and descriptors static so that they are reused by
print-changed=diff.  This avoids errors about being unable to create
temporary files when doing the later comparisons in a large compile.

This was originally in the code but was removed during the review
because I didn't remember that it prevented this problem.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100116

Files:
  llvm/lib/Passes/StandardInstrumentations.cpp


Index: llvm/lib/Passes/StandardInstrumentations.cpp
===================================================================
--- llvm/lib/Passes/StandardInstrumentations.cpp
+++ llvm/lib/Passes/StandardInstrumentations.cpp
@@ -138,8 +138,8 @@
   // Store the 2 bodies into temporary files and call diff on them
   // to get the body of the node.
   const unsigned NumFiles = 3;
-  std::string FileName[NumFiles];
-  int FD[NumFiles]{-1, -1, -1};
+  static std::string FileName[NumFiles];
+  static int FD[NumFiles]{-1, -1, -1};
   for (unsigned I = 0; I < NumFiles; ++I) {
     if (FD[I] == -1) {
       SmallVector<char, 200> SV;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100116.336126.patch
Type: text/x-patch
Size: 626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210408/38c8d337/attachment.bin>


More information about the llvm-commits mailing list