[llvm] 49439ff - [CMake] Fix ExtensionDependencies.inc with multiple extensions

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 17 17:26:51 PST 2020


Author: Arthur Eubanks
Date: 2020-11-17T17:24:47-08:00
New Revision: 49439ff6c09ad5afc0bc2b2ecae5bb6e6a70455a

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

LOG: [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

Added: 
    

Modified: 
    llvm/cmake/modules/AddLLVM.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 921335242a3b..e3a20a054975 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -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 
diff ers between extensions.
-        file(APPEND "${ExtensionDeps}.tmp" \"${llvm_extension}\", "nullptr}}},\n")
+        file(APPEND "${ExtensionDeps}.tmp" \"${llvm_extension}\", "nullptr}},\n")
       endforeach()
       file(APPEND "${ExtensionDeps}.tmp" "};\n")
 


        


More information about the llvm-commits mailing list