Skip to content

[LLVM] [NFC] - Remove duplicate #include headers from the files of llvm dir #141057

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 2 commits into from
May 26, 2025

Conversation

akashagrwl
Copy link
Contributor

@akashagrwl akashagrwl commented May 22, 2025

A few files of llvm dir had duplicate headers included. This patch removes those redundancies.

llvm-project/llvm dir

Change-Id: Ic8ab4160f22730fb7eef6ddc89e04a6b905518ff
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot
Copy link
Member

llvmbot commented May 22, 2025

@llvm/pr-subscribers-llvm-ir

Author: Akash Agrawal (akashagrwl)

Changes

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

8 Files Affected:

  • (modified) llvm/lib/IR/ProfDataUtils.cpp (-1)
  • (modified) llvm/lib/Transforms/IPO/StripSymbols.cpp (-1)
  • (modified) llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp (-1)
  • (modified) llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp (-1)
  • (modified) llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp (-2)
  • (modified) llvm/unittests/IR/DroppedVariableStatsIRTest.cpp (-2)
  • (modified) llvm/unittests/Support/ManagedStatic.cpp (-2)
  • (modified) llvm/unittests/Support/Path.cpp (-1)
diff --git a/llvm/lib/IR/ProfDataUtils.cpp b/llvm/lib/IR/ProfDataUtils.cpp
index 9046373414a6c..684aedb2e331f 100644
--- a/llvm/lib/IR/ProfDataUtils.cpp
+++ b/llvm/lib/IR/ProfDataUtils.cpp
@@ -10,7 +10,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/IR/ProfDataUtils.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Function.h"
diff --git a/llvm/lib/Transforms/IPO/StripSymbols.cpp b/llvm/lib/Transforms/IPO/StripSymbols.cpp
index 647caaa123cf8..5f7f963e25ece 100644
--- a/llvm/lib/Transforms/IPO/StripSymbols.cpp
+++ b/llvm/lib/Transforms/IPO/StripSymbols.cpp
@@ -19,7 +19,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Transforms/IPO/StripSymbols.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DebugInfo.h"
diff --git a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
index 84934976be2c8..de83a0dc8ebe2 100644
--- a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
+++ b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
@@ -46,7 +46,6 @@
 #include "llvm/DebugInfo/GSYM/LookupResult.h"
 #include "llvm/DebugInfo/GSYM/ObjectFileTransformer.h"
 #include "llvm/DebugInfo/GSYM/OutputAggregator.h"
-#include <optional>
 
 using namespace llvm;
 using namespace gsym;
diff --git a/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp b/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
index c42028375b23d..4c8e096477481 100644
--- a/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
+++ b/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
@@ -13,7 +13,6 @@
 #include "PrettyFunctionDumper.h"
 #include "PrettyTypedefDumper.h"
 #include "PrettyVariableDumper.h"
-#include "PrettyVariableDumper.h"
 #include "llvm-pdbutil.h"
 
 #include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
diff --git a/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp b/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
index 91f3d9ccbd655..36504f50505a4 100644
--- a/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
+++ b/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
@@ -19,10 +19,8 @@
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
 #include "gtest/gtest.h"
-#include <gtest/gtest.h>
 #include <llvm/ADT/SmallString.h>
 #include <llvm/IR/LLVMContext.h>
-#include <llvm/IR/Module.h>
 #include <llvm/IR/PassInstrumentation.h>
 #include <llvm/IR/PassManager.h>
 #include <llvm/IR/PassTimingInfo.h>
diff --git a/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp b/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp
index 72d8373fc45df..20c66b93fcb1a 100644
--- a/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp
+++ b/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp
@@ -16,10 +16,8 @@
 #include "llvm/Passes/StandardInstrumentations.h"
 #include "llvm/Support/SourceMgr.h"
 #include "gtest/gtest.h"
-#include <gtest/gtest.h>
 #include <llvm/ADT/SmallString.h>
 #include <llvm/IR/LLVMContext.h>
-#include <llvm/IR/Module.h>
 #include <llvm/IR/PassInstrumentation.h>
 #include <llvm/IR/PassManager.h>
 #include <llvm/IR/PassTimingInfo.h>
diff --git a/llvm/unittests/Support/ManagedStatic.cpp b/llvm/unittests/Support/ManagedStatic.cpp
index 3463c20252da7..7c102227a3d17 100644
--- a/llvm/unittests/Support/ManagedStatic.cpp
+++ b/llvm/unittests/Support/ManagedStatic.cpp
@@ -15,8 +15,6 @@
 #include <pthread.h>
 #endif
 
