Michael J. Spencer 
							
						 
					 
					
						
						
							
						
						333fb04506 
					 
					
						
						
							
							Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121379  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-12-09 17:36:48 +00:00 
						 
				 
			
				
					
						
							
							
								Michael J. Spencer 
							
						 
					 
					
						
						
							
						
						1f6efa3996 
					 
					
						
						
							
							Merge System into Support.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-11-29 18:16:10 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						7cf705461c 
					 
					
						
						
							
							add a MemoryBuffer::getOpenFile method, which turns an open  
						
						... 
						
						
						
						file descriptor into a MemoryBuffer (and closes the FD).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120065  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-11-23 22:20:27 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						9f9bd8e4af 
					 
					
						
						
							
							Revert functionality doug added in r98575 that was never  
						
						... 
						
						
						
						documented and only used by some clang stuff I just removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120002  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-11-23 06:09:51 +00:00 
						 
				 
			
				
					
						
							
							
								Benjamin Kramer 
							
						 
					 
					
						
						
							
						
						831338b320 
					 
					
						
						
							
							Rewrite MemoryBuffer::getSTDIN to use read(2) and a SmallVector buffer.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106856  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-06-25 16:07:18 +00:00 
						 
				 
			
				
					
						
							
							
								Benjamin Kramer 
							
						 
					 
					
						
						
							
						
						7262c19c41 
					 
					
						
						
							
							Bring back the empty vector workaround I removed in r106839. Looks like MSVC needs it.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106841  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-06-25 12:51:01 +00:00 
						 
				 
			
				
					
						
							
							
								Benjamin Kramer 
							
						 
					 
					
						
						
							
						
						d4d1f85aa7 
					 
					
						
						
							
							Tweak MemoryBuffer to allocate the class itself, the name and possibly the  
						
						... 
						
						
						
						buffer in the same chunk of memory.
2 less mallocs for every uninitialized MemoryBuffer and 1 less malloc for every
MemoryBuffer pointing to a memory range translate into 20% less mallocs on
clang -cc1 -Eonly Cocoa_h.m.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106839  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-06-25 11:50:40 +00:00 
						 
				 
			
				
					
						
							
							
								Dan Gohman 
							
						 
					 
					
						
						
							
						
						60e6f3d412 
					 
					
						
						
							
							Add overloads for getFile and getFileOrSTDIN which take a const char *  
						
						... 
						
						
						
						instead of a StringRef, avoiding the need to copy the string in the
common case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106754  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-06-24 16:25:50 +00:00 
						 
				 
			
				
					
						
							
							
								Dan Gohman 
							
						 
					 
					
						
						
							
						
						455164bdff 
					 
					
						
						
							
							Add an explicit keyword.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106538  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-06-22 13:53:29 +00:00 
						 
				 
			
				
					
						
							
							
								Dan Gohman 
							
						 
					 
					
						
						
							
						
						30377e7809 
					 
					
						
						
							
							Add basic error checking to MemoryBuffer::getSTDIN.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104855  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-05-27 17:31:51 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						4c842dda39 
					 
					
						
						
							
							stringref-ize the MemoryBuffer::get apis.  This requires  
						
						... 
						
						
						
						a co-committed clang patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100485  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-04-05 22:42:30 +00:00 
						 
				 
			
				
					
						
							
							
								Benjamin Kramer 
							
						 
					 
					
						
						
							
						
						d48c1f9b10 
					 
					
						
						
							
							Remove accidental include and add a comment.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100107  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-04-01 14:39:55 +00:00 
						 
				 
			
				
					
						
							
							
								Benjamin Kramer 
							
						 
					 
					
						
						
							
						
						6a9cd41549 
					 
					
						
						
							
							Various improvements to MemoryBuffer::getFile:  
						
						... 
						
						
						
						- Use a RAII object to close the FD.
- Use sys::StrError instead of thread-unsafe strerror calls.
- Recover gracefully if read returns zero. This works around an issue on
  DragonFlyBSD where /dev/null has an st_size of 136 but we can't read 136 bytes
  from it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100106  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-04-01 14:35:22 +00:00 
						 
				 
			
				
					
						
							
							
								Douglas Gregor 
							
						 
					 
					
						
						
							
						
						1bb30b6f75 
					 
					
						
						
							
							Extend MemoryBuffer::getFile() to take an optional "stat" structure  
						
						... 
						
						
						
						pointer. If given, the structure will be set with the stat information from
