[llvm] 3879fcd - Reuse temporary files for print-changed=diff

Jamie Schmeiser via llvm-commits llvm-commits at lists.llvm.org
Thu May 27 07:20:16 PDT 2021


Author: Jamie Schmeiser
Date: 2021-05-27T10:19:13-04:00
New Revision: 3879fcdb8733075cc5283199b89111d81b1f2d78

URL: https://github.com/llvm/llvm-project/commit/3879fcdb8733075cc5283199b89111d81b1f2d78
DIFF: https://github.com/llvm/llvm-project/commit/3879fcdb8733075cc5283199b89111d81b1f2d78.diff

LOG: Reuse temporary files for print-changed=diff

Summary:
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.

Author: Jamie Schmeiser <schmeise at ca.ibm.com>
Reviewed By: aeubanks (Arthur Eubanks)
Differential Revision: https://reviews.llvm.org/D100116

Added: 
    

Modified: 
    llvm/lib/Passes/StandardInstrumentations.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp
index 0410fdbccc0c1..b28f4bab39e3e 100644
--- a/llvm/lib/Passes/StandardInstrumentations.cpp
+++ b/llvm/lib/Passes/StandardInstrumentations.cpp
@@ -132,8 +132,8 @@ std::string doSystemDiff(StringRef Before, StringRef After,
   // 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;


        


More information about the llvm-commits mailing list