1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
llvm-mirror/tools
Serge Pavlov 5202bf068f Report fatal error in the case of out of memory
This is the second part of recommit of r325224. The previous part was
committed in r325426, which deals with C++ memory allocation. Solution
for C memory allocation involved functions `llvm::malloc` and similar.
This was a fragile solution because it caused ambiguity errors in some
cases. In this commit the new functions have names like `llvm::safe_malloc`.

The relevant part of original comment is below, updated for new function
names.

Analysis of fails in the case of out of memory errors can be tricky on
Windows. Such error emerges at the point where memory allocation function
fails, but manifests itself when null pointer is used. These two points
may be distant from each other. Besides, next runs may not exhibit
allocation error.

In some cases memory is allocated by a call to some of C allocation
functions, malloc, calloc and realloc. They are used for interoperability
with C code, when allocated object has variable size and when it is
necessary to avoid call of constructors. In many calls the result is not
checked for null pointer. To simplify checks, new functions are defined
in the namespace 'llvm': `safe_malloc`, `safe_calloc` and `safe_realloc`.
They behave as corresponding standard functions but produce fatal error if
allocation fails. This change replaces the standard functions like 'malloc'
in the cases when the result of the allocation function is not checked
for null pointer.

Finally, there are plain C code, that uses malloc and similar functions. If
the result is not checked, assert statement is added.

Differential Revision: https://reviews.llvm.org/D43010

