diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
commit | 486754660bb926339aefcf012a3f848592babb8b (patch) | |
tree | ecdbc446c9876f4f120f701c243373cd3cb43db3 /tools/libclang/BuildSystem.cpp | |
parent | 55e6d896ad333f07bb3b1ba487df214fc268a4ab (diff) |
Notes
Diffstat (limited to 'tools/libclang/BuildSystem.cpp')
-rw-r--r-- | tools/libclang/BuildSystem.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/libclang/BuildSystem.cpp b/tools/libclang/BuildSystem.cpp index 99aa5b6f2ff0d..79fa69c40bae1 100644 --- a/tools/libclang/BuildSystem.cpp +++ b/tools/libclang/BuildSystem.cpp @@ -17,6 +17,7 @@ #include "llvm/ADT/SmallString.h" #include "llvm/Support/CBindingWrapping.h" #include "llvm/Support/Chrono.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" @@ -78,7 +79,7 @@ clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay VFO, unsigned, unwrap(VFO)->write(OS); StringRef Data = OS.str(); - *out_buffer_ptr = (char*)malloc(Data.size()); + *out_buffer_ptr = static_cast<char*>(llvm::safe_malloc(Data.size())); *out_buffer_size = Data.size(); memcpy(*out_buffer_ptr, Data.data(), Data.size()); return CXError_Success; @@ -140,7 +141,7 @@ clang_ModuleMapDescriptor_writeToBuffer(CXModuleMapDescriptor MMD, unsigned, OS << "}\n"; StringRef Data = OS.str(); - *out_buffer_ptr = (char*)malloc(Data.size()); + *out_buffer_ptr = static_cast<char*>(llvm::safe_malloc(Data.size())); *out_buffer_size = Data.size(); memcpy(*out_buffer_ptr, Data.data(), Data.size()); return CXError_Success; |