Author: Timm Bäder Date: 2023-07-09T16:13:19+02:00 New Revision: fa1e9c3a5aacb1183fa3da410cb9dfd24b1a6d15
URL: https://github.com/llvm/llvm-project/commit/fa1e9c3a5aacb1183fa3da410cb9dfd24b1a6d15 DIFF: https://github.com/llvm/llvm-project/commit/fa1e9c3a5aacb1183fa3da410cb9dfd24b1a6d15.diff LOG: [clang][Interp][NFC] Add std:: qualifiers to all malloc/free calls Added: Modified: clang/lib/AST/Interp/InterpBlock.cpp clang/lib/AST/Interp/InterpStack.cpp clang/lib/AST/Interp/InterpState.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/Interp/InterpBlock.cpp b/clang/lib/AST/Interp/InterpBlock.cpp index ed6e8910194d8d..c2a2ba70f4cd32 100644 --- a/clang/lib/AST/Interp/InterpBlock.cpp +++ b/clang/lib/AST/Interp/InterpBlock.cpp @@ -83,5 +83,5 @@ void DeadBlock::free() { Next->Prev = Prev; if (Root == this) Root = Next; - ::free(this); + std::free(this); } diff --git a/clang/lib/AST/Interp/InterpStack.cpp b/clang/lib/AST/Interp/InterpStack.cpp index 63a088be670592..592e22ed77b9f7 100644 --- a/clang/lib/AST/Interp/InterpStack.cpp +++ b/clang/lib/AST/Interp/InterpStack.cpp @@ -19,9 +19,9 @@ InterpStack::~InterpStack() { void InterpStack::clear() { if (Chunk && Chunk->Next) - free(Chunk->Next); + std::free(Chunk->Next); if (Chunk) - free(Chunk); + std::free(Chunk); Chunk = nullptr; StackSize = 0; } @@ -33,7 +33,7 @@ void *InterpStack::grow(size_t Size) { if (Chunk && Chunk->Next) { Chunk = Chunk->Next; } else { - StackChunk *Next = new (malloc(ChunkSize)) StackChunk(Chunk); + StackChunk *Next = new (std::malloc(ChunkSize)) StackChunk(Chunk); if (Chunk) Chunk->Next = Next; Chunk = Next; @@ -65,7 +65,7 @@ void InterpStack::shrink(size_t Size) { while (Size > Chunk->size()) { Size -= Chunk->size(); if (Chunk->Next) { - free(Chunk->Next); + std::free(Chunk->Next); Chunk->Next = nullptr; } Chunk->End = Chunk->start(); diff --git a/clang/lib/AST/Interp/InterpState.cpp b/clang/lib/AST/Interp/InterpState.cpp index abc29e059aa9f0..2596c56b4e095c 100644 --- a/clang/lib/AST/Interp/InterpState.cpp +++ b/clang/lib/AST/Interp/InterpState.cpp @@ -28,7 +28,7 @@ InterpState::~InterpState() { while (DeadBlocks) { DeadBlock *Next = DeadBlocks->Next; - free(DeadBlocks); + std::free(DeadBlocks); DeadBlocks = Next; } } @@ -54,7 +54,8 @@ void InterpState::deallocate(Block *B) { size_t Size = B->getSize(); // Allocate a new block, transferring over pointers. - char *Memory = reinterpret_cast<char *>(malloc(sizeof(DeadBlock) + Size)); + char *Memory = + reinterpret_cast<char *>(std::malloc(sizeof(DeadBlock) + Size)); auto *D = new (Memory) DeadBlock(DeadBlocks, B); // Move data from one block to another. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits