[llvm] b40bfc1 - Reland "[gn] port f29cfab55d1f"

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 12:43:37 PST 2023


Author: Nico Weber
Date: 2023-02-14T15:42:31-05:00
New Revision: b40bfc1b9e389c154f6c60550dfc010ff8b3658f

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

LOG: Reland "[gn] port f29cfab55d1f"

This reverts commit ff66d410fd87608db16a4ffb5caae1fd62374d5a.
f29cfab55d1f relanded in 5b455a8efbf5.

Added: 
    llvm/utils/gn/secondary/llvm/unittests/Analysis/InlineAdvisorPlugin/BUILD.gn

Modified: 
    llvm/unittests/Analysis/InlineAdvisorPlugin/CMakeLists.txt
    llvm/utils/gn/secondary/llvm/unittests/Analysis/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Analysis/InlineAdvisorPlugin/CMakeLists.txt b/llvm/unittests/Analysis/InlineAdvisorPlugin/CMakeLists.txt
index ac83dddc0c6e7..aa319abcb9e8c 100644
--- a/llvm/unittests/Analysis/InlineAdvisorPlugin/CMakeLists.txt
+++ b/llvm/unittests/Analysis/InlineAdvisorPlugin/CMakeLists.txt
@@ -4,7 +4,9 @@
 # references), so just skip this testcase on Windows.
 if (NOT WIN32)
   unset(LLVM_LINK_COMPONENTS)
-  add_llvm_library(InlineAdvisorPlugin MODULE BUILDTREE_ONLY InlineAdvisorPlugin.cpp)
+  add_llvm_library(InlineAdvisorPlugin MODULE BUILDTREE_ONLY
+    InlineAdvisorPlugin.cpp
+    )
   # Put PLUGIN next to the unit test executable.
   set_output_directory(InlineAdvisorPlugin
       BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/../

diff  --git a/llvm/utils/gn/secondary/llvm/unittests/Analysis/BUILD.gn b/llvm/utils/gn/secondary/llvm/unittests/Analysis/BUILD.gn
index ee865bc9f02d5..d946c57e338fc 100644
--- a/llvm/utils/gn/secondary/llvm/unittests/Analysis/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/unittests/Analysis/BUILD.gn
@@ -1,31 +1,5 @@
 import("//third-party/unittest/unittest.gni")
 
-# Keyed off LLVM_ENABLE_PLUGINS in the CMake build, which is usually false
-# on Windows and true elsewhere.
-if (host_os != "win") {
-  foreach(plugin, [ "InlineAdvisorPlugin" ]) {
-    loadable_module(plugin) {
-      # Put plugin next to the unit test executable.
-      output_dir = target_out_dir
-
-      sources = [ "$plugin.cpp" ]
-
-      deps = [
-        # TestPlugin doesn't want to link in any LLVM code, it just needs its
-        # headers.
-        "//llvm/include/llvm/IR:public_tablegen",
-      ]
-
-      if (host_os != "mac" && host_os != "win") {
-        # The GN build currently doesn't globally pass -fPIC, but that's
-        # needed for building .so files on ELF.  Just pass it manually
-        # for loadable_modules for now.
-        cflags = [ "-fPIC" ]
-      }
-    }
-  }
-}
-
 unittest("AnalysisTests") {
   deps = [
     "//llvm/lib/Analysis",
@@ -84,7 +58,7 @@ unittest("AnalysisTests") {
   # Otherwise, reconfiguring with plugins disabled will leave behind a stale
   # executable.
   if (host_os != "win") {
-    deps += [ ":InlineAdvisorPlugin" ]
+    deps += [ "InlineAdvisorPlugin" ]
   }
 
   # Support plugins.

diff  --git a/llvm/utils/gn/secondary/llvm/unittests/Analysis/InlineAdvisorPlugin/BUILD.gn b/llvm/utils/gn/secondary/llvm/unittests/Analysis/InlineAdvisorPlugin/BUILD.gn
new file mode 100644
index 0000000000000..96d7b36d89da3
--- /dev/null
+++ b/llvm/utils/gn/secondary/llvm/unittests/Analysis/InlineAdvisorPlugin/BUILD.gn
@@ -0,0 +1,25 @@
+# Keyed off LLVM_ENABLE_PLUGINS in the CMake build, which is usually false
+# on Windows and true elsewhere.
+if (host_os != "win") {
+  loadable_module("InlineAdvisorPlugin") {
+    # Put plugin next to the unit test executable.
+    output_dir =
+        rebase_path(get_label_info("//llvm/unittests/Analysis:AnalysisTests",
+                                   "target_out_dir"))
+
+    sources = [ "InlineAdvisorPlugin.cpp" ]
+
+    deps = [
+      # TestPlugin doesn't want to link in any LLVM code, it just needs its
+      # headers.
+      "//llvm/include/llvm/IR:public_tablegen",
+    ]
+
+    if (host_os != "mac" && host_os != "win") {
+      # The GN build currently doesn't globally pass -fPIC, but that's
+      # needed for building .so files on ELF.  Just pass it manually
+      # for loadable_modules for now.
+      cflags = [ "-fPIC" ]
+    }
+  }
+}


        


More information about the llvm-commits mailing list