[Lldb-commits] [lldb] d21ec35 - [lldb][NFCI] Remove use of ifdef __cpluplus where unneeded

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 10 11:35:02 PDT 2023


Author: Alex Langford
Date: 2023-08-10T11:24:40-07:00
New Revision: d21ec35dcf3c351395522807beac0f45b7bcf6b9

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

LOG: [lldb][NFCI] Remove use of ifdef __cpluplus where unneeded

Just about every file in the lldb project is built with C++ enabled.
Unless I've missed something, these macro guards don't really accomplish
very much.

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

Added: 
    

Modified: 
    lldb/include/lldb/Core/Mangled.h
    lldb/include/lldb/Host/Editline.h
    lldb/include/lldb/Host/Terminal.h
    lldb/include/lldb/Host/posix/PipePosix.h
    lldb/include/lldb/Utility/DataBuffer.h
    lldb/include/lldb/Utility/DataEncoder.h
    lldb/include/lldb/lldb-forward.h
    lldb/include/lldb/lldb-private-interfaces.h
    lldb/include/lldb/lldb-private-types.h
    lldb/include/lldb/lldb-private.h
    lldb/source/Host/macosx/cfcpp/CFCReleaser.h
    lldb/source/Host/macosx/objcxx/PosixSpawnResponsible.h
    lldb/tools/debugserver/source/DNBLog.h
    lldb/tools/debugserver/source/DNBRegisterInfo.h
    lldb/tools/debugserver/source/MacOSX/CFUtils.h

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Core/Mangled.h b/lldb/include/lldb/Core/Mangled.h
index b7813313d45975..9892426161e439 100644
--- a/lldb/include/lldb/Core/Mangled.h
+++ b/lldb/include/lldb/Core/Mangled.h
@@ -8,7 +8,6 @@
 
 #ifndef LLDB_CORE_MANGLED_H
 #define LLDB_CORE_MANGLED_H
-#if defined(__cplusplus)
 
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-forward.h"
@@ -286,5 +285,4 @@ Stream &operator<<(Stream &s, const Mangled &obj);
 
 } // namespace lldb_private
 
-#endif // #if defined(__cplusplus)
 #endif // LLDB_CORE_MANGLED_H

diff  --git a/lldb/include/lldb/Host/Editline.h b/lldb/include/lldb/Host/Editline.h
index bda3f06d8946c3..4e2a26e04fa672 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -27,7 +27,6 @@
 
 #ifndef LLDB_HOST_EDITLINE_H
 #define LLDB_HOST_EDITLINE_H
-#if defined(__cplusplus)
 
 #include "lldb/Host/Config.h"
 
@@ -408,5 +407,4 @@ class Editline {
 };
 }
 
-#endif // #if defined(__cplusplus)
 #endif // LLDB_HOST_EDITLINE_H

diff  --git a/lldb/include/lldb/Host/Terminal.h b/lldb/include/lldb/Host/Terminal.h
index 8ff6d75657a74b..da0d05e8bd2651 100644
--- a/lldb/include/lldb/Host/Terminal.h
+++ b/lldb/include/lldb/Host/Terminal.h
@@ -8,7 +8,6 @@
 
 #ifndef LLDB_HOST_TERMINAL_H
 #define LLDB_HOST_TERMINAL_H
-#if defined(__cplusplus)
 
 #include "lldb/lldb-private.h"
 #include "llvm/Support/Error.h"
@@ -172,5 +171,4 @@ class TerminalState {
 
 } // namespace lldb_private
 
-#endif // #if defined(__cplusplus)
 #endif // LLDB_HOST_TERMINAL_H

diff  --git a/lldb/include/lldb/Host/posix/PipePosix.h b/lldb/include/lldb/Host/posix/PipePosix.h
index 77c0e2f7ef49e9..3bdb7431d8c770 100644
--- a/lldb/include/lldb/Host/posix/PipePosix.h
+++ b/lldb/include/lldb/Host/posix/PipePosix.h
@@ -8,7 +8,6 @@
 
 #ifndef LLDB_HOST_POSIX_PIPEPOSIX_H
 #define LLDB_HOST_POSIX_PIPEPOSIX_H
-#if defined(__cplusplus)
 
 #include "lldb/Host/PipeBase.h"
 
@@ -76,5 +75,4 @@ class PipePosix : public PipeBase {
 
 } // namespace lldb_private
 
-#endif // #if defined(__cplusplus)
 #endif // LLDB_HOST_POSIX_PIPEPOSIX_H

