[PATCH] D91641: [CMake] Fix ExtensionDependencies.inc with multiple extensions

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 09:30:02 PST 2020


aeubanks created this revision.
Herald added subscribers: llvm-commits, mgorny.
Herald added a reviewer: bollu.
Herald added a project: LLVM.
aeubanks requested review of this revision.

When polly is enabled and LLVM_BYE_LINK_INTO_TOOLS=ON is on, ExtensionDependencies.inc does not compile.

$ ninja tools/llvm-config/CMakeFiles/llvm-config.dir/llvm-config.cpp.o
tools/llvm-config/ExtensionDependencies.inc:8:1: error: excess elements in struct initializer
{{"Bye", {"Bye",nullptr}}},

ExtensionDependencies.inc pre-patch:

  std::array<ExtensionDescriptor, 2> AvailableExtensions{
  {{"Polly", {"support", "core", ...,nullptr}}},
  {{"Bye", {"Bye",nullptr}}},
  };

ExtensionDependencies.inc with this patch:

  std::array<ExtensionDescriptor, 2> AvailableExtensions{
  ExtensionDescriptor{"Polly", {"support", "core", ...,nullptr}},
  ExtensionDescriptor{"Bye", {"Bye",nullptr}},
  };


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91641

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1075,7 +1075,7 @@
       foreach(llvm_extension ${LLVM_STATIC_EXTENSIONS})
         get_property(llvm_plugin_deps TARGET ${llvm_extension} PROPERTY LINK_LIBRARIES)
 
-        file(APPEND "${ExtensionDeps}.tmp" "{{\"${llvm_extension}\", {")
+	file(APPEND "${ExtensionDeps}.tmp" "ExtensionDescriptor{\"${llvm_extension}\", {")
         foreach(llvm_plugin_dep ${llvm_plugin_deps})
             # Turn library dependency back to component name, if possible.
             # That way llvm-config can avoid redundant dependencies.
@@ -1089,7 +1089,7 @@
         endforeach()
 
         # Self + mandatory trailing null, because the number of RequiredLibraries differs between extensions.
-        file(APPEND "${ExtensionDeps}.tmp" \"${llvm_extension}\", "nullptr}}},\n")
+        file(APPEND "${ExtensionDeps}.tmp" \"${llvm_extension}\", "nullptr}},\n")
       endforeach()
       file(APPEND "${ExtensionDeps}.tmp" "};\n")
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91641.305832.patch
Type: text/x-patch
Size: 1107 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201117/a4027ebe/attachment.bin>


More information about the llvm-commits mailing list