[llvm] 2fe45e0 - [Support][NFC] Make some helper functions "static" in Memory.inc

Bruno Ricci via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 09:46:57 PST 2020


Author: Bruno Ricci
Date: 2020-01-09T17:46:21Z
New Revision: 2fe45e029ddfa65880cfe5c3501db12a81cdcbd2

URL: https://github.com/llvm/llvm-project/commit/2fe45e029ddfa65880cfe5c3501db12a81cdcbd2
DIFF: https://github.com/llvm/llvm-project/commit/2fe45e029ddfa65880cfe5c3501db12a81cdcbd2.diff

LOG: [Support][NFC] Make some helper functions "static" in Memory.inc

Added: 
    

Modified: 
    llvm/lib/Support/Unix/Memory.inc
    llvm/lib/Support/Windows/Memory.inc

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
index 05f8e32896fa..79b1759359e1 100644
--- a/llvm/lib/Support/Unix/Memory.inc
+++ b/llvm/lib/Support/Unix/Memory.inc
@@ -42,9 +42,7 @@ extern "C" void sys_icache_invalidate(const void *Addr, size_t len);
 extern "C" void __clear_cache(void *, void*);
 #endif
 
-namespace {
-
-int getPosixProtectionFlags(unsigned Flags) {
+static int getPosixProtectionFlags(unsigned Flags) {
   switch (Flags & llvm::sys::Memory::MF_RWE_MASK) {
   case llvm::sys::Memory::MF_READ:
     return PROT_READ;
@@ -76,8 +74,6 @@ int getPosixProtectionFlags(unsigned Flags) {
   return PROT_NONE;
 }
 
-} // anonymous namespace
-
 namespace llvm {
 namespace sys {
 

diff  --git a/llvm/lib/Support/Windows/Memory.inc b/llvm/lib/Support/Windows/Memory.inc
index a67f9c7d0f35..c5566f9910a5 100644
--- a/llvm/lib/Support/Windows/Memory.inc
+++ b/llvm/lib/Support/Windows/Memory.inc
@@ -19,9 +19,7 @@
 // The Windows.h header must be the last one included.
 #include "WindowsSupport.h"
 
-namespace {
-
-DWORD getWindowsProtectionFlags(unsigned Flags) {
+static DWORD getWindowsProtectionFlags(unsigned Flags) {
   switch (Flags & llvm::sys::Memory::MF_RWE_MASK) {
   // Contrary to what you might expect, the Windows page protection flags
   // are not a bitwise combination of RWX values
@@ -50,7 +48,7 @@ DWORD getWindowsProtectionFlags(unsigned Flags) {
 // While we'd be happy to allocate single pages, the Windows allocation
 // granularity may be larger than a single page (in practice, it is 64K)
 // so mapping less than that will create an unreachable fragment of memory.
-size_t getAllocationGranularity() {
+static size_t getAllocationGranularity() {
   SYSTEM_INFO  Info;
   ::GetSystemInfo(&Info);
   if (Info.dwPageSize > Info.dwAllocationGranularity)
@@ -91,8 +89,6 @@ static size_t enableProcessLargePages() {
   return 0;
 }
 
-} // namespace
-
 namespace llvm {
 namespace sys {
 


        


More information about the llvm-commits mailing list