summaryrefslogtreecommitdiff
path: root/llvm/lib/Support/FileUtilities.cpp
AgeCommit message (Collapse)Author
2023-07-06[llvm][Support] Deprecate llvm::writeFileAtomically APIHaojian Wu
We're in favor of the llvm::writeToOutput API, and all writeFileAtomically usages have been migrated to writeToOutput. Differential Revision: https://reviews.llvm.org/D153740
2023-03-27[documentation] Fix TyposPriyanshi Agarwal
Fixes https://github.com/llvm/llvm-project/issues/56747 Patch By: ipriyanshi1708 Differential Revision: https://reviews.llvm.org/D146644
2022-12-16[Support] llvm::Optional => std::optionalFangrui Song
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-09-29Include <cmath> in FileUtilities.cpp for std:abs(double)Rahul Joshi
2022-04-22[llvm-objcopy][NFC] refactor restoreStatOnFile out of llvm-objcopy.Alexey Lapshin
Functionality of restoreStatOnFile may be reused. Move it into FileUtilities.cpp. Create helper class FilePermissionsApplier to store and apply permissions. Differential Revision: https://reviews.llvm.org/D123821
2022-01-26[NFC] Additional header dependency cleanup LLVMSupportserge-sans-paille
A few more forward-declarations, a few less headers. the impact on number of preprocessed lines for LLVMSupport is negligible (-3K lines) but it's always good to remove dependencies. Related discourse thread: https://llvm.discourse.group/t/include-what-you-use-include-cleanup
2022-01-21[llvm] Cleanup header dependencies in ADT and Supportserge-sans-paille
The cleanup was manual, but assisted by "include-what-you-use". It consists in 1. Removing unused forward declaration. No impact expected. 2. Removing unused headers in .cpp files. No impact expected. 3. Removing unused headers in .h files. This removes implicit dependencies and is generally considered a good thing, but this may break downstream builds. I've updated llvm, clang, lld, lldb and mlir deps, and included a list of the modification in the second part of the commit. 4. Replacing header inclusion by forward declaration. This has the same impact as 3. Notable changes: - llvm/Support/TargetParser.h no longer includes llvm/Support/AArch64TargetParser.h nor llvm/Support/ARMTargetParser.h - llvm/Support/TypeSize.h no longer includes llvm/Support/WithColor.h - llvm/Support/YAMLTraits.h no longer includes llvm/Support/Regex.h - llvm/ADT/SmallVector.h no longer includes llvm/Support/MemAlloc.h nor llvm/Support/ErrorHandling.h You may need to add some of these headers in your compilation units, if needs be. As an hint to the impact of the cleanup, running clang++ -E -Iinclude -I../llvm/include ../llvm/lib/Support/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l before: 8000919 lines after: 7917500 lines Reduced dependencies also helps incremental rebuilds and is more ccache friendly, something not shown by the above metric :-) Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup/5831
2021-08-29[Support] Remove redundant calls to str() and c_str() (NFC)Kazu Hirata
Identified with readability-redundant-string-cstr.
2020-05-02std::isspace -> llvm::isSpace (where locale should be ignored)Sam McCall
I've left out some cases where I wasn't totally sure this was right or whether the include was ok (compiler-rt) or idiomatic (flang).
2020-03-02Fix unused-variable warningBrian Cain
2019-09-18Revert "r372201: [Support] Replace function with function_ref in ↵Ilya Biryukov
writeFileAtomically. NFC" function_ref causes calls to the function to be ambiguous, breaking compilation. Reverting for now. llvm-svn: 372202
2019-09-18[Support] Replace function with function_ref in writeFileAtomically. NFCIlya Biryukov
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
2019-09-13[Support] Add overload writeFileAtomically(std::function Writer)Jan Korous
Differential Revision: https://reviews.llvm.org/D67424 llvm-svn: 371890
2019-09-05[Support] Add writeFileAtomically() to FileUtilitiesJan Korous
Differential Revision: https://reviews.llvm.org/D66859 llvm-svn: 371103
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
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
2016-08-23Fix some Clang-tidy modernize-use-using and Include What You Use warnings; ↵Eugene Zelenko
other minor fixes. Differential revision: https://reviews.llvm.org/D23789 llvm-svn: 279535
2016-02-18Remove uses of builtin comma operator.Richard Trieu
Cleanup for upcoming Clang warning -Wcomma. No functionality change intended. llvm-svn: 261270
2014-08-01Remove some calls to std::move.Rafael Espindola
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
2014-07-06Update the MemoryBuffer API to use ErrorOr.Rafael Espindola
llvm-svn: 212405
2014-06-13Remove 'using std::errro_code' from lib.Rafael Espindola
llvm-svn: 210871
2014-06-12Don't use 'using std::error_code' in include/llvm.Rafael Espindola
This should make sure that most new uses use the std prefix. llvm-svn: 210835
2014-06-12Remove system_error.h.Rafael Espindola
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
2014-03-06Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles
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
2013-07-10MemoryBuffer::getFile handles zero sized files, no need to duplicate the test.Rafael Espindola
llvm-svn: 186018
2013-06-14Remove a use of PathV1.h.Rafael Espindola
llvm-svn: 183982
2013-06-13Don't use PathV1.h in FileUtilities.h.Rafael Espindola
llvm-svn: 183941
2013-02-12Add static cast to unsigned char whenever a character classification ↵Guy Benyei
function is called with a signed char argument, in order to avoid assertions in Windows Debug configuration. llvm-svn: 175006
2012-12-03Use the new script to sort the includes of every file under lib.Chandler Carruth
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
2012-02-09Change default error_code ctor to a 'named ctor' so it's more self-documenting.David Blaikie
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
2011-04-15Fix a ton of comment typos found by codespell. Patch byChris Lattner
Luis Felipe Strano Moraes! llvm-svn: 129558
2010-12-16MemoryBuffer now return an error_code and returns a OwningPtr<MemoryBuffer> ↵Michael J. Spencer
via an out parm. llvm-svn: 121958
2010-12-09Fix whitespace.Michael J. Spencer
llvm-svn: 121382
2010-12-09Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with ↵Michael J. Spencer
error_code &ec. And fix clients. llvm-svn: 121379
2010-11-29Merge System into Support.Michael J. Spencer
llvm-svn: 120298
2010-06-15fpcmp: Fix bug where fpcmp wouldn't early exit when files obviously differ andDaniel Dunbar
no tolerance is set. llvm-svn: 106033
2010-06-15fpcmp: Fix a possible infinite loop when comparing something like:Daniel Dunbar
1..19 ok to 1..20 o k (yes, the odd space is necessary). llvm-svn: 106032
2010-01-29Convert some users of ftostr to raw_ostream.Benjamin Kramer
llvm-svn: 94808
2008-05-05Fix more -Wshorten-64-to-32 warnings.Evan Cheng
llvm-svn: 50659
2008-04-01Change the MemoryBuffer::getFile* methods to take just a pointer to theChris Lattner
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
2008-04-01Change DiffFilesWithTolerance to be written in terms of MemoryBuffer,Chris Lattner
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
2008-04-01Remove MappedFile support for mapping files for write and execChris Lattner
and shared. This complicates the design, is not used, and probably doesn't even work. llvm-svn: 49022
2008-02-20Unbreak build with gcc 4.3: provide missed includes and silence most ↵Anton Korobeynikov
annoying warnings. llvm-svn: 47367
2008-01-28Simplify the code and fix a typo.Lauro Ramos Venancio
llvm-svn: 46458
2008-01-28Fix fpcmp infinite loop when comparing "29-266" with "29-268".Lauro Ramos Venancio
llvm-svn: 46455
2007-12-29Remove attribution from file headers, per discussion on llvmdev.Chris Lattner
llvm-svn: 45418
2007-04-07For PR1291:Reid Spencer
Change uses of sys::Path class to sys::PathWithStatus in those places where the file status information is needed. llvm-svn: 35743
2007-03-29For PR789:Reid Spencer
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
2007-03-29For PR789:Reid Spencer
Updates for change in interface of getFileStatus method of sys::Path class. llvm-svn: 35458
2006-11-25Make the absolute/relative tolerance information easier to read/understand.Reid Spencer
llvm-svn: 31908
2006-11-08Remove redundant <cmath>.Jim Laskey
llvm-svn: 31561