[Lldb-commits] [lldb] db9087a - [lldb] Clean up uses of UuidCompatibility.h

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 31 10:32:18 PDT 2023


Author: Alex Langford
Date: 2023-07-31T10:30:07-07:00
New Revision: db9087a696a65042701049b9028096aeda82aa98

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

LOG: [lldb] Clean up uses of UuidCompatibility.h

This commit does a few related things:
- Removes unused function `uuid_is_null`
- Removes unneeded includes of UuidCompatibility.h
- Renames UuidCompatibility to AppleUuidCompatibility and adds a comment
  to clarify intent of header.
- Moves AppleUuidCompatibility to the include directory

Differential Revision: https://reviews.llvm.org/D156562

Added: 
    lldb/include/lldb/Utility/AppleUuidCompatibility.h

Modified: 
    lldb/source/Expression/ObjectFileJIT.cpp
    lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
    lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
    lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Removed: 
    lldb/source/Utility/UuidCompatibility.h


################################################################################
diff  --git a/lldb/source/Utility/UuidCompatibility.h b/lldb/include/lldb/Utility/AppleUuidCompatibility.h
similarity index 67%
rename from lldb/source/Utility/UuidCompatibility.h
rename to lldb/include/lldb/Utility/AppleUuidCompatibility.h
index 40ebc1de24e4d8..88913a68ece8d7 100644
--- a/lldb/source/Utility/UuidCompatibility.h
+++ b/lldb/include/lldb/Utility/AppleUuidCompatibility.h
@@ -6,20 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
-// Include this header if your system does not have a definition of uuid_t
+// Include this header for a definition of uuid_t compatible with Darwin's
+// definition.
 
 #ifndef utility_UUID_COMPATIBILITY_H
 #define utility_UUID_COMPATIBILITY_H
-
 // uuid_t is guaranteed to always be a 16-byte array
 typedef unsigned char uuid_t[16];
-
-// Return 1 if uuid is null, that is, all zeroes.
-inline __attribute__((always_inline)) int uuid_is_null(uuid_t uuid) {
-  for (int i = 0; i < 16; i++)
-    if (uuid[i])
-      return 0;
-  return 1;
-}
-
 #endif // utility_UUID_COMPATIBILITY_H

diff  --git a/lldb/source/Expression/ObjectFileJIT.cpp b/lldb/source/Expression/ObjectFileJIT.cpp
index 10fac9a9a4452b..9a839866096bdd 100644
--- a/lldb/source/Expression/ObjectFileJIT.cpp
+++ b/lldb/source/Expression/ObjectFileJIT.cpp
@@ -25,10 +25,6 @@
 #include "lldb/Utility/Timer.h"
 #include "lldb/Utility/UUID.h"
 
-#ifndef __APPLE__
-#include "Utility/UuidCompatibility.h"
-#endif
-
 using namespace lldb;
 using namespace lldb_private;
 

diff  --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
index 06b8df8df2aa21..e56a930d80c6b1 100644
--- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/Host/macosx/HostInfoMacOSX.h"
-#include "Utility/UuidCompatibility.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
@@ -32,6 +31,7 @@
 #include <sys/sysctl.h>
 #include <sys/syslimits.h>
 #include <sys/types.h>
+#include <uuid/uuid.h>
 
 // Objective-C/C++ includes
 #include <CoreFoundation/CoreFoundation.h>

diff  --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
index 0230ae23f4a0be..1e3e2e5641ad83 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -43,12 +43,6 @@
 #define DEBUG_PRINTF(fmt, ...)
 #endif
 
-#ifndef __APPLE__
-#include "Utility/UuidCompatibility.h"
-#else
-#include <uuid/uuid.h>
-#endif
-
 #include <memory>
 
 using namespace lldb;

diff  --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index 8df3e8e36c0db2..0bd465aba2d8a2 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -40,7 +40,7 @@
 #endif
 
 #ifndef __APPLE__
-#include "Utility/UuidCompatibility.h"
+#include "lldb/Utility/AppleUuidCompatibility.h"
 #else
 #include <uuid/uuid.h>
 #endif

diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index d5cab1bb1a5324..2d706835fd2400 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -63,7 +63,7 @@
 #endif
 
 #ifndef __APPLE__
-#include "Utility/UuidCompatibility.h"
+#include "lldb/Utility/AppleUuidCompatibility.h"
 #else
 #include <uuid/uuid.h>
 #endif


        


More information about the lldb-commits mailing list