]> granicus.if.org Git - clang/commit
Clean up use of C allocation functions
authorSerge Pavlov <sepavloff@gmail.com>
Wed, 21 Feb 2018 02:02:39 +0000 (02:02 +0000)
committerSerge Pavlov <sepavloff@gmail.com>
Wed, 21 Feb 2018 02:02:39 +0000 (02:02 +0000)
commitf816682dc82cced0bc9ad79f0aa33125b4210aea
treee3d81aeef55ed68a4d58a27298e659d1fbd9de34
parent315b188f4501b590fc2f870e6f6d8234c1270898
Clean up use of C allocation functions

If the value returned by `malloc`, `calloc` or `realloc` is not checked
for null pointer, this change replaces them for `safe_malloc`,
`safe_calloc` or `safe_realloc`, which are defined in the namespace `llvm`.
These function report fatal error on out of memory.

In the plain C files, assertion statements are added to ensure that memory
is successfully allocated.

The aim of this change is to get better diagnostics of OOM on Windows.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325661 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Sema/ParsedTemplate.h
lib/AST/NestedNameSpecifier.cpp
lib/Frontend/CacheTokens.cpp
lib/Frontend/Rewrite/HTMLPrint.cpp
lib/Lex/MacroArgs.cpp
tools/c-index-test/c-index-test.c
tools/libclang/BuildSystem.cpp
tools/libclang/CIndex.cpp
tools/libclang/CXString.cpp