diff  --git a/lldb/include/lldb/Utility/DataBuffer.h b/lldb/include/lldb/Utility/DataBuffer.h
index e1c66fae7453a1..5529afec553031 100644
--- a/lldb/include/lldb/Utility/DataBuffer.h
+++ b/lldb/include/lldb/Utility/DataBuffer.h
@@ -8,7 +8,6 @@
 
 #ifndef LLDB_UTILITY_DATABUFFER_H
 #define LLDB_UTILITY_DATABUFFER_H
-#if defined(__cplusplus)
 
 #include <cstdint>
 #include <cstring>
@@ -149,5 +148,4 @@ class DataBufferUnowned : public WritableDataBuffer {
 
 } // namespace lldb_private
 
-#endif /// #if defined(__cplusplus)
 #endif // LLDB_UTILITY_DATABUFFER_H

diff  --git a/lldb/include/lldb/Utility/DataEncoder.h b/lldb/include/lldb/Utility/DataEncoder.h
index 7e1dec6992b2e0..0b78161d87ef10 100644
--- a/lldb/include/lldb/Utility/DataEncoder.h
+++ b/lldb/include/lldb/Utility/DataEncoder.h
@@ -9,8 +9,6 @@
 #ifndef LLDB_UTILITY_DATAENCODER_H
 #define LLDB_UTILITY_DATAENCODER_H
 
-#if defined(__cplusplus)
-
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-forward.h"
@@ -301,5 +299,4 @@ class DataEncoder {
 
 } // namespace lldb_private
 
-#endif // #if defined (__cplusplus)
 #endif // LLDB_UTILITY_DATAENCODER_H

diff  --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h
index 262afd2c0cd177..c159d82911a04a 100644
--- a/lldb/include/lldb/lldb-forward.h
+++ b/lldb/include/lldb/lldb-forward.h
@@ -9,8 +9,6 @@
 #ifndef LLDB_LLDB_FORWARD_H
 #define LLDB_LLDB_FORWARD_H
 
-#if defined(__cplusplus)
-
 #include <memory>
 
 // lldb forward declarations
@@ -465,5 +463,4 @@ typedef std::shared_ptr<lldb_private::Watchpoint> WatchpointSP;
 
 } // namespace lldb
 
-#endif // #if defined(__cplusplus)
 #endif // LLDB_LLDB_FORWARD_H

diff  --git a/lldb/include/lldb/lldb-private-interfaces.h b/lldb/include/lldb/lldb-private-interfaces.h
index 51bdfd360ab4ae..2313723b167829 100644
--- a/lldb/include/lldb/lldb-private-interfaces.h
+++ b/lldb/include/lldb/lldb-private-interfaces.h
@@ -9,8 +9,6 @@
 #ifndef LLDB_LLDB_PRIVATE_INTERFACES_H
 #define LLDB_LLDB_PRIVATE_INTERFACES_H
 
-#if defined(__cplusplus)
-
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private-enumerations.h"
@@ -131,6 +129,4 @@ typedef lldb::CommandObjectSP (*ThreadTraceExportCommandCreator)(
 /// \}
 } // namespace lldb_private
 
-#endif // #if defined(__cplusplus)
-
 #endif // LLDB_LLDB_PRIVATE_INTERFACES_H

diff  --git a/lldb/include/lldb/lldb-private-types.h b/lldb/include/lldb/lldb-private-types.h
index 1db266b5cf116d..e6717836331f59 100644
--- a/lldb/include/lldb/lldb-private-types.h
+++ b/lldb/include/lldb/lldb-private-types.h
@@ -9,8 +9,6 @@
 #ifndef LLDB_LLDB_PRIVATE_TYPES_H
 #define LLDB_LLDB_PRIVATE_TYPES_H
 
-#if defined(__cplusplus)
-
 #include "lldb/lldb-private.h"
 
 #include "llvm/ADT/ArrayRef.h"
@@ -125,6 +123,4 @@ typedef bool (*CommandOverrideCallbackWithResult)(
     void *baton, const char **argv, lldb_private::CommandReturnObject &result);
 } // namespace lldb_private
 
-#endif // #if defined(__cplusplus)
-
 #endif // LLDB_LLDB_PRIVATE_TYPES_H

diff  --git a/lldb/include/lldb/lldb-private.h b/lldb/include/lldb/lldb-private.h
index f56af06ec59737..97fb4699677650 100644
--- a/lldb/include/lldb/lldb-private.h
+++ b/lldb/include/lldb/lldb-private.h
@@ -9,13 +9,9 @@
 #ifndef LLDB_LLDB_PRIVATE_H
 #define LLDB_LLDB_PRIVATE_H
 
-#if defined(__cplusplus)
-
 #include "lldb/lldb-private-enumerations.h"
 #include "lldb/lldb-private-interfaces.h"
 #include "lldb/lldb-private-types.h"
 #include "lldb/lldb-public.h"
 
