[PATCH] D126966: [gn build] (manually) port some more of cd2292ef8245

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 3 07:42:54 PDT 2022


thakis created this revision.
Herald added a project: All.
thakis requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

For demo purposes only at the moment. Will land something like that once tests need it.


https://reviews.llvm.org/D126966

Files:
  llvm/utils/gn/secondary/clang-tools-extra/pseudo/cxx/BUILD.gn
  llvm/utils/gn/secondary/clang-tools-extra/pseudo/include/BUILD.gn
  llvm/utils/gn/secondary/clang-tools-extra/pseudo/lib/cxx/BUILD.gn
  llvm/utils/gn/secondary/clang-tools-extra/pseudo/test/BUILD.gn


Index: llvm/utils/gn/secondary/clang-tools-extra/pseudo/test/BUILD.gn
===================================================================
--- llvm/utils/gn/secondary/clang-tools-extra/pseudo/test/BUILD.gn
+++ llvm/utils/gn/secondary/clang-tools-extra/pseudo/test/BUILD.gn
@@ -62,6 +62,7 @@
     ":lit_unit_site_cfg",
     "//clang-tools-extra/pseudo/tool:clang-pseudo",
     "//clang-tools-extra/pseudo/unittests:ClangPseudoTests",
+    "//clang-tools-extra/pseudo/lib/cxx",
     "//llvm/utils/FileCheck",
     "//llvm/utils/llvm-lit",
     "//llvm/utils/not",
Index: llvm/utils/gn/secondary/clang-tools-extra/pseudo/lib/cxx/BUILD.gn
===================================================================
--- /dev/null
+++ llvm/utils/gn/secondary/clang-tools-extra/pseudo/lib/cxx/BUILD.gn
@@ -0,0 +1,10 @@
+static_library("cxx") {
+  output_name = "clangPseudoCXX"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+    "//clang-tools-extra/pseudo/include:cxx_gen",
+    "//clang-tools-extra/pseudo/lib/grammar",
+  ]
+  include_dirs = [ "../../include" ]
+  sources = [ "CXX.cpp" ]
+}
Index: llvm/utils/gn/secondary/clang-tools-extra/pseudo/include/BUILD.gn
===================================================================
--- /dev/null
+++ llvm/utils/gn/secondary/clang-tools-extra/pseudo/include/BUILD.gn
@@ -0,0 +1,39 @@
+import("//llvm/utils/gn/build/compiled_action.gni")
+
+template("gen") {
+  compiled_action(target_name) {
+    tool = "//clang-tools-extra/pseudo/gen:pseudo-gen"
+    inputs = [ "../lib/cxx.bnf" ]
+    outputs = [ "$target_gen_dir/$target_name" ]
+    args = [
+      "--grammar",
+      rebase_path(inputs[0], root_build_dir),
+      "-o",
+      rebase_path(outputs[0], root_build_dir),
+      invoker.flag,
+    ]
+  }
+}
+
+gen("CXXSymbols.inc") {
+  flag = "--emit-symbol-list"
+}
+
+gen("CXXBNF.inc") {
+  flag = "--emit-grammar-content"
+}
+
+config("cxx_gen_config") {
+  visibility = [ ":cxx_gen" ]
+  include_dirs = [ target_gen_dir ]
+}
+
+group("cxx_gen") {
+  deps = [
+    ":CXXSymbols.inc",
+    ":CXXBNF.inc",
+  ]
+
+  # Let targets depending on this find the generated files.
+  public_configs = [ ":cxx_gen_config" ]
+}
Index: llvm/utils/gn/secondary/clang-tools-extra/pseudo/cxx/BUILD.gn
===================================================================
--- llvm/utils/gn/secondary/clang-tools-extra/pseudo/cxx/BUILD.gn
+++ /dev/null
@@ -1,7 +0,0 @@
-# FIXME: Nothing depends on this yet.
-static_library("cxx") {
-  output_name = "clangPseudoCXX"
-  configs += [ "//llvm/utils/gn/build:clang_code" ]
-  deps = [ "//clang-tools-extra/pseudo/lib/grammar" ]
-  sources = [ "CXX.cpp" ]
-}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126966.434027.patch
Type: text/x-patch
Size: 2650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220603/a9b4a340/attachment.bin>


More information about the llvm-commits mailing list