llvm-svn: 325551
2018-02-20 05:41:26 +00:00
..
bugpoint Change the BugDriver to store the current module with std::unique_ptr. 2018-02-14 21:44:34 +00:00
bugpoint-passes Remove redundant includes from tools. 2017-12-13 21:31:10 +00:00
dsymutil [CodeGen] Refactor AppleAccelTable 2018-02-19 16:12:20 +00:00
gold [ThinLTO] Allow indexing to request backend to ignore the module 2018-02-16 23:38:22 +00:00
llc Pass a module reference to CloneModule. 2018-02-14 19:50:40 +00:00
lli [ORC] Consolidate RTDyldObjectLinkingLayer GetMemMgr and GetResolver into a 2018-02-14 22:13:02 +00:00
llvm-ar Remove redundant includes from tools. 2017-12-13 21:31:10 +00:00
llvm-as Pass a reference to a module to the bitcode writer. 2018-02-14 19:11:32 +00:00
llvm-as-fuzzer cmake: Invent add_llvm_fuzzer to set up fuzzer targets 2017-08-31 00:36:33 +00:00
llvm-bcanalyzer [ThinLTO/CFI] Include TYPE_ID summaries into GLOBALVAL_SUMMARY_BLOCK 2018-02-14 22:41:15 +00:00
llvm-c-test Report fatal error in the case of out of memory 2018-02-20 05:41:26 +00:00
llvm-cat Pass a reference to a module to the bitcode writer. 2018-02-14 19:11:32 +00:00
llvm-cfi-verify Fix broken builds due to mismatched min/max types 2018-02-02 00:07:14 +00:00
llvm-config [cmake] Don't build Native llvm-config when cross compiling if passed by user. 2018-01-21 00:29:00 +00:00
llvm-cov [llvm-cov] Fix incorrect usage of .precision specifier in format() call. 2018-01-31 22:13:07 +00:00
llvm-cvtres [llvm-cvtres] Add support for ARM64 2017-11-10 22:27:41 +00:00
llvm-cxxdump Fix more inconsistent line endings. NFC. 2017-12-18 19:46:56 +00:00
llvm-cxxfilt Add opt-viewer testing 2017-11-29 17:07:41 +00:00
llvm-demangle-fuzzer llvm-demangle-fuzzer: Link in Support 2017-11-17 20:46:55 +00:00
llvm-diff Remove redundant includes from tools. 2017-12-13 21:31:10 +00:00
llvm-dis [Support] Rename tool_output_file to ToolOutputFile, NFC 2017-09-23 01:03:17 +00:00
llvm-dwarfdump [dwarfdump] Normalize input path. 2018-02-08 16:31:01 +00:00
llvm-dwp Thread MCSubtargetInfo through Target::createMCAsmBackend 2018-01-03 08:53:05 +00:00
llvm-extract [llvm-extract] Support extracting basic blocks 2018-01-23 21:51:34 +00:00
llvm-go Update some code.google.com links 2017-11-13 23:47:58 +00:00
llvm-isel-fuzzer [llvm-opt-fuzzer] Avoid adding incorrect inputs to the fuzzer corpus 2018-02-05 11:05:47 +00:00
llvm-jitlistener
llvm-link Pass a reference to a module to the bitcode writer. 2018-02-14 19:11:32 +00:00
llvm-lto Allow 0 to be a valid value pruning interval in C LTO API. Value 0 will cause garbage collector to run. This matches the behavior in C++ LTO API. 2018-02-15 23:29:21 +00:00
llvm-lto2 [ThinLTO/gold] Write empty imports even for modules with symbols 2018-01-30 21:19:26 +00:00
llvm-mc Thread MCSubtargetInfo through Target::createMCAsmBackend 2018-01-03 08:53:05 +00:00
llvm-mc-assemble-fuzzer Rename MCTargetOptionsCommandFlags.h to .def as it is not a normal/modular header as much as it is for stamping out some global/static variables 2017-11-27 19:55:16 +00:00
llvm-mc-disassemble-fuzzer cmake: Invent add_llvm_fuzzer to set up fuzzer targets 2017-08-31 00:36:33 +00:00
llvm-mcmarkup Fix more inconsistent line endings. NFC. 2017-12-18 19:46:56 +00:00
llvm-modextract Pass a reference to a module to the bitcode writer. 2018-02-14 19:11:32 +00:00
llvm-mt [Option] Add 'findNearest' method to catch typos 2018-01-05 17:10:39 +00:00
llvm-nm llvm-nm should show a symbol type of T for symbols in the (__TEXT_EXEC,__text) section. 2018-01-31 00:00:41 +00:00
llvm-objcopy [llvm-objcopy] Use the full filename in --add-gnu-debuglink 2018-02-19 19:53:44 +00:00
llvm-objdump Use delete[] instead of free 2018-02-14 06:14:30 +00:00
llvm-opt-fuzzer Pass a reference to a module to the bitcode writer. 2018-02-14 19:11:32 +00:00
llvm-opt-report Don't call exit from cl::PrintHelpMessage. 2017-09-07 23:30:48 +00:00
llvm-pdbutil Fix emission of PDB string table. 2018-02-16 20:46:04 +00:00
llvm-profdata [llvm-profdata] Don't treat non-fatal merge errors as fatal 2017-11-17 21:18:32 +00:00
llvm-rc Fix typos of occurred and occurrence 2018-01-24 10:33:39 +00:00
llvm-readobj AMDGPU: Bring elf flags in sync with the spec 2018-02-16 22:33:59 +00:00
llvm-rtdyld Remove redundant includes from tools. 2017-12-13 21:31:10 +00:00
llvm-shlib
llvm-size Fix more inconsistent line endings. NFC. 2017-12-18 19:46:56 +00:00
llvm-special-case-list-fuzzer [llvm-special-case-list-fuzzer] Add fuzz target. 2017-10-17 17:43:34 +00:00
llvm-split Pass a reference to a module to the bitcode writer. 2018-02-14 19:11:32 +00:00
llvm-stress [Support] Rename tool_output_file to ToolOutputFile, NFC 2017-09-23 01:03:17 +00:00
llvm-strings [llvm-strings] Add support for the -a/--all options 2017-11-14 19:58:36 +00:00
llvm-symbolizer [tools] Add option to install binutils symlinks 2017-11-02 21:43:32 +00:00
llvm-xray [XRay] fix 99th percentile lookups by sorting the array correctly 2018-01-30 18:18:51 +00:00
lto Rename CommandFlags.h -> CommandFlags.def 2017-11-27 19:43:58 +00:00
msbuild
obj2yaml [WebAssembly] MC: Remove unused code for handling of wasm globals 2018-01-31 19:50:14 +00:00
opt [Debugify] Don't check functions which were skipped 2018-02-15 21:28:38 +00:00
opt-viewer Fix some opt-viewer test issues and disable on Windows. 2018-01-05 22:05:13 +00:00
sancov Remove redundant includes from tools. 2017-12-13 21:31:10 +00:00
sanstats Fix broken links to the Itanium CXX ABI 2017-09-12 00:19:11 +00:00
verify-uselistorder Pass a reference to a module to the bitcode writer. 2018-02-14 19:11:32 +00:00
xcode-toolchain [llvm] Add stripped installation targets 2017-11-30 21:48:26 +00:00
yaml2obj Instead of ELFFile<ELFT>::Type, use ELFT::Type. NFC. 2018-01-12 02:28:31 +00:00
CMakeLists.txt
LLVMBuild.txt Introduce the llvm-cfi-verify tool (resubmission of D37937). 2017-09-20 20:38:14 +00:00