-#endif // defined(__cplusplus)
-
 #endif // LLDB_LLDB_PRIVATE_H

diff  --git a/lldb/source/Host/macosx/cfcpp/CFCReleaser.h b/lldb/source/Host/macosx/cfcpp/CFCReleaser.h
index cef7748a671107..630cf8f4e5b860 100644
--- a/lldb/source/Host/macosx/cfcpp/CFCReleaser.h
+++ b/lldb/source/Host/macosx/cfcpp/CFCReleaser.h
@@ -11,8 +11,6 @@
 
 #include <CoreFoundation/CoreFoundation.h>
 
-#ifdef __cplusplus
-
 #include <cassert>
 
 // Templatized CF helper class that can own any CF pointer and will
@@ -105,5 +103,4 @@ template <class T> class CFCReleaser {
   T _ptr;
 };
 
-#endif // #ifdef __cplusplus
 #endif // LLDB_SOURCE_HOST_MACOSX_CFCPP_CFCRELEASER_H

diff  --git a/lldb/source/Host/macosx/objcxx/PosixSpawnResponsible.h b/lldb/source/Host/macosx/objcxx/PosixSpawnResponsible.h
index 36fe09b5263a99..90f8ea9a3be99c 100644
--- a/lldb/source/Host/macosx/objcxx/PosixSpawnResponsible.h
+++ b/lldb/source/Host/macosx/objcxx/PosixSpawnResponsible.h
@@ -31,9 +31,7 @@ static inline int setup_posix_spawn_responsible_flag(posix_spawnattr_t *attr) {
     static dispatch_once_t pred;
     dispatch_once(&pred, ^{
       responsibility_spawnattrs_setdisclaim_ptr =
-#ifdef __cplusplus
           reinterpret_cast<__typeof__(&responsibility_spawnattrs_setdisclaim)>
-#endif
           (dlsym(RTLD_DEFAULT, "responsibility_spawnattrs_setdisclaim"));
     });
     if (responsibility_spawnattrs_setdisclaim_ptr)

diff  --git a/lldb/tools/debugserver/source/DNBLog.h b/lldb/tools/debugserver/source/DNBLog.h
index 3b17b46eebff3b..22ebc7416f933b 100644
--- a/lldb/tools/debugserver/source/DNBLog.h
+++ b/lldb/tools/debugserver/source/DNBLog.h
@@ -17,9 +17,7 @@
 #include <cstdint>
 #include <cstdio>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 // Flags that get filled in automatically before calling the log callback
 // function
@@ -144,9 +142,6 @@ void DNBLogSetVerbose(int g);
 #define DNBLogCloseLogFile() ((void)0)
 
 #endif // #else defined(DNBLOG_ENABLED)
-
-#ifdef __cplusplus
 }
-#endif
 
 #endif // LLDB_TOOLS_DEBUGSERVER_SOURCE_DNBLOG_H

diff  --git a/lldb/tools/debugserver/source/DNBRegisterInfo.h b/lldb/tools/debugserver/source/DNBRegisterInfo.h
index 05992b9f15db81..8501657cbfdd62 100644
--- a/lldb/tools/debugserver/source/DNBRegisterInfo.h
+++ b/lldb/tools/debugserver/source/DNBRegisterInfo.h
@@ -18,12 +18,10 @@
 #include <cstdio>
 
 struct DNBRegisterValueClass : public DNBRegisterValue {
-#ifdef __cplusplus
   DNBRegisterValueClass(const DNBRegisterInfo *regInfo = NULL);
   void Clear();
   void Dump(const char *pre, const char *post) const;
   bool IsValid() const;
-#endif
 };
 
 #endif

diff  --git a/lldb/tools/debugserver/source/MacOSX/CFUtils.h b/lldb/tools/debugserver/source/MacOSX/CFUtils.h
index ef295831433012..a633b3c5ba550d 100644
--- a/lldb/tools/debugserver/source/MacOSX/CFUtils.h
+++ b/lldb/tools/debugserver/source/MacOSX/CFUtils.h
@@ -15,8 +15,6 @@
 
 #include <CoreFoundation/CoreFoundation.h>
 
-#ifdef __cplusplus
-
 // Templatized CF helper class that can own any CF pointer and will
 // call CFRelease() on any valid pointer it owns unless that pointer is
 // explicitly released using the release() member function.
@@ -71,5 +69,4 @@ template <class T> class CFReleaser {
   element_type _ptr;
 };
 
-#endif // #ifdef __cplusplus
 #endif // LLDB_TOOLS_DEBUGSERVER_SOURCE_MACOSX_CFUTILS_H


        


More information about the lldb-commits mailing list