[PATCH] D43017: Clean up use of C allocation functions

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 7 05:14:07 PST 2018


sepavloff created this revision.
sepavloff added reviewers: akyrtzi, rnk.

This change cleans up uses of malloc/calloc/realloc. In the case where
the return value is not checked agains null pointer, the call to
'std::malloc' is replaced by 'llvm::malloc', which reports fatal error
on allocation failure. In 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.


Repository:
  rC Clang

https://reviews.llvm.org/D43017

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43017.133201.patch
Type: text/x-patch
Size: 9368 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180207/588ea84e/attachment.bin>


More information about the cfe-commits mailing list