[cfe-commits] r168636 - in /cfe/trunk: lib/Frontend/CompilerInstance.cpp test/Misc/dev-fd-fs.c

Daniel Dunbar daniel at zuster.org
Mon Nov 26 16:04:17 PST 2012


Author: ddunbar
Date: Mon Nov 26 18:04:16 2012
New Revision: 168636

URL: http://llvm.org/viewvc/llvm-project?rev=168636&view=rev
Log:
Frontend: Create a virtual file for named pipe inputs.
 - This ensures we see the right buffer size for the file.

Modified:
    cfe/trunk/lib/Frontend/CompilerInstance.cpp
    cfe/trunk/test/Misc/dev-fd-fs.c

Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=168636&r1=168635&r2=168636&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Mon Nov 26 18:04:16 2012
@@ -620,7 +620,6 @@
       Diags.Report(diag::err_fe_error_reading) << InputFile;
       return false;
     }
-    SourceMgr.createMainFileID(File, Kind);
 
     // The natural SourceManager infrastructure can't currently handle named
     // pipes, but we would at least like to accept them for the main
@@ -632,8 +631,13 @@
         Diags.Report(diag::err_cannot_open_file) << InputFile << ec.message();
         return false;
       }
+
+      // Create a new virtual file that will have the correct size.
+      File = FileMgr.getVirtualFile(InputFile, MB->getBufferSize(), 0);
       SourceMgr.overrideFileContents(File, MB.take());
     }
+
+    SourceMgr.createMainFileID(File, Kind);
   } else {
     OwningPtr<llvm::MemoryBuffer> SB;
     if (llvm::MemoryBuffer::getSTDIN(SB)) {

Modified: cfe/trunk/test/Misc/dev-fd-fs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/dev-fd-fs.c?rev=168636&r1=168635&r2=168636&view=diff
==============================================================================
--- cfe/trunk/test/Misc/dev-fd-fs.c (original)
+++ cfe/trunk/test/Misc/dev-fd-fs.c Mon Nov 26 18:04:16 2012
@@ -1,8 +1,5 @@
 // Check that we can operate on files from /dev/fd.
 // REQUIRES: dev-fd-fs
-//
-// Currently, this only appears to work on Darwin's dev-fs.
-// REQUIRES: system-darwin
 
 
 // Check reading from named pipes. We cat the input here instead of redirecting





More information about the cfe-commits mailing list