[CMake] Fix ExtensionDependencies.inc with multiple extensions

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}},
  };

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D91641
This commit is contained in:
Arthur Eubanks 2020-11-17 09:24:38 -08:00
parent 67e0f791c9
commit 49439ff6c0
1 changed files with 2 additions and 2 deletions

View File

@ -1075,7 +1075,7 @@ function(process_llvm_pass_plugins)
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 @@ function(process_llvm_pass_plugins)
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")