the file actually read.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98575  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-03-15 20:32:14 +00:00 
						 
				 
			
				
					
						
							
							
								Benjamin Kramer 
							
						 
					 
					
						
						
							
						
						aabc26c4d5 
					 
					
						
						
							
							Replace a temporary std::string with SmallString.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97259  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2010-02-26 20:28:29 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						62dc896bc4 
					 
					
						
						
							
							sizeof(char) is always 1.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92079  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2009-12-23 23:03:24 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						6e1f16d522 
					 
					
						
						
							
							return more useful error messages by using strerror to format errno  
						
						... 
						
						
						
						instead of returning an ambiguous reason.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90275  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2009-12-01 22:51:41 +00:00 
						 
				 
			
				
					
						
							
							
								Daniel Dunbar 
							
						 
					 
					
						
						
							
						
						d65267ee62 
					 
					
						
						
							
							Fix MemoryBuffer::getSTDIN to *not* return null if stdin is empty, this is a lame API.  
						
						... 
						
						
						
						Also, Stringrefify some more MemoryBuffer functions, and add two performance FIXMEs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86630  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2009-11-10 00:43:58 +00:00 
						 
				 
			
				
					
						
							
							
								Duncan Sands 
							
						 
					 
					
						
						
							
						
						7127b13342 
					 
					
						
						
							
							A value is only assigned to errno if NumRead equals -1, so do  
						
						... 
						
						
						
						not reason based on errno if NumRead has a different value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86046  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2009-11-04 20:50:23 +00:00 
						 
				 
			
				
					
						
							
							
								Duncan Sands 
							
						 
					 
					
						
						
							
						
						954cb43c80 
					 
					
						
						
							
							Make this code more robust by not thinking we are making progress  
						
						... 
						
						
						
						if zero bytes were read.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85922  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2009-11-03 19:10:22 +00:00 
						 
				 
			
				
					
						
							
							
								Eli Friedman 
							
						 
					 
					
						
						
							
						
						96cd7af935 
					 
					
						
						
							
							Tweak MemoryBuffer::getSTDIN so that it returns after the first EOF.  
						
						... 
						
						
						
						It doesn't matter for piped input, but it's annoying when typing at the 
console.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71998  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2009-05-18 08:44:04 +00:00 
						 
				 
			
				
					
						
							
							
								Evan Cheng 
							
						 
					 
					
						
						
							
						
						e2b3fdd649 
					 
					
						
						
							
							Switch from new[] + delete[] to malloc + free since llvm does not catch C++ exceptions.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64448  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2009-02-13 08:24:55 +00:00 
						 
				 
			
				
					
						
							
							
								Evan Cheng 
							
						 
					 
					
						
						
							
						
						726135ad1a 
					 
					
						
						
							
							If new[] fails, return 0 rather then trying to dereference a null pointer.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64444  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2009-02-13 07:54:34 +00:00 
						 
				 
			
				
					
						
							
							
								Evan Cheng 
							
						 
					 
					
						
						
							
						
						34cd4a484e 
					 
					
						
						
							
							Fix more -Wshorten-64-to-32 warnings.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50659  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2008-05-05 18:30:58 +00:00 
						 
				 
			
				
					
						
							
							
								Gabor Greif 
							
						 
					 
					
						
						
							
						
						8811080a65 
					 
					
						
						
							
							fcntl.h is pretty standard on unix (without the sys/)  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50475  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2008-04-30 08:53:22 +00:00 
						 
				 
			
				
					
						
							
							
								Bill Wendling 
							
						 
					 
					
						
						
							
						
						a442006f48 
					 
					
						
						
							
							Fix compilation errors on MSVC. Patch by Argiris Kirtzidis!  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49055  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2008-04-01 22:09:20 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						038112a4e0 
					 
					
						
						
							
							Change the MemoryBuffer::getFile* methods to take just a pointer to the  
						
						... 
						
						
						
						start of a filename, not a filename+length.  All clients can produce a
