summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/FileUtilities.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert "r372201: [Support] Replace function with function_ref in ↵Ilya Biryukov2019-09-181-1/+1
| | | | | | | | | | | writeFileAtomically. NFC" function_ref causes calls to the function to be ambiguous, breaking compilation. Reverting for now. llvm-svn: 372202
* [Support] Replace function with function_ref in writeFileAtomically. NFCIlya Biryukov2019-09-181-1/+1
| | | | | | | | | | | | | | | | | | | Summary: The latter is slightly more efficient and communicates the intent of the API: writeFileAtomically does not own or copy the callback, it merely calls it at some point. Reviewers: jkorous Reviewed By: jkorous Subscribers: hiraditya, dexonsmith, jfb, llvm-commits, cfe-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67584 llvm-svn: 372201
* [Support] Add overload writeFileAtomically(std::function Writer)Jan Korous2019-09-131-16/+47
| | | | | | Differential Revision: https://reviews.llvm.org/D67424 llvm-svn: 371890
* [Support] Add writeFileAtomically() to FileUtilitiesJan Korous2019-09-051-0/+35
| | | | | | Differential Revision: https://reviews.llvm.org/D66859 llvm-svn: 371103
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Fix some Clang-tidy modernize-use-using and Include What You Use warnings; ↵Eugene Zelenko2016-08-231-2/+6
| | | | | | | | other minor fixes. Differential revision: https://reviews.llvm.org/D23789 llvm-svn: 279535
* Remove uses of builtin comma operator.Richard Trieu2016-02-181-2/+4
| | | | | | Cleanup for upcoming Clang warning -Wcomma. No functionality change intended. llvm-svn: 261270
* Remove some calls to std::move.Rafael Espindola2014-08-011-8/+8
| | | | | | | | | Instead of moving out the data in a ErrorOr<std::unique_ptr<Foo>>, get a reference to it. Thanks to David Blaikie for the suggestion. llvm-svn: 214516
* Update the MemoryBuffer API to use ErrorOr.Rafael Espindola2014-07-061-6/+9
| | | | llvm-svn: 212405
* Remove 'using std::errro_code' from lib.Rafael Espindola2014-06-131-3/+2
| | | | llvm-svn: 210871
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-121-0/+1
| | | | | | This should make sure that most new uses use the std prefix. llvm-svn: 210835
* Remove system_error.h.Rafael Espindola2014-06-121-1/+1
| | | | | | | This is a minimal change to remove the header. I will remove the occurrences of "using std::error_code" in a followup patch. llvm-svn: 210803
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-3/+2
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* MemoryBuffer::getFile handles zero sized files, no need to duplicate the test.Rafael Espindola2013-07-101-21/+2
| | | | llvm-svn: 186018
* Remove a use of PathV1.h.Rafael Espindola2013-06-141-15/+9
| | | | llvm-svn: 183982
* Don't use PathV1.h in FileUtilities.h.Rafael Espindola2013-06-131-2/+6
| | | | llvm-svn: 183941
* Add static cast to unsigned char whenever a character classification ↵Guy Benyei2013-02-121-2/+2
| | | | | | function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration. llvm-svn: 175006
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-4/+4
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Change default error_code ctor to a 'named ctor' so it's more self-documenting.David Blaikie2012-02-091-1/+0
| | | | | | | | | | | Unify default construction of error_code uses on this idiom so that users don't feel compelled to make static globals for naming convenience. (unfortunately I couldn't make the original ctor private as some APIs don't return their result, instead using an out parameter (that makes sense to default construct) - which is a bit of a pity. I did, however, find/fix some cases of unnecessary default construction of error_code before I hit the unfixable cases) llvm-svn: 150197
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129558
* MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> ↵Michael J. Spencer2010-12-161-4/+4
| | | | | | via an out parm. llvm-svn: 121958
* Fix whitespace.Michael J. Spencer2010-12-091-3/+3
| | | | llvm-svn: 121382
* Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with ↵Michael J. Spencer2010-12-091-4/+14
| | | | | | error_code &ec. And fix clients. llvm-svn: 121379
* Merge System into Support.Michael J. Spencer2010-11-291-1/+1
| | | | llvm-svn: 120298
* fpcmp: Fix bug where fpcmp wouldn't early exit when files obviously differ andDaniel Dunbar2010-06-151-9/+9
| | | | | | no tolerance is set. llvm-svn: 106033
* fpcmp: Fix a possible infinite loop when comparing something like:Daniel Dunbar2010-06-151-0/+8
| | | | | | | | | 1..19 ok to 1..20 o k (yes, the odd space is necessary). llvm-svn: 106032
* Convert some users of ftostr to raw_ostream.Benjamin Kramer2010-01-291-7/+7
| | | | llvm-svn: 94808
* Fix more -Wshorten-64-to-32 warnings.Evan Cheng2008-05-051-2/+4
| | | | llvm-svn: 50659
* Change the MemoryBuffer::getFile* methods to take just a pointer to theChris Lattner2008-04-011-4/+2
| | | | | | | | 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. llvm-svn: 49041
* Change DiffFilesWithTolerance to be written in terms of MemoryBuffer,Chris Lattner2008-04-011-73/+56
| | | | | | | | not an mmapped file. This more closely matches its requirements and provides an implicitly null terminated buffer, something this routine had to emulate itself before. llvm-svn: 49024
* Remove MappedFile support for mapping files for write and execChris Lattner2008-04-011-2/+2
| | | | | | | and shared. This complicates the design, is not used, and probably doesn't even work. llvm-svn: 49022
* Unbreak build with gcc 4.3: provide missed includes and silence most ↵Anton Korobeynikov2008-02-201-0/+1
| | | | | | annoying warnings. llvm-svn: 47367
* Simplify the code and fix a typo.Lauro Ramos Venancio2008-01-281-7/+4
| | | | llvm-svn: 46458
* Fix fpcmp infinite loop when comparing "29-266" with "29-268".Lauro Ramos Venancio2008-01-281-5/+21
| | | | llvm-svn: 46455
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* For PR1291:Reid Spencer2007-04-071-2/+2
| | | | | | | Change uses of sys::Path class to sys::PathWithStatus in those places where the file status information is needed. llvm-svn: 35743
* For PR789:Reid Spencer2007-03-291-5/+6
| | | | | | | | Make the sys::Path::getFileStatus function more efficient by having it return a pointer to the FileStatus structure rather than copy it. Adjust uses of the function accordingly. Also, fix some memory issues in sys::Path. llvm-svn: 35476
* For PR789:Reid Spencer2007-03-291-2/+2
| | | | | | Updates for change in interface of getFileStatus method of sys::Path class. llvm-svn: 35458
* Make the absolute/relative tolerance information easier to read/understand.Reid Spencer2006-11-251-2/+3
| | | | llvm-svn: 31908
* Remove redundant <cmath>.Jim Laskey2006-11-081-1/+0
| | | | llvm-svn: 31561
* Beef up the output from DiffFilesWithTolerance by setting the error codeReid Spencer2006-10-181-3/+16
| | | | | | | to describe the difference being reported. This assists with understanding differences an llvm-test and should help with bugpoint too. llvm-svn: 31044
* For PR797:Reid Spencer2006-08-231-83/+75
| | | | | | | Final remove of exception handling from this file. lib/System can no longer throw exceptions so there's no need for try/catch blocks here. llvm-svn: 29848
* For PR797:Reid Spencer2006-08-221-6/+14
| | | | | | | | | | Adjust users of MappedFile to its new non-throwing interface. Note that in most cases the lazy step of just throwing after a call to MappedFile was installed. This was done in the name of incremental changes. Getting rid of the new throw statements will take adjustment of interfaces and propagation of errors to higher levels. Those changes will come in subsequent patches. llvm-svn: 29817
* Change Path::getStatusInfo to return a boolean and error string on an errorChris Lattner2006-07-281-12/+16
| | | | | | | | instead of throwing an exception. This reduces the amount of code that is exposed to exceptions (e.g. FileUtilities), though it is clearly only one step along the way. llvm-svn: 29395
* For PR777:Reid Spencer2006-05-151-0/+3
| | | | | | | Add an additional catch block to ensure that this function can't throw any exceptions, even one's we're not expecting. llvm-svn: 28309
* 200.sixtrack prints FP numbers with a very strange notation that uses DChris Lattner2005-08-021-3/+21
| | | | | | | instead of E for exponentials (e.g. 1.234D-43). Add support for this notation. llvm-svn: 22574
* Remove trailing whitespaceMisha Brukman2005-04-211-6/+6
| | | | llvm-svn: 21422
* Fix a bug where we would consider " .99" and "1.0" different because of theChris Lattner2005-03-171-0/+9
| | | | | | leading whitespace. llvm-svn: 20647
* Instead of doing a manual comparison loop, just use memcmp, thanks to JohnCChris Lattner2005-02-151-9/+6
| | | | | | for the suggestion! :) llvm-svn: 20203
* Make this more efficient now that we know both files are the same length.Chris Lattner2005-02-151-2/+2
| | | | llvm-svn: 20202
OpenPOWER on IntegriCloud