Skip to content

[LLDB] [NFC] - Remove duplicate #include headers from the files of lldb dir & few other files #141478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 30, 2025

Conversation

akashagrwl
Copy link
Contributor

A few files of lldb dir & few other files had duplicate headers included. This patch removes those redundancies.

dir & few other files

Change-Id: I50d7df02e2dc4f493c46c4044a4e7a4ca7e03355
@llvmbot
Copy link
Member

llvmbot commented May 26, 2025

@llvm/pr-subscribers-backend-hexagon
@llvm/pr-subscribers-lldb

@llvm/pr-subscribers-clang

Author: Akash Agrawal (akashagrwl)

Changes

A few files of lldb dir & few other files had duplicate headers included. This patch removes those redundancies.


Full diff: https://github.com/llvm/llvm-project/pull/141478.diff

15 Files Affected:

  • (modified) clang/lib/InstallAPI/FileList.cpp (+1-1)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.cpp (-1)
  • (modified) lldb/source/API/SBInstruction.cpp (+1-1)
  • (modified) lldb/source/API/SBPlatform.cpp (+1-1)
  • (modified) lldb/source/Core/Telemetry.cpp (+1-1)
  • (modified) lldb/source/Interpreter/CommandObject.cpp (-1)
  • (modified) lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp (-3)
  • (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (-2)
  • (modified) lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.cpp (-1)
  • (modified) lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp (-1)
  • (modified) lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp (-1)
  • (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (-1)
  • (modified) lldb/source/Target/ScriptedThreadPlan.cpp (-1)
  • (modified) lldb/source/ValueObject/ValueObject.cpp (-1)
  • (modified) lldb/tools/debugserver/source/RNBRemote.cpp (-1)
diff --git a/clang/lib/InstallAPI/FileList.cpp b/clang/lib/InstallAPI/FileList.cpp
index 65610903840af..27e8a2c5b2556 100644
--- a/clang/lib/InstallAPI/FileList.cpp
+++ b/clang/lib/InstallAPI/FileList.cpp
@@ -7,8 +7,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/InstallAPI/FileList.h"
+
 #include "clang/Basic/DiagnosticFrontend.h"
-#include "clang/InstallAPI/FileList.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/JSON.h"
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.cpp
index ca37df348580a..7566d438d60df 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.cpp
@@ -13,7 +13,6 @@
 #include "sanitizer_flag_parser.h"
 
 #include "sanitizer_common.h"
-#include "sanitizer_flag_parser.h"
 #include "sanitizer_flags.h"
 #include "sanitizer_libc.h"
 
diff --git a/lldb/source/API/SBInstruction.cpp b/lldb/source/API/SBInstruction.cpp
index 30703eea6fa6c..5d21b92b3607e 100644
--- a/lldb/source/API/SBInstruction.cpp
+++ b/lldb/source/API/SBInstruction.cpp
@@ -7,13 +7,13 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/API/SBInstruction.h"
+
 #include "lldb/Utility/Instrumentation.h"
 
 #include "lldb/API/SBAddress.h"
 #include "lldb/API/SBFrame.h"
 #include "lldb/API/SBFile.h"
 
-#include "lldb/API/SBInstruction.h"
 #include "lldb/API/SBStream.h"
 #include "lldb/API/SBTarget.h"
 #include "lldb/Core/Disassembler.h"
diff --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp
index 394268b77aa21..95d5fa5b14d0e 100644
--- a/lldb/source/API/SBPlatform.cpp
+++ b/lldb/source/API/SBPlatform.cpp
@@ -7,13 +7,13 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/API/SBPlatform.h"
+
 #include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBEnvironment.h"
 #include "lldb/API/SBError.h"
 #include "lldb/API/SBFileSpec.h"
 #include "lldb/API/SBLaunchInfo.h"
 #include "lldb/API/SBModuleSpec.h"
-#include "lldb/API/SBPlatform.h"
 #include "lldb/API/SBProcessInfoList.h"
 #include "lldb/API/SBTarget.h"
 #include "lldb/API/SBUnixSignals.h"
diff --git a/lldb/source/Core/Telemetry.cpp b/lldb/source/Core/Telemetry.cpp
index a819d5366cedc..c87581761c45e 100644
--- a/lldb/source/Core/Telemetry.cpp
+++ b/lldb/source/Core/Telemetry.cpp
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 #include "lldb/Core/Telemetry.h"
+
 #include "lldb/Core/Debugger.h"
-#include "lldb/Core/Telemetry.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/UUID.h"
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp
index 72dd546dd6523..129646ebddb94 100644
--- a/lldb/source/Interpreter/CommandObject.cpp
+++ b/lldb/source/Interpreter/CommandObject.cpp
@@ -32,7 +32,6 @@
 #include "lldb/Target/Language.h"
 
 #include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/CommandOptionArgumentTable.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 
 using namespace lldb;
diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
index d2bf2586cd82b..07f70f45985f7 100644
--- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
@@ -13,10 +13,7 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Status.h"
-
 #include "lldb/Symbol/ObjectFile.h"
-#include "lldb/Target/Process.h"
-#include "lldb/Target/Target.h"
 
 #include "HexagonDYLDRendezvous.h"
 
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 959cbb282b043..7aa9cae5a5614 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -61,10 +61,8 @@
 
 #include "ASTUtils.h"
 #include "ClangASTSource.h"
-#include "ClangDiagnostic.h"
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionHelper.h"
-#include "ClangExpressionParser.h"
 #include "ClangHost.h"
 #include "ClangModulesDeclVendor.h"
 #include "ClangPersistentVariables.h"
diff --git a/lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.cpp b/lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.cpp
index 8d304086a163b..24e7943cba0e2 100644
--- a/lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.cpp
+++ b/lldb/source/Plugins/Process/FreeBSDKernel/ThreadFreeBSDKernel.cpp
@@ -18,7 +18,6 @@
 #include "RegisterContextFreeBSDKernel_arm64.h"
 #include "RegisterContextFreeBSDKernel_i386.h"
 #include "RegisterContextFreeBSDKernel_x86_64.h"
-#include "ThreadFreeBSDKernel.h"
 
 using namespace lldb;
 using namespace lldb_private;
diff --git a/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp b/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
index 515d58abc0d2c..e8c53714ec0c7 100644
--- a/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
+++ b/lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
@@ -26,7 +26,6 @@
 #include <sstream>
 
 // clang-format off
-#include <sys/types.h>
 #include <sys/sysctl.h>
 // clang-format on
 
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index f0c3dd5016139..27530f032ce51 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -22,7 +22,6 @@
 #include "lldb/Host/HostNativeProcessBase.h"
 #include "lldb/Host/HostProcess.h"
 #include "lldb/Host/windows/HostThreadWindows.h"
-#include "lldb/Host/windows/windows.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/DynamicLoader.h"
 #include "lldb/Target/MemoryRegionInfo.h"
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 8c19d5be76bcf..9a434d9c12523 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -82,7 +82,6 @@
 
 #include <cstdio>
 
-#include <mutex>
 #include <optional>
 
 using namespace lldb;
diff --git a/lldb/source/Target/ScriptedThreadPlan.cpp b/lldb/source/Target/ScriptedThreadPlan.cpp
index c4bdc8d080e35..7b59231f14d21 100644
--- a/lldb/source/Target/ScriptedThreadPlan.cpp
+++ b/lldb/source/Target/ScriptedThreadPlan.cpp
@@ -17,7 +17,6 @@
 #include "lldb/Target/ScriptedThreadPlan.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
-#include "lldb/Target/ThreadPlan.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/State.h"
diff --git a/lldb/source/ValueObject/ValueObject.cpp b/lldb/source/ValueObject/ValueObject.cpp
index 487c95ca03a69..29ddeba3df18e 100644
--- a/lldb/source/ValueObject/ValueObject.cpp
+++ b/lldb/source/ValueObject/ValueObject.cpp
@@ -41,7 +41,6 @@
 #include "lldb/Utility/Scalar.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/Utility/StreamString.h"
-#include "lldb/ValueObject/ValueObject.h"
 #include "lldb/ValueObject/ValueObjectCast.h"
 #include "lldb/ValueObject/ValueObjectChild.h"
 #include "lldb/ValueObject/ValueObjectConstResult.h"
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp
index e0831023e7ae4..af3c66c71c77e 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -38,7 +38,6 @@
 #include "DNBThreadResumeActions.h"
 #include "JSON.h"
 #include "JSONGenerator.h"
-#include "JSONGenerator.h"
 #include "MacOSX/Genealogy.h"
 #include "OsLogger.h"
 #include "RNBContext.h"

@akashagrwl
Copy link
Contributor Author

Adding @iajbar @androm3da @svs-quic for review.

Copy link

github-actions bot commented May 26, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Change-Id: Ibccf53c482276b5cda2fc0e6e166a61f263754a1
Copy link
Collaborator

@labath labath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR also contains clang and compiler-rt changes. You'll have better luck finding someone to approve your PR if you split it along subproject boundaries.

Also, what's up with the extra blank line after the first header you are adding everywhere? I don't think we have that as a convention.

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on what @labath said

Change-Id: Ie9db37b4b540f0b103ababaef4b922d218d5bfb5
@akashagrwl akashagrwl requested review from JDevlieghere and labath May 28, 2025 06:43
Copy link
Collaborator

@labath labath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks for the fix.

@akashagrwl
Copy link
Contributor Author

@cyndyishida can you please review and merge this PR?

@JDevlieghere JDevlieghere merged commit e4ed718 into llvm:main May 30, 2025
10 checks passed
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
…db dir & few other files (llvm#141478)

A few files of lldb dir & few other files had duplicate headers
included. This patch removes those redundancies.

---------

Co-authored-by: Akash Agrawal <akashag@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:Hexagon clang Clang issues not falling into any other category compiler-rt:sanitizer compiler-rt lldb
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants