[yaml2obj][obj2yaml] - Do not create a symbol table by default.
[llvm-complete.git] / lib / Support / Memory.cpp
blob581484268cd87685d0e384fe49b7421a4465b0ea
1 //===- Memory.cpp - Memory Handling Support ---------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines some helpful functions for allocating memory and dealing
10 // with memory mapped files
12 //===----------------------------------------------------------------------===//
14 #include "llvm/Support/Memory.h"
15 #include "llvm/Config/llvm-config.h"
16 #include "llvm/Support/Valgrind.h"
18 #ifndef NDEBUG
19 #include "llvm/Support/raw_ostream.h"
20 #endif // ifndef NDEBUG
22 // Include the platform-specific parts of this class.
23 #ifdef LLVM_ON_UNIX
24 #include "Unix/Memory.inc"
25 #endif
26 #ifdef _WIN32
27 #include "Windows/Memory.inc"
28 #endif
30 #ifndef NDEBUG
32 namespace llvm {
33 namespace sys {
35 raw_ostream &operator<<(raw_ostream &OS, const Memory::ProtectionFlags &PF) {
36 assert((PF & ~(Memory::MF_READ | Memory::MF_WRITE | Memory::MF_EXEC)) == 0 &&
37 "Unrecognized flags");
39 return OS << (PF & Memory::MF_READ ? 'R' : '-')
40 << (PF & Memory::MF_WRITE ? 'W' : '-')
41 << (PF & Memory::MF_EXEC ? 'X' : '-');
44 raw_ostream &operator<<(raw_ostream &OS, const MemoryBlock &MB) {
45 return OS << "[ " << MB.base() << " .. "
46 << (void *)((char *)MB.base() + MB.allocatedSize()) << " ] ("
47 << MB.allocatedSize() << " bytes)";
50 } // end namespace sys
51 } // end namespace llvm
53 #endif // ifndef NDEBUG