-#include "gtest/gtest.h"
-
 using namespace llvm;
 
 namespace {
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index ef83fcb1950c9..355aa6b9ade06 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -11,7 +11,6 @@
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/BinaryFormat/Magic.h"
-#include "llvm/Config/llvm-config.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ConvertUTF.h"

@llvmbot
Copy link
Member

llvmbot commented May 22, 2025

@llvm/pr-subscribers-debuginfo

Author: Akash Agrawal (akashagrwl)

Changes

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

8 Files Affected:

  • (modified) llvm/lib/IR/ProfDataUtils.cpp (-1)
  • (modified) llvm/lib/Transforms/IPO/StripSymbols.cpp (-1)
  • (modified) llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp (-1)
  • (modified) llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp (-1)
  • (modified) llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp (-2)
  • (modified) llvm/unittests/IR/DroppedVariableStatsIRTest.cpp (-2)
  • (modified) llvm/unittests/Support/ManagedStatic.cpp (-2)
  • (modified) llvm/unittests/Support/Path.cpp (-1)
diff --git a/llvm/lib/IR/ProfDataUtils.cpp b/llvm/lib/IR/ProfDataUtils.cpp
index 9046373414a6c..684aedb2e331f 100644
--- a/llvm/lib/IR/ProfDataUtils.cpp
+++ b/llvm/lib/IR/ProfDataUtils.cpp
@@ -10,7 +10,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/IR/ProfDataUtils.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Function.h"
diff --git a/llvm/lib/Transforms/IPO/StripSymbols.cpp b/llvm/lib/Transforms/IPO/StripSymbols.cpp
index 647caaa123cf8..5f7f963e25ece 100644
--- a/llvm/lib/Transforms/IPO/StripSymbols.cpp
+++ b/llvm/lib/Transforms/IPO/StripSymbols.cpp
@@ -19,7 +19,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Transforms/IPO/StripSymbols.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DebugInfo.h"
diff --git a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
index 84934976be2c8..de83a0dc8ebe2 100644
--- a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
+++ b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
@@ -46,7 +46,6 @@
 #include "llvm/DebugInfo/GSYM/LookupResult.h"
 #include "llvm/DebugInfo/GSYM/ObjectFileTransformer.h"
 #include "llvm/DebugInfo/GSYM/OutputAggregator.h"
-#include <optional>
 
 using namespace llvm;
 using namespace gsym;
diff --git a/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp b/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
index c42028375b23d..4c8e096477481 100644
--- a/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
+++ b/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
@@ -13,7 +13,6 @@
 #include "PrettyFunctionDumper.h"
 #include "PrettyTypedefDumper.h"
 #include "PrettyVariableDumper.h"
-#include "PrettyVariableDumper.h"
 #include "llvm-pdbutil.h"
 
 #include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
diff --git a/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp b/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
index 91f3d9ccbd655..36504f50505a4 100644
--- a/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
+++ b/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
@@ -19,10 +19,8 @@
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
 #include "gtest/gtest.h"
-#include <gtest/gtest.h>
 #include <llvm/ADT/SmallString.h>
 #include <llvm/IR/LLVMContext.h>
-#include <llvm/IR/Module.h>
 #include <llvm/IR/PassInstrumentation.h>
 #include <llvm/IR/PassManager.h>
 #include <llvm/IR/PassTimingInfo.h>
diff --git a/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp b/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp
index 72d8373fc45df..20c66b93fcb1a 100644
--- a/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp
+++ b/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp
@@ -16,10 +16,8 @@
 #include "llvm/Passes/StandardInstrumentations.h"
 #include "llvm/Support/SourceMgr.h"
 #include "gtest/gtest.h"
-#include <gtest/gtest.h>
 #include <llvm/ADT/SmallString.h>
 #include <llvm/IR/LLVMContext.h>
-#include <llvm/IR/Module.h>
 #include <llvm/IR/PassInstrumentation.h>
 #include <llvm/IR/PassManager.h>
 #include <llvm/IR/PassTimingInfo.h>
diff --git a/llvm/unittests/Support/ManagedStatic.cpp b/llvm/unittests/Support/ManagedStatic.cpp
index 3463c20252da7..7c102227a3d17 100644
--- a/llvm/unittests/Support/ManagedStatic.cpp
+++ b/llvm/unittests/Support/ManagedStatic.cpp
@@ -15,8 +15,6 @@
 #include <pthread.h>
 #endif
 
-#include "gtest/gtest.h"
-
 using namespace llvm;
 
 namespace {
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index ef83fcb1950c9..355aa6b9ade06 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -11,7 +11,6 @@
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/BinaryFormat/Magic.h"
-#include "llvm/Config/llvm-config.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ConvertUTF.h"

@llvmbot
Copy link
Member

llvmbot commented May 22, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Akash Agrawal (akashagrwl)

Changes

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

8 Files Affected:

  • (modified) llvm/lib/IR/ProfDataUtils.cpp (-1)
  • (modified) llvm/lib/Transforms/IPO/StripSymbols.cpp (-1)
  • (modified) llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp (-1)
  • (modified) llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp (-1)
  • (modified) llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp (-2)
  • (modified) llvm/unittests/IR/DroppedVariableStatsIRTest.cpp (-2)
  • (modified) llvm/unittests/Support/ManagedStatic.cpp (-2)
  • (modified) llvm/unittests/Support/Path.cpp (-1)
diff --git a/llvm/lib/IR/ProfDataUtils.cpp b/llvm/lib/IR/ProfDataUtils.cpp
index 9046373414a6c..684aedb2e331f 100644
--- a/llvm/lib/IR/ProfDataUtils.cpp
+++ b/llvm/lib/IR/ProfDataUtils.cpp
@@ -10,7 +10,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/IR/ProfDataUtils.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Function.h"
diff --git a/llvm/lib/Transforms/IPO/StripSymbols.cpp b/llvm/lib/Transforms/IPO/StripSymbols.cpp
index 647caaa123cf8..5f7f963e25ece 100644
--- a/llvm/lib/Transforms/IPO/StripSymbols.cpp
+++ b/llvm/lib/Transforms/IPO/StripSymbols.cpp
@@ -19,7 +19,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Transforms/IPO/StripSymbols.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DebugInfo.h"
diff --git a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
index 84934976be2c8..de83a0dc8ebe2 100644
--- a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
+++ b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
@@ -46,7 +46,6 @@
 #include "llvm/DebugInfo/GSYM/LookupResult.h"
 #include "llvm/DebugInfo/GSYM/ObjectFileTransformer.h"
 #include "llvm/DebugInfo/GSYM/OutputAggregator.h"
-#include <optional>
 
 using namespace llvm;
 using namespace gsym;
diff --git a/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp b/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
index c42028375b23d..4c8e096477481 100644
--- a/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
+++ b/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
@@ -13,7 +13,6 @@
 #include "PrettyFunctionDumper.h"
 #include "PrettyTypedefDumper.h"
 #include "PrettyVariableDumper.h"
-#include "PrettyVariableDumper.h"
 #include "llvm-pdbutil.h"
 
 #include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
diff --git a/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp b/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
index 91f3d9ccbd655..36504f50505a4 100644
--- a/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
+++ b/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
@@ -19,10 +19,8 @@
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
 #include "gtest/gtest.h"
-#include <gtest/gtest.h>
 #include <llvm/ADT/SmallString.h>
 #include <llvm/IR/LLVMContext.h>
-#include <llvm/IR/Module.h>
 #include <llvm/IR/PassInstrumentation.h>
 #include <llvm/IR/PassManager.h>
 #include <llvm/IR/PassTimingInfo.h>
diff --git a/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp b/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp
index 72d8373fc45df..20c66b93fcb1a 100644
--- a/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp
+++ b/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp
@@ -16,10 +16,8 @@
 #include "llvm/Passes/StandardInstrumentations.h"
 #include "llvm/Support/SourceMgr.h"
 #include "gtest/gtest.h"
-#include <gtest/gtest.h>
 #include <llvm/ADT/SmallString.h>
 #include <llvm/IR/LLVMContext.h>
-#include <llvm/IR/Module.h>
 #include <llvm/IR/PassInstrumentation.h>
 #include <llvm/IR/PassManager.h>
 #include <llvm/IR/PassTimingInfo.h>
diff --git a/llvm/unittests/Support/ManagedStatic.cpp b/llvm/unittests/Support/ManagedStatic.cpp
index 3463c20252da7..7c102227a3d17 100644
--- a/llvm/unittests/Support/ManagedStatic.cpp
+++ b/llvm/unittests/Support/ManagedStatic.cpp
@@ -15,8 +15,6 @@
 #include <pthread.h>
 #endif
 
-#include "gtest/gtest.h"
-
 using namespace llvm;
 
 namespace {
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index ef83fcb1950c9..355aa6b9ade06 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -11,7 +11,6 @@
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/BinaryFormat/Magic.h"
-#include "llvm/Config/llvm-config.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ConvertUTF.h"

@llvmbot
Copy link
Member

llvmbot commented May 22, 2025

@llvm/pr-subscribers-llvm-support

Author: Akash Agrawal (akashagrwl)

Changes

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

8 Files Affected:

  • (modified) llvm/lib/IR/ProfDataUtils.cpp (-1)
  • (modified) llvm/lib/Transforms/IPO/StripSymbols.cpp (-1)
  • (modified) llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp (-1)
  • (modified) llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp (-1)
  • (modified) llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp (-2)
  • (modified) llvm/unittests/IR/DroppedVariableStatsIRTest.cpp (-2)
  • (modified) llvm/unittests/Support/ManagedStatic.cpp (-2)
  • (modified) llvm/unittests/Support/Path.cpp (-1)
diff --git a/llvm/lib/IR/ProfDataUtils.cpp b/llvm/lib/IR/ProfDataUtils.cpp
index 9046373414a6c..684aedb2e331f 100644
--- a/llvm/lib/IR/ProfDataUtils.cpp
+++ b/llvm/lib/IR/ProfDataUtils.cpp
@@ -10,7 +10,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/IR/ProfDataUtils.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Function.h"
diff --git a/llvm/lib/Transforms/IPO/StripSymbols.cpp b/llvm/lib/Transforms/IPO/StripSymbols.cpp
index 647caaa123cf8..5f7f963e25ece 100644
--- a/llvm/lib/Transforms/IPO/StripSymbols.cpp
+++ b/llvm/lib/Transforms/IPO/StripSymbols.cpp
@@ -19,7 +19,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Transforms/IPO/StripSymbols.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DebugInfo.h"
diff --git a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
index 84934976be2c8..de83a0dc8ebe2 100644
--- a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
+++ b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
@@ -46,7 +46,6 @@
 #include "llvm/DebugInfo/GSYM/LookupResult.h"
 #include "llvm/DebugInfo/GSYM/ObjectFileTransformer.h"
 #include "llvm/DebugInfo/GSYM/OutputAggregator.h"
-#include <optional>
 
 using namespace llvm;
 using namespace gsym;
diff --git a/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp b/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
index c42028375b23d..4c8e096477481 100644
--- a/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
+++ b/llvm/tools/llvm-pdbutil/PrettyClassLayoutGraphicalDumper.cpp
@@ -13,7 +13,6 @@
 #include "PrettyFunctionDumper.h"
 #include "PrettyTypedefDumper.h"
 #include "PrettyVariableDumper.h"
-#include "PrettyVariableDumper.h"
 #include "llvm-pdbutil.h"
 
 #include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
diff --git a/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp b/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
index 91f3d9ccbd655..36504f50505a4 100644
--- a/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
+++ b/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
@@ -19,10 +19,8 @@
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Target/TargetMachine.h"
 #include "gtest/gtest.h"
-#include <gtest/gtest.h>
 #include <llvm/ADT/SmallString.h>
 #include <llvm/IR/LLVMContext.h>
-#include <llvm/IR/Module.h>
 #include <llvm/IR/PassInstrumentation.h>
 #include <llvm/IR/PassManager.h>
 #include <llvm/IR/PassTimingInfo.h>
diff --git a/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp b/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp
index 72d8373fc45df..20c66b93fcb1a 100644
--- a/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp
+++ b/llvm/unittests/IR/DroppedVariableStatsIRTest.cpp
@@ -16,10 +16,8 @@
 #include "llvm/Passes/StandardInstrumentations.h"
 #include "llvm/Support/SourceMgr.h"
 #include "gtest/gtest.h"
-#include <gtest/gtest.h>
 #include <llvm/ADT/SmallString.h>
 #include <llvm/IR/LLVMContext.h>
-#include <llvm/IR/Module.h>
 #include <llvm/IR/PassInstrumentation.h>
 #include <llvm/IR/PassManager.h>
 #include <llvm/IR/PassTimingInfo.h>
diff --git a/llvm/unittests/Support/ManagedStatic.cpp b/llvm/unittests/Support/ManagedStatic.cpp
index 3463c20252da7..7c102227a3d17 100644
--- a/llvm/unittests/Support/ManagedStatic.cpp
+++ b/llvm/unittests/Support/ManagedStatic.cpp
@@ -15,8 +15,6 @@
 #include <pthread.h>
 #endif
 
-#include "gtest/gtest.h"
-
 using namespace llvm;
 
 namespace {
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index ef83fcb1950c9..355aa6b9ade06 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -11,7 +11,6 @@
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/BinaryFormat/Magic.h"
-#include "llvm/Config/llvm-config.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ConvertUTF.h"

@quic-santdas
Copy link
Contributor

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

@akashagrwl akashagrwl changed the title [LLVM] Cleanup - Remove duplicate #include headers from the files of llvm-project/llvm dir [LLVM] [NFC] - Remove duplicate #include headers from the files of llvm dir May 22, 2025
@androm3da androm3da self-requested a review May 22, 2025 13:40
Copy link
Contributor

@svs-quic svs-quic left a comment

Choose a reason for hiding this comment

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

LGTM!

…oved other instance

Change-Id: Ib9c54d7e7ff459d69df90e1783b5a6860d1d2907
@akashagrwl akashagrwl requested a review from dwblaikie May 23, 2025 13:56
@quic-santdas quic-santdas merged commit ba70533 into llvm:main May 26, 2025
11 checks passed
Copy link

@akashagrwl Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
…vm dir (llvm#141057)

A few files of llvm dir 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants