[llvm] f8c6515 - [DWP] Refactoring llvm-dwp in to a library part 2

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 22 14:23:45 PDT 2021


Author: Alexander Yermolovich
Date: 2021-07-22T14:23:29-07:00
New Revision: f8c6515554cc4a8f878179e2e081946c8c519fe3

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

LOG: [DWP] Refactoring llvm-dwp in to a library part 2

This is follow up to https://reviews.llvm.org/D106198 where llvm-dwp was refactored in to multiple files.
In this patch moving them in to lib/include directories.

Reviewed By: dblaikie

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

Added: 
    llvm/include/llvm/DWP/DWP.h
    llvm/include/llvm/DWP/DWPError.h
    llvm/include/llvm/DWP/DWPStringPool.h
    llvm/lib/DWP/CMakeLists.txt
    llvm/lib/DWP/DWP.cpp
    llvm/lib/DWP/DWPError.cpp

Modified: 
    llvm/lib/CMakeLists.txt
    llvm/tools/llvm-dwp/CMakeLists.txt
    llvm/tools/llvm-dwp/llvm-dwp.cpp

Removed: 
    llvm/tools/llvm-dwp/DWP.cpp
    llvm/tools/llvm-dwp/DWP.h
    llvm/tools/llvm-dwp/DWPError.cpp
    llvm/tools/llvm-dwp/DWPError.h
    llvm/tools/llvm-dwp/DWPStringPool.h


################################################################################
diff  --git a/llvm/tools/llvm-dwp/DWP.h b/llvm/include/llvm/DWP/DWP.h
similarity index 97%
rename from llvm/tools/llvm-dwp/DWP.h
rename to llvm/include/llvm/DWP/DWP.h
index 8a46a011516f1..666b7add60193 100644
--- a/llvm/tools/llvm-dwp/DWP.h
+++ b/llvm/include/llvm/DWP/DWP.h
@@ -1,5 +1,5 @@
-#ifndef LLVM_TOOLS_LLVM_DWP_DWP_H
-#define LLVM_TOOLS_LLVM_DWP_DWP_H
+#ifndef LLVM_DWP_DWP_H
+#define LLVM_DWP_DWP_H
 
 #include "DWPStringPool.h"
 #include "llvm/ADT/ArrayRef.h"
@@ -94,4 +94,4 @@ void writeIndex(MCStreamer &Out, MCSection *Section,
                 uint32_t IndexVersion);
 
 } // namespace llvm
-#endif // LLVM_TOOLS_LLVM_DWP_DWP_H
+#endif // LLVM_DWP_DWP_H

diff  --git a/llvm/tools/llvm-dwp/DWPError.h b/llvm/include/llvm/DWP/DWPError.h
similarity index 83%
rename from llvm/tools/llvm-dwp/DWPError.h
rename to llvm/include/llvm/DWP/DWPError.h
index b116f1cf255c0..a690ef3109bbf 100644
--- a/llvm/tools/llvm-dwp/DWPError.h
+++ b/llvm/include/llvm/DWP/DWPError.h
@@ -1,5 +1,5 @@
-#ifndef TOOLS_LLVM_DWP_DWPERROR
-#define TOOLS_LLVM_DWP_DWPERROR
+#ifndef LLVM_DWP_DWPERROR_H
+#define LLVM_DWP_DWPERROR_H
 
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -20,4 +20,4 @@ class DWPError : public ErrorInfo<DWPError> {
 };
 } // namespace llvm
 
-#endif
+#endif // LLVM_DWP_DWPERROR_H

diff  --git a/llvm/tools/llvm-dwp/DWPStringPool.h b/llvm/include/llvm/DWP/DWPStringPool.h
similarity index 93%
rename from llvm/tools/llvm-dwp/DWPStringPool.h
rename to llvm/include/llvm/DWP/DWPStringPool.h
index 216b9db2cd379..9f69851f0055f 100644
--- a/llvm/tools/llvm-dwp/DWPStringPool.h
+++ b/llvm/include/llvm/DWP/DWPStringPool.h
@@ -1,5 +1,5 @@
-#ifndef TOOLS_LLVM_DWP_DWPSTRINGPOOL
-#define TOOLS_LLVM_DWP_DWPSTRINGPOOL
+#ifndef LLVM_DWP_DWPSTRINGPOOL_H
+#define LLVM_DWP_DWPSTRINGPOOL_H
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/MC/MCSection.h"
@@ -53,4 +53,4 @@ class DWPStringPool {
 };
 } // namespace llvm
 
-#endif
+#endif // LLVM_DWP_DWPSTRINGPOOL_H

diff  --git a/llvm/lib/CMakeLists.txt b/llvm/lib/CMakeLists.txt
index e2093f1dd3272..d88bb157a03b2 100644
--- a/llvm/lib/CMakeLists.txt
+++ b/llvm/lib/CMakeLists.txt
@@ -26,6 +26,7 @@ add_subdirectory(ObjectYAML)
 add_subdirectory(Option)
 add_subdirectory(Remarks)
 add_subdirectory(DebugInfo)
+add_subdirectory(DWP)
 add_subdirectory(ExecutionEngine)
 add_subdirectory(Target)
 add_subdirectory(AsmParser)

diff  --git a/llvm/lib/DWP/CMakeLists.txt b/llvm/lib/DWP/CMakeLists.txt
new file mode 100644
index 0000000000000..693966772a8c6
--- /dev/null
+++ b/llvm/lib/DWP/CMakeLists.txt
@@ -0,0 +1,17 @@
+add_llvm_component_library(LLVMDWP
+  DWP.cpp
+  DWPError.cpp
+
+  ADDITIONAL_HEADER_DIRS
+  ${LLVM_MAIN_INCLUDE_DIR}/llvm/DWP
+
+  DEPENDS
+  intrinsics_gen
+
+  LINK_COMPONENTS
+  DebugInfoDWARF
+  MC
+  Object
+  Support
+  Target
+)

diff  --git a/llvm/tools/llvm-dwp/DWP.cpp b/llvm/lib/DWP/DWP.cpp
similarity index 99%
rename from llvm/tools/llvm-dwp/DWP.cpp
rename to llvm/lib/DWP/DWP.cpp
index f47a9d81a864a..f6538c0549d0b 100644
--- a/llvm/tools/llvm-dwp/DWP.cpp
+++ b/llvm/lib/DWP/DWP.cpp
@@ -10,8 +10,8 @@
 // package files).
 //
 //===----------------------------------------------------------------------===//
-#include "DWP.h"
-#include "DWPError.h"
+#include "llvm/DWP/DWP.h"
+#include "llvm/DWP/DWPError.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCObjectFileInfo.h"
 #include "llvm/MC/MCTargetOptionsCommandFlags.h"

diff  --git a/llvm/tools/llvm-dwp/DWPError.cpp b/llvm/lib/DWP/DWPError.cpp
similarity index 56%
rename from llvm/tools/llvm-dwp/DWPError.cpp
rename to llvm/lib/DWP/DWPError.cpp
index 21d53ed6d198c..55ef46e22d46d 100644
--- a/llvm/tools/llvm-dwp/DWPError.cpp
+++ b/llvm/lib/DWP/DWPError.cpp
@@ -1,3 +1,3 @@
-#include "DWPError.h"
+#include "llvm/DWP/DWPError.h"
 using namespace llvm;
 char DWPError::ID;

diff  --git a/llvm/tools/llvm-dwp/CMakeLists.txt b/llvm/tools/llvm-dwp/CMakeLists.txt
index 3bd1a5f082459..15210c422c914 100644
--- a/llvm/tools/llvm-dwp/CMakeLists.txt
+++ b/llvm/tools/llvm-dwp/CMakeLists.txt
@@ -1,20 +1,16 @@
 set(LLVM_LINK_COMPONENTS
-  AllTargetsAsmParsers
   AllTargetsCodeGens
   AllTargetsDescs
   AllTargetsInfos
-  AsmPrinter
   DebugInfoDWARF
+  DWP
   MC
   Object
   Support
-  Target
   )
 
 add_llvm_tool(llvm-dwp
   llvm-dwp.cpp
-  DWP.cpp
-  DWPError.cpp
 
   DEPENDS
   intrinsics_gen

diff  --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 5d70d91cc800b..1f583728c141a 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -10,9 +10,9 @@
 // package files).
 //
 //===----------------------------------------------------------------------===//
-#include "DWP.h"
-#include "DWPError.h"
-#include "DWPStringPool.h"
+#include "llvm/DWP/DWP.h"
+#include "llvm/DWP/DWPError.h"
+#include "llvm/DWP/DWPStringPool.h"
 #include "llvm/MC/MCAsmBackend.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCCodeEmitter.h"


        


More information about the llvm-commits mailing list