Skip to content

Commit 0c05269

Browse files
serge-sans-pailletstellar
serge-sans-paille
authored andcommitted
[nfc] Cleanup extension header generation
(cherry picked from commit f44a508)
1 parent 4b932da commit 0c05269

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -937,17 +937,18 @@ function(process_llvm_pass_plugins)
937937
DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
938938
COMPONENT cmake-exports)
939939

940-
file(WRITE "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def.tmp" "//extension handlers\n")
940+
set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def")
941+
file(WRITE "${ExtensionDef}.tmp" "//extension handlers\n")
941942
foreach(llvm_extension ${LLVM_STATIC_EXTENSIONS})
942-
file(APPEND "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def.tmp" "HANDLE_EXTENSION(${llvm_extension})\n")
943+
file(APPEND "${ExtensionDef}.tmp" "HANDLE_EXTENSION(${llvm_extension})\n")
943944
endforeach()
944-
file(APPEND "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def.tmp" "#undef HANDLE_EXTENSION\n")
945+
file(APPEND "${ExtensionDef}.tmp" "#undef HANDLE_EXTENSION\n")
945946

946947
# only replace if there's an actual change
947948
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
948-
"${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def.tmp"
949-
"${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def")
950-
file(REMOVE "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def.tmp")
949+
"${ExtensionDef}.tmp"
950+
"${ExtensionDef}")
951+
file(REMOVE "${ExtensionDef}.tmp")
951952
endif()
952953
endfunction()
953954

0 commit comments

Comments
 (0)