null terminated name, and the system api's require null terminated 
strings anyway.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49041  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2008-04-01 18:04:03 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						11da4cf25c 
					 
					
						
						
							
							Reimplement MemoryBuffer::getFile with three enhancements:  
						
						... 
						
						
						
						1) stop using MappedFile.
2) if profitable use the sys::path::MapInFilePages api to
   read the file.
3) otherwise fallback to read.
When sys::path::MapInFilePages is implemented, this provides
several benefits:
#1 : this avoids fragmenting memory for small files.
#2 : this avoids extraneous stat calls when the file size is known.
#3 : this only keeps the file descriptor open while reading the 
    file, not for the duration of the lifetime of the memory 
    buffer.  This fixes a serious clang FD 'leak' problem.
I believe that this will work on a win32 machine, but I don't have
one to test on.  I'd appreciate it if someone could check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49031  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2008-04-01 06:05:21 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						37db5d67f9 
					 
					
						
						
							
							Remove the MappedFile::charBase member, rename base -> getBase() and  
						
						... 
						
						
						
						make getBase() return a const-correct pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49025  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2008-04-01 03:40:53 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						bdbd2d710c 
					 
					
						
						
							
							Remove MappedFile support for mapping files for write and exec  
						
						... 
						
						
						
						and shared.  This complicates the design, is not used, and probably
doesn't even work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49022  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2008-04-01 03:10:22 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						4ee451de36 
					 
					
						
						
							
							Remove attribution from file headers, per discussion on llvmdev.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2007-12-29 20:36:04 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						2b1f1066ac 
					 
					
						
						
							
							Fix the Linker testcase regressions, by making MemoryBuffer::getFileOrSTDIN return  
						
						... 
						
						
						
						a valid but empty buffer if stdin is empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44219  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2007-11-18 18:52:28 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						3daae2701b 
					 
					
						
						
							
							Add new MemoryBuffer::getMemBufferCopy method.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42815  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2007-10-09 21:46:38 +00:00 
						 
				 
			
				
					
						
							
							
								Reid Spencer 
							
						 
					 
					
						
						
							
						
						2372ccc111 
					 
					
						
						
							
							Make getSTDIN return null if the standard input is empty, as the header file  
						
						... 
						
						
						
						documentation implies and as its uses depend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40939  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2007-08-08 20:01:58 +00:00 
						 
				 
			
				
					
						
							
							
								Nick Lewycky 
							
						 
					 
					
						
						
							
						
						ea332946d3 
					 
					
						
						
							
							Fix undefined behaviour reported by the new --enable-expensive-checks option.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37829  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2007-07-01 03:06:30 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						a24b04e9e5 
					 
					
						
						
							
							fix a memory leak  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36981  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2007-05-11 00:43:26 +00:00 
						 
				 
			
				
					
						
							
							
								Jeff Cohen 
							
						 
					 
					
						
						
							
						
						0fea8ebb4a 
					 
					
						
						
							
							Unbreak VC++ build.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36901  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2007-05-07 15:21:46 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						5499da8833 
					 
					
						
						
							
							Enhance MemoryBuffer to return error messages in strings if they occur.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36899  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2007-05-06 23:32:36 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						82e791dc42 
					 
					
						
						
							
							Fix MemoryBuffer::getFile to return null if it has an error opening the  
						
						... 
						
						
						
						file instead of aborting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36858  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2007-05-06 07:24:46 +00:00 
						 
				 
			
				
					
						
							
							
								Jeff Cohen 
							
						 
					 
					
						
						
							
						
						930c0fead9 
					 
					
						
						
							
							Fix MemoryBuffer breakage correctly.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36561  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2007-04-29 14:43:31 +00:00 
						 
				 
			
				
					
						
							
							
								Jeff Cohen 
							
						 
					 
					
						
						
							
						
						9bc406019e 
					 
					
						
						
							
							Unbreak build.  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36559  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2007-04-29 14:21:44 +00:00 
						 
				 
			
				
					
						
							
							
								Chris Lattner 
							
						 
					 
					
						
						
							
						
						333ffd4abf 
					 
					
						
						
							
							Add a new memorybuffer class, to unify all the file reading code in the system  
						
						... 
						
						
						
						git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36553  91177308-0d34-0410-b5e6-96231b3b80d8 
						
						
					 
					
						2007-04-29 06:58:52 +00:00