[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-05-13 Thread Paul Kirth via Phabricator via lldb-commits
paulkirth added a comment.

It's probably fine to reland this after D125570 
 lands, since that should unblock us.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-05-13 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added a comment.

In D124673#3512190 , @phosek wrote:

> In D124673#3512070 , @MaskRay wrote:
>
>> In D124673#3512037 , @paulkirth 
>> wrote:
>>
>>> Hi, Sorry for the late notification, but I think this change may not apply 
>>> correctly to all configs.
>>>
>>> We're seeing a breakage in Fuchsia's Clang CI builders: 
>>> https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8814329895908917697/overview
>>>
>>>   FAILED: lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o 
>>>   /b/s/w/ir/cache/goma/client/gomacc /b/s/w/ir/x/w/cipd/bin/clang++ 
>>> --sysroot=/b/s/w/ir/x/w/cipd/linux -DGTEST_HAS_RTTI=0 -D_DEBUG 
>>> -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS 
>>> -D__STDC_LIMIT_MACROS -I/b/s/w/ir/x/w/staging/llvm_build/lib/LineEditor 
>>> -I/b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/LineEditor 
>>> -I/b/s/w/ir/cache/vpython/79db7c/lib/python3.8/site-packages/tensorflow/include
>>>  -I/b/s/w/ir/x/w/staging/llvm_build/include 
>>> -I/b/s/w/ir/x/w/llvm-llvm-project/llvm/include -isystem 
>>> /b/s/w/ir/x/w/staging/zlib_install/include -stdlib=libc++ -fPIC 
>>> -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time 
>>> -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter 
>>> -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
>>> -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
>>> -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
>>> -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment 
>>> -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color 
>>> -ffunction-sections -fdata-sections 
>>> -ffile-prefix-map=/b/s/w/ir/x/w/staging/llvm_build=../staging/llvm_build 
>>> -ffile-prefix-map=/b/s/w/ir/x/w/llvm-llvm-project/= -no-canonical-prefixes 
>>> -O3 -DNDEBUG  -fno-exceptions -fno-unwind-tables 
>>> -fno-asynchronous-unwind-tables -fno-rtti -UNDEBUG -std=c++14 -MD -MT 
>>> lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o -MF 
>>> lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o.d -o 
>>> lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o -c 
>>> /b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/LineEditor/LineEditor.cpp
>>>   /b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/LineEditor/LineEditor.cpp:18:10: 
>>> fatal error: 'histedit.h' file not found
>>>   #include 
>>>^~~~
>>>
>>> since the error is a missing header for `histedit.h`, and this change 
>>> alters how libedit is found in CMake, I assume this is the root cause.
>>>
>>> I'm guessing some part of the old CMake checks like the old 
>>> `HAVE_HISTEDIT_H` may not have propagated correctly in all cases?
>>>
>>> If this will be hard to fix, would you mind reverting until a fix is ready?
>>
>> It's not clear to me that this patch caused the issue for you, so I don't 
>> think it is right to ask for a revert now. You need to provide more evidence.
>> lldb-x86_64-debian and lldb-cmake-standalone on 
>> https://lldb.llvm.org/resources/bots.html work well with the change.
>
> I looked a bit more into the error. In the CMake log I see the following:
>
>   -- Found LibEdit: /usr/include (found version ".") 
>
> This is incorrect because in our build we set 
> `CMAKE_SYSROOT=/b/s/w/ir/x/w/cipd/linux` so CMake shouldn't be looking in 
> paths like `/usr/include` because at build time, Clang will be invoked with 
> `--sysroot=/b/s/w/ir/x/w/cipd/linux` and it won't consider include paths like 
> `/usr/include`.
>
> I don't think this issue was introduced in this change, it's a pre-existing 
> issue with the `FindLibEdit.cmake` module, but it was uncovered by this 
> change.

If the patch exposes a preexisting lurking bug, reverting it temporarily is 
fine if that helps you.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-05-13 Thread Petr Hosek via Phabricator via lldb-commits
phosek added a comment.

In D124673#3512070 , @MaskRay wrote:

> In D124673#3512037 , @paulkirth 
> wrote:
>
>> Hi, Sorry for the late notification, but I think this change may not apply 
>> correctly to all configs.
>>
>> We're seeing a breakage in Fuchsia's Clang CI builders: 
>> https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8814329895908917697/overview
>>
>>   FAILED: lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o 
>>   /b/s/w/ir/cache/goma/client/gomacc /b/s/w/ir/x/w/cipd/bin/clang++ 
>> --sysroot=/b/s/w/ir/x/w/cipd/linux -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE 
>> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
>> -I/b/s/w/ir/x/w/staging/llvm_build/lib/LineEditor 
>> -I/b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/LineEditor 
>> -I/b/s/w/ir/cache/vpython/79db7c/lib/python3.8/site-packages/tensorflow/include
>>  -I/b/s/w/ir/x/w/staging/llvm_build/include 
>> -I/b/s/w/ir/x/w/llvm-llvm-project/llvm/include -isystem 
>> /b/s/w/ir/x/w/staging/zlib_install/include -stdlib=libc++ -fPIC 
>> -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time 
>> -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter 
>> -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
>> -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
>> -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
>> -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment 
>> -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color 
>> -ffunction-sections -fdata-sections 
>> -ffile-prefix-map=/b/s/w/ir/x/w/staging/llvm_build=../staging/llvm_build 
>> -ffile-prefix-map=/b/s/w/ir/x/w/llvm-llvm-project/= -no-canonical-prefixes 
>> -O3 -DNDEBUG  -fno-exceptions -fno-unwind-tables 
>> -fno-asynchronous-unwind-tables -fno-rtti -UNDEBUG -std=c++14 -MD -MT 
>> lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o -MF 
>> lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o.d -o 
>> lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o -c 
>> /b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/LineEditor/LineEditor.cpp
>>   /b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/LineEditor/LineEditor.cpp:18:10: 
>> fatal error: 'histedit.h' file not found
>>   #include 
>>^~~~
>>
>> since the error is a missing header for `histedit.h`, and this change alters 
>> how libedit is found in CMake, I assume this is the root cause.
>>
>> I'm guessing some part of the old CMake checks like the old 
>> `HAVE_HISTEDIT_H` may not have propagated correctly in all cases?
>>
>> If this will be hard to fix, would you mind reverting until a fix is ready?
>
> It's not clear to me that this patch caused the issue for you, so I don't 
> think it is right to ask for a revert now. You need to provide more evidence.
> lldb-x86_64-debian and lldb-cmake-standalone on 
> https://lldb.llvm.org/resources/bots.html work well with the change.

I looked a bit more into the error. In the CMake log I see the following:

  -- Found LibEdit: /usr/include (found version ".") 

This is incorrect because in our build we set 
`CMAKE_SYSROOT=/b/s/w/ir/x/w/cipd/linux` so CMake shouldn't be looking in paths 
like `/usr/include` because at build time, Clang will be invoked with 
`--sysroot=/b/s/w/ir/x/w/cipd/linux` and it won't consider include paths like 
`/usr/include`.

I don't this issue was introduced in this change, it's a pre-existing issue 
with the `FindLibEdit.cmake` module, but it was uncovered by this change.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-05-13 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added a comment.

In D124673#3512037 , @paulkirth wrote:

> Hi, Sorry for the late notification, but I think this change may not apply 
> correctly to all configs.
>
> We're seeing a breakage in Fuchsia's Clang CI builders: 
> https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8814329895908917697/overview
>
>   FAILED: lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o 
>   /b/s/w/ir/cache/goma/client/gomacc /b/s/w/ir/x/w/cipd/bin/clang++ 
> --sysroot=/b/s/w/ir/x/w/cipd/linux -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE 
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
> -I/b/s/w/ir/x/w/staging/llvm_build/lib/LineEditor 
> -I/b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/LineEditor 
> -I/b/s/w/ir/cache/vpython/79db7c/lib/python3.8/site-packages/tensorflow/include
>  -I/b/s/w/ir/x/w/staging/llvm_build/include 
> -I/b/s/w/ir/x/w/llvm-llvm-project/llvm/include -isystem 
> /b/s/w/ir/x/w/staging/zlib_install/include -stdlib=libc++ -fPIC 
> -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time 
> -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter 
> -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
> -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
> -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
> -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion 
> -Wmisleading-indentation -fdiagnostics-color -ffunction-sections 
> -fdata-sections 
> -ffile-prefix-map=/b/s/w/ir/x/w/staging/llvm_build=../staging/llvm_build 
> -ffile-prefix-map=/b/s/w/ir/x/w/llvm-llvm-project/= -no-canonical-prefixes 
> -O3 -DNDEBUG  -fno-exceptions -fno-unwind-tables 
> -fno-asynchronous-unwind-tables -fno-rtti -UNDEBUG -std=c++14 -MD -MT 
> lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o -MF 
> lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o.d -o 
> lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o -c 
> /b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/LineEditor/LineEditor.cpp
>   /b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/LineEditor/LineEditor.cpp:18:10: 
> fatal error: 'histedit.h' file not found
>   #include 
>^~~~
>
> since the error is a missing header for `histedit.h`, and this change alters 
> how libedit is found in CMake, I assume this is the root cause.
>
> I'm guessing some part of the old CMake checks like the old `HAVE_HISTEDIT_H` 
> may not have propagated correctly in all cases?
>
> If this will be hard to fix, would you mind reverting until a fix is ready?

It's not clear to me that this patch caused the issue for you, so I don't think 
it is right to ask for a revert now. You need to provide more evidence.
lldb-x86_64-debian and lldb-cmake-standalone on 
https://lldb.llvm.org/resources/bots.html work well with the change.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-05-13 Thread Paul Kirth via Phabricator via lldb-commits
paulkirth added a comment.

Hi, Sorry for the late notification, but I think this change may not apply 
correctly to all configs.

We're seeing a breakage in Fuchsia's Clang CI builders: 
https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8814329895908917697/overview

  FAILED: lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o 
  /b/s/w/ir/cache/goma/client/gomacc /b/s/w/ir/x/w/cipd/bin/clang++ 
--sysroot=/b/s/w/ir/x/w/cipd/linux -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-I/b/s/w/ir/x/w/staging/llvm_build/lib/LineEditor 
-I/b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/LineEditor 
-I/b/s/w/ir/cache/vpython/79db7c/lib/python3.8/site-packages/tensorflow/include 
-I/b/s/w/ir/x/w/staging/llvm_build/include 
-I/b/s/w/ir/x/w/llvm-llvm-project/llvm/include -isystem 
/b/s/w/ir/x/w/staging/zlib_install/include -stdlib=libc++ -fPIC 
-fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time 
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
-Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion 
-Wmisleading-indentation -fdiagnostics-color -ffunction-sections 
-fdata-sections 
-ffile-prefix-map=/b/s/w/ir/x/w/staging/llvm_build=../staging/llvm_build 
-ffile-prefix-map=/b/s/w/ir/x/w/llvm-llvm-project/= -no-canonical-prefixes -O3 
-DNDEBUG  -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables 
-fno-rtti -UNDEBUG -std=c++14 -MD -MT 
lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o -MF 
lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o.d -o 
lib/LineEditor/CMakeFiles/LLVMLineEditor.dir/LineEditor.cpp.o -c 
/b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/LineEditor/LineEditor.cpp
  /b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/LineEditor/LineEditor.cpp:18:10: 
fatal error: 'histedit.h' file not found
  #include 
   ^~~~

since the error is a missing header for `histedit.h`, and this change alters 
how libedit is found in CMake, I assume this is the root cause.

I'm guessing some part of the old CMake checks like the old `HAVE_HISTEDIT_H` 
may not have propagated correctly in all cases?

If this will be hard to fix, would you mind reverting until a fix is ready?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-05-12 Thread Fangrui Song via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb1aed14bfea0: [llvm][lldb] use FindLibEdit.cmake everywhere 
(authored by upsj, committed by MaskRay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

Files:
  cmake/Modules/FindLibEdit.cmake
  lldb/cmake/modules/FindLibEdit.cmake
  lldb/cmake/modules/LLDBStandalone.cmake
  lldb/source/Core/CMakeLists.txt
  lldb/source/Host/CMakeLists.txt
  lldb/source/Interpreter/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/lib/LineEditor/CMakeLists.txt
  llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn

Index: llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
===
--- llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
+++ llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
@@ -142,7 +142,7 @@
   #   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
   # endif()
   # if (LLDB_ENABLE_LIBEDIT)
-  #   list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  #   list(APPEND EXTRA_LIBS LibEdit::LibEdit)
   # endif()
   # if (LLDB_ENABLE_LZMA)
   #   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
Index: llvm/lib/LineEditor/CMakeLists.txt
===
--- llvm/lib/LineEditor/CMakeLists.txt
+++ llvm/lib/LineEditor/CMakeLists.txt
@@ -1,5 +1,5 @@
 if(HAVE_LIBEDIT)
-  set(link_libs edit)
+  set(link_libs LibEdit::LibEdit)
 endif()
 
 add_llvm_component_library(LLVMLineEditor
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -64,7 +64,6 @@
 check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
 
 check_include_file(mach/mach.h HAVE_MACH_MACH_H)
-check_include_file(histedit.h HAVE_HISTEDIT_H)
 check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H)
 if(APPLE)
   include(CheckCSourceCompiles)
@@ -184,8 +183,9 @@
   # Don't look for these libraries on Windows.
   if (NOT PURE_WINDOWS)
 # Skip libedit if using ASan as it contains memory leaks.
-if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
-  check_library_exists(edit el_init "" HAVE_LIBEDIT)
+if (LLVM_ENABLE_LIBEDIT AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
+  find_package(LibEdit)
+  set(HAVE_LIBEDIT ${LibEdit_FOUND})
 else()
   set(HAVE_LIBEDIT 0)
 endif()
Index: lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
===
--- lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
+++ lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
@@ -10,7 +10,7 @@
 
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
 endif()
 
 add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
@@ -35,9 +35,3 @@
   LINK_COMPONENTS
 Support
   )
-
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbPluginScriptInterpreterPython PUBLIC
-${LibEdit_INCLUDE_DIRS}
-  )
-endif()
Index: lldb/source/Interpreter/CMakeLists.txt
===
--- lldb/source/Interpreter/CMakeLists.txt
+++ lldb/source/Interpreter/CMakeLists.txt
@@ -68,6 +68,3 @@
   LLDBInterpreterPropertiesGen
   LLDBInterpreterPropertiesEnumGen)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbInterpreter PRIVATE ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Host/CMakeLists.txt
===
--- lldb/source/Host/CMakeLists.txt
+++ lldb/source/Host/CMakeLists.txt
@@ -141,7 +141,7 @@
   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
 endif()
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND EXTRA_LIBS LibEdit::LibEdit)
 endif()
 if (LLDB_ENABLE_LZMA)
   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
@@ -151,7 +151,7 @@
 endif()
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
   if (LLVM_BUILD_STATIC)
 list(APPEND LLDB_SYSTEM_LIBS gpm)
   endif()
@@ -171,6 +171,3 @@
 Support
   )
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbHost PUBLIC ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Core/CMakeLists.txt
===
--- lldb/source/Core/CMakeLists.txt
+++ lldb/source/Core/CMakeLists.txt
@@ -103,10 +103,6 @@
 # TODO: Remove once we have better layering
 set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 5)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbCore PRIVATE ${LibEdit_INCLUDE_DIRS})
-endif()

[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-05-05 Thread Tobias Ribizel via Phabricator via lldb-commits
upsj added a comment.

I don't have commit access to LLVM, so feel free to merge it

Tobias Ribizel 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-05-04 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-05-04 Thread Tobias Ribizel via Phabricator via lldb-commits
upsj updated this revision to Diff 426983.
upsj marked an inline comment as done.
upsj added a comment.

move standalone-specific code to LLDBStandalone.cmake


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

Files:
  cmake/Modules/FindLibEdit.cmake
  lldb/cmake/modules/FindLibEdit.cmake
  lldb/cmake/modules/LLDBStandalone.cmake
  lldb/source/Core/CMakeLists.txt
  lldb/source/Host/CMakeLists.txt
  lldb/source/Interpreter/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/lib/LineEditor/CMakeLists.txt
  llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn

Index: llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
===
--- llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
+++ llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
@@ -142,7 +142,7 @@
   #   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
   # endif()
   # if (LLDB_ENABLE_LIBEDIT)
-  #   list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  #   list(APPEND EXTRA_LIBS LibEdit::LibEdit)
   # endif()
   # if (LLDB_ENABLE_LZMA)
   #   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
Index: llvm/lib/LineEditor/CMakeLists.txt
===
--- llvm/lib/LineEditor/CMakeLists.txt
+++ llvm/lib/LineEditor/CMakeLists.txt
@@ -1,5 +1,5 @@
 if(HAVE_LIBEDIT)
-  set(link_libs edit)
+  set(link_libs LibEdit::LibEdit)
 endif()
 
 add_llvm_component_library(LLVMLineEditor
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -64,7 +64,6 @@
 check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
 
 check_include_file(mach/mach.h HAVE_MACH_MACH_H)
-check_include_file(histedit.h HAVE_HISTEDIT_H)
 check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H)
 if(APPLE)
   include(CheckCSourceCompiles)
@@ -184,8 +183,9 @@
   # Don't look for these libraries on Windows.
   if (NOT PURE_WINDOWS)
 # Skip libedit if using ASan as it contains memory leaks.
-if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
-  check_library_exists(edit el_init "" HAVE_LIBEDIT)
+if (LLVM_ENABLE_LIBEDIT AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
+  find_package(LibEdit)
+  set(HAVE_LIBEDIT ${LibEdit_FOUND})
 else()
   set(HAVE_LIBEDIT 0)
 endif()
Index: lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
===
--- lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
+++ lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
@@ -10,7 +10,7 @@
 
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
 endif()
 
 add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
@@ -35,9 +35,3 @@
   LINK_COMPONENTS
 Support
   )
-
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbPluginScriptInterpreterPython PUBLIC
-${LibEdit_INCLUDE_DIRS}
-  )
-endif()
Index: lldb/source/Interpreter/CMakeLists.txt
===
--- lldb/source/Interpreter/CMakeLists.txt
+++ lldb/source/Interpreter/CMakeLists.txt
@@ -68,6 +68,3 @@
   LLDBInterpreterPropertiesGen
   LLDBInterpreterPropertiesEnumGen)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbInterpreter PRIVATE ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Host/CMakeLists.txt
===
--- lldb/source/Host/CMakeLists.txt
+++ lldb/source/Host/CMakeLists.txt
@@ -141,7 +141,7 @@
   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
 endif()
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND EXTRA_LIBS LibEdit::LibEdit)
 endif()
 if (LLDB_ENABLE_LZMA)
   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
@@ -151,7 +151,7 @@
 endif()
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
   if (LLVM_BUILD_STATIC)
 list(APPEND LLDB_SYSTEM_LIBS gpm)
   endif()
@@ -171,6 +171,3 @@
 Support
   )
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbHost PUBLIC ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Core/CMakeLists.txt
===
--- lldb/source/Core/CMakeLists.txt
+++ lldb/source/Core/CMakeLists.txt
@@ -103,10 +103,6 @@
 # TODO: Remove once we have better layering
 set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 5)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbCore PRIVATE ${LibEdit_INCLUDE_DIRS})
-endif()
-
 if (LLDB_ENABLE_CURSES)
   target_include_directories(lldbCore PRIVATE 

[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-05-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/CMakeLists.txt:3-5
+if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
+  set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+endif()

Can this go in `lldb/cmake/modules/LLDBStandalone.cmake`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-05-03 Thread Tobias Ribizel via Phabricator via lldb-commits
upsj updated this revision to Diff 426628.
upsj added a comment.

fix standalone builds


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

Files:
  cmake/Modules/FindLibEdit.cmake
  lldb/CMakeLists.txt
  lldb/cmake/modules/FindLibEdit.cmake
  lldb/source/Core/CMakeLists.txt
  lldb/source/Host/CMakeLists.txt
  lldb/source/Interpreter/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/lib/LineEditor/CMakeLists.txt
  llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn

Index: llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
===
--- llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
+++ llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
@@ -142,7 +142,7 @@
   #   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
   # endif()
   # if (LLDB_ENABLE_LIBEDIT)
-  #   list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  #   list(APPEND EXTRA_LIBS LibEdit::LibEdit)
   # endif()
   # if (LLDB_ENABLE_LZMA)
   #   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
Index: llvm/lib/LineEditor/CMakeLists.txt
===
--- llvm/lib/LineEditor/CMakeLists.txt
+++ llvm/lib/LineEditor/CMakeLists.txt
@@ -1,5 +1,5 @@
 if(HAVE_LIBEDIT)
-  set(link_libs edit)
+  set(link_libs LibEdit::LibEdit)
 endif()
 
 add_llvm_component_library(LLVMLineEditor
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -64,7 +64,6 @@
 check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
 
 check_include_file(mach/mach.h HAVE_MACH_MACH_H)
-check_include_file(histedit.h HAVE_HISTEDIT_H)
 check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H)
 if(APPLE)
   include(CheckCSourceCompiles)
@@ -184,8 +183,9 @@
   # Don't look for these libraries on Windows.
   if (NOT PURE_WINDOWS)
 # Skip libedit if using ASan as it contains memory leaks.
-if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
-  check_library_exists(edit el_init "" HAVE_LIBEDIT)
+if (LLVM_ENABLE_LIBEDIT AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
+  find_package(LibEdit)
+  set(HAVE_LIBEDIT ${LibEdit_FOUND})
 else()
   set(HAVE_LIBEDIT 0)
 endif()
Index: lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
===
--- lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
+++ lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
@@ -10,7 +10,7 @@
 
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
 endif()
 
 add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
@@ -35,9 +35,3 @@
   LINK_COMPONENTS
 Support
   )
-
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbPluginScriptInterpreterPython PUBLIC
-${LibEdit_INCLUDE_DIRS}
-  )
-endif()
Index: lldb/source/Interpreter/CMakeLists.txt
===
--- lldb/source/Interpreter/CMakeLists.txt
+++ lldb/source/Interpreter/CMakeLists.txt
@@ -68,6 +68,3 @@
   LLDBInterpreterPropertiesGen
   LLDBInterpreterPropertiesEnumGen)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbInterpreter PRIVATE ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Host/CMakeLists.txt
===
--- lldb/source/Host/CMakeLists.txt
+++ lldb/source/Host/CMakeLists.txt
@@ -141,7 +141,7 @@
   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
 endif()
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND EXTRA_LIBS LibEdit::LibEdit)
 endif()
 if (LLDB_ENABLE_LZMA)
   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
@@ -151,7 +151,7 @@
 endif()
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
   if (LLVM_BUILD_STATIC)
 list(APPEND LLDB_SYSTEM_LIBS gpm)
   endif()
@@ -171,6 +171,3 @@
 Support
   )
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbHost PUBLIC ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Core/CMakeLists.txt
===
--- lldb/source/Core/CMakeLists.txt
+++ lldb/source/Core/CMakeLists.txt
@@ -103,10 +103,6 @@
 # TODO: Remove once we have better layering
 set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 5)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbCore PRIVATE ${LibEdit_INCLUDE_DIRS})
-endif()
-
 if (LLDB_ENABLE_CURSES)
   target_include_directories(lldbCore PRIVATE ${CURSES_INCLUDE_DIRS})
 endif()
Index: lldb/CMakeLists.txt

[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-05-02 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D124673#3484157 , @MaskRay wrote:

> I vaguely recall that some lldb bots use a stand-alone build.

Yup, that's correct. The bot in question is 
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-standalone/


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-04-30 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added a comment.

I vaguely recall that some lldb bots use a stand-alone build.

Say I have a build directory /tmp/RelA with `-DLLVM_ENABLE_PROJECTS=clang`

  cmake -GNinja -S~/llvm-project/lldb -Bout/lldb -DCMAKE_PREFIX_PATH=/tmp/RelA

will print

  CMake Warning at cmake/modules/LLDBConfig.cmake:52 (find_package):


  
By not providing "FindLibEdit.cmake" in CMAKE_MODULE_PATH this project has  


  
asked CMake to find a package configuration file provided by "LibEdit", but 


  
CMake did not find one. 


  



  
Could not find a package configuration file provided by "LibEdit" with any  


  
of the following names: 


  



  
  LibEditConfig.cmake   


  
  libedit-config.cmake  


  



  
Add the installation prefix of "LibEdit" to CMAKE_PREFIX_PATH or set  
"LibEdit_DIR" to a directory containing one of the above files.  If 
   
"LibEdit" provides a separate development package or SDK, be sure it has
been installed.  
  Call Stack (most recent call first):   
cmake/modules/LLDBConfig.cmake:59 (add_optional_dependency) 

CMakeLists.txt:28 (include)  

I wish that https://discourse.llvm.org/t/rfc-stand-alone-build-support/61291/37 
will make stand-alone builds duplicate less code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-04-30 Thread Tobias Ribizel via Phabricator via lldb-commits
upsj updated this revision to Diff 426215.
upsj added a comment.

restore some of the previous behavior


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

Files:
  cmake/Modules/FindLibEdit.cmake
  lldb/cmake/modules/FindLibEdit.cmake
  lldb/source/Core/CMakeLists.txt
  lldb/source/Host/CMakeLists.txt
  lldb/source/Interpreter/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/lib/LineEditor/CMakeLists.txt
  llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn

Index: llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
===
--- llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
+++ llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
@@ -142,7 +142,7 @@
   #   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
   # endif()
   # if (LLDB_ENABLE_LIBEDIT)
-  #   list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  #   list(APPEND EXTRA_LIBS LibEdit::LibEdit)
   # endif()
   # if (LLDB_ENABLE_LZMA)
   #   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
Index: llvm/lib/LineEditor/CMakeLists.txt
===
--- llvm/lib/LineEditor/CMakeLists.txt
+++ llvm/lib/LineEditor/CMakeLists.txt
@@ -1,5 +1,5 @@
 if(HAVE_LIBEDIT)
-  set(link_libs edit)
+  set(link_libs LibEdit::LibEdit)
 endif()
 
 add_llvm_component_library(LLVMLineEditor
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -64,7 +64,6 @@
 check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
 
 check_include_file(mach/mach.h HAVE_MACH_MACH_H)
-check_include_file(histedit.h HAVE_HISTEDIT_H)
 check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H)
 if(APPLE)
   include(CheckCSourceCompiles)
@@ -184,8 +183,9 @@
   # Don't look for these libraries on Windows.
   if (NOT PURE_WINDOWS)
 # Skip libedit if using ASan as it contains memory leaks.
-if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
-  check_library_exists(edit el_init "" HAVE_LIBEDIT)
+if (LLVM_ENABLE_LIBEDIT AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
+  find_package(LibEdit)
+  set(HAVE_LIBEDIT ${LibEdit_FOUND})
 else()
   set(HAVE_LIBEDIT 0)
 endif()
Index: lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
===
--- lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
+++ lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
@@ -10,7 +10,7 @@
 
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
 endif()
 
 add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
@@ -35,9 +35,3 @@
   LINK_COMPONENTS
 Support
   )
-
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbPluginScriptInterpreterPython PUBLIC
-${LibEdit_INCLUDE_DIRS}
-  )
-endif()
Index: lldb/source/Interpreter/CMakeLists.txt
===
--- lldb/source/Interpreter/CMakeLists.txt
+++ lldb/source/Interpreter/CMakeLists.txt
@@ -68,6 +68,3 @@
   LLDBInterpreterPropertiesGen
   LLDBInterpreterPropertiesEnumGen)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbInterpreter PRIVATE ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Host/CMakeLists.txt
===
--- lldb/source/Host/CMakeLists.txt
+++ lldb/source/Host/CMakeLists.txt
@@ -141,7 +141,7 @@
   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
 endif()
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND EXTRA_LIBS LibEdit::LibEdit)
 endif()
 if (LLDB_ENABLE_LZMA)
   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
@@ -151,7 +151,7 @@
 endif()
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
   if (LLVM_BUILD_STATIC)
 list(APPEND LLDB_SYSTEM_LIBS gpm)
   endif()
@@ -171,6 +171,3 @@
 Support
   )
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbHost PUBLIC ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Core/CMakeLists.txt
===
--- lldb/source/Core/CMakeLists.txt
+++ lldb/source/Core/CMakeLists.txt
@@ -103,10 +103,6 @@
 # TODO: Remove once we have better layering
 set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 5)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbCore PRIVATE ${LibEdit_INCLUDE_DIRS})
-endif()
-
 if (LLDB_ENABLE_CURSES)
   target_include_directories(lldbCore PRIVATE ${CURSES_INCLUDE_DIRS})
 endif()
Index: cmake/Modules/FindLibEdit.cmake

[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-04-29 Thread Tobias Ribizel via Phabricator via lldb-commits
upsj updated this revision to Diff 426080.
upsj added a comment.

improve handling of disabled libedit


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

Files:
  cmake/Modules/FindLibEdit.cmake
  lldb/cmake/modules/FindLibEdit.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/source/Core/CMakeLists.txt
  lldb/source/Host/CMakeLists.txt
  lldb/source/Interpreter/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/lib/LineEditor/CMakeLists.txt
  llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn

Index: llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
===
--- llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
+++ llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
@@ -142,7 +142,7 @@
   #   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
   # endif()
   # if (LLDB_ENABLE_LIBEDIT)
-  #   list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  #   list(APPEND EXTRA_LIBS LibEdit::LibEdit)
   # endif()
   # if (LLDB_ENABLE_LZMA)
   #   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
Index: llvm/lib/LineEditor/CMakeLists.txt
===
--- llvm/lib/LineEditor/CMakeLists.txt
+++ llvm/lib/LineEditor/CMakeLists.txt
@@ -1,5 +1,5 @@
 if(HAVE_LIBEDIT)
-  set(link_libs edit)
+  set(link_libs LibEdit::LibEdit)
 endif()
 
 add_llvm_component_library(LLVMLineEditor
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -64,7 +64,6 @@
 check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
 
 check_include_file(mach/mach.h HAVE_MACH_MACH_H)
-check_include_file(histedit.h HAVE_HISTEDIT_H)
 check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H)
 if(APPLE)
   include(CheckCSourceCompiles)
@@ -184,8 +183,9 @@
   # Don't look for these libraries on Windows.
   if (NOT PURE_WINDOWS)
 # Skip libedit if using ASan as it contains memory leaks.
-if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
-  check_library_exists(edit el_init "" HAVE_LIBEDIT)
+if (LLVM_ENABLE_LIBEDIT AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
+  find_package(LibEdit REQUIRED)
+  set(HAVE_LIBEDIT 1)
 else()
   set(HAVE_LIBEDIT 0)
 endif()
Index: lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
===
--- lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
+++ lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
@@ -10,7 +10,7 @@
 
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
 endif()
 
 add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
@@ -35,9 +35,3 @@
   LINK_COMPONENTS
 Support
   )
-
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbPluginScriptInterpreterPython PUBLIC
-${LibEdit_INCLUDE_DIRS}
-  )
-endif()
Index: lldb/source/Interpreter/CMakeLists.txt
===
--- lldb/source/Interpreter/CMakeLists.txt
+++ lldb/source/Interpreter/CMakeLists.txt
@@ -68,6 +68,3 @@
   LLDBInterpreterPropertiesGen
   LLDBInterpreterPropertiesEnumGen)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbInterpreter PRIVATE ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Host/CMakeLists.txt
===
--- lldb/source/Host/CMakeLists.txt
+++ lldb/source/Host/CMakeLists.txt
@@ -141,7 +141,7 @@
   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
 endif()
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND EXTRA_LIBS LibEdit::LibEdit)
 endif()
 if (LLDB_ENABLE_LZMA)
   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
@@ -151,7 +151,7 @@
 endif()
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
   if (LLVM_BUILD_STATIC)
 list(APPEND LLDB_SYSTEM_LIBS gpm)
   endif()
@@ -171,6 +171,3 @@
 Support
   )
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbHost PUBLIC ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Core/CMakeLists.txt
===
--- lldb/source/Core/CMakeLists.txt
+++ lldb/source/Core/CMakeLists.txt
@@ -103,10 +103,6 @@
 # TODO: Remove once we have better layering
 set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 5)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbCore PRIVATE ${LibEdit_INCLUDE_DIRS})
-endif()
-
 if (LLDB_ENABLE_CURSES)
   target_include_directories(lldbCore PRIVATE ${CURSES_INCLUDE_DIRS})
 endif()
Index: lldb/cmake/modules/LLDBConfig.cmake

[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-04-29 Thread Tobias Ribizel via Phabricator via lldb-commits
upsj updated this revision to Diff 426072.
upsj added a comment.

revert remaining unnecessary change from initial diff


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

Files:
  cmake/Modules/FindLibEdit.cmake
  lldb/cmake/modules/FindLibEdit.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/source/Core/CMakeLists.txt
  lldb/source/Host/CMakeLists.txt
  lldb/source/Interpreter/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/lib/LineEditor/CMakeLists.txt
  llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn

Index: llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
===
--- llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
+++ llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
@@ -142,7 +142,7 @@
   #   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
   # endif()
   # if (LLDB_ENABLE_LIBEDIT)
-  #   list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  #   list(APPEND EXTRA_LIBS LibEdit::LibEdit)
   # endif()
   # if (LLDB_ENABLE_LZMA)
   #   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
Index: llvm/lib/LineEditor/CMakeLists.txt
===
--- llvm/lib/LineEditor/CMakeLists.txt
+++ llvm/lib/LineEditor/CMakeLists.txt
@@ -1,5 +1,5 @@
 if(HAVE_LIBEDIT)
-  set(link_libs edit)
+  set(link_libs LibEdit::LibEdit)
 endif()
 
 add_llvm_component_library(LLVMLineEditor
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -64,7 +64,6 @@
 check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
 
 check_include_file(mach/mach.h HAVE_MACH_MACH_H)
-check_include_file(histedit.h HAVE_HISTEDIT_H)
 check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H)
 if(APPLE)
   include(CheckCSourceCompiles)
@@ -184,10 +183,13 @@
   # Don't look for these libraries on Windows.
   if (NOT PURE_WINDOWS)
 # Skip libedit if using ASan as it contains memory leaks.
-if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
-  check_library_exists(edit el_init "" HAVE_LIBEDIT)
-else()
-  set(HAVE_LIBEDIT 0)
+if (LLVM_ENABLE_LIBEDIT)
+  if (LLVM_USE_SANITIZER MATCHES ".*Address.*")
+set(HAVE_LIBEDIT 0)
+  else()
+find_package(LibEdit REQUIRED)
+set(HAVE_LIBEDIT 1)
+  endif()
 endif()
 if(LLVM_ENABLE_TERMINFO)
   if(LLVM_ENABLE_TERMINFO STREQUAL FORCE_ON)
Index: lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
===
--- lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
+++ lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
@@ -10,7 +10,7 @@
 
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
 endif()
 
 add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
@@ -35,9 +35,3 @@
   LINK_COMPONENTS
 Support
   )
-
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbPluginScriptInterpreterPython PUBLIC
-${LibEdit_INCLUDE_DIRS}
-  )
-endif()
Index: lldb/source/Interpreter/CMakeLists.txt
===
--- lldb/source/Interpreter/CMakeLists.txt
+++ lldb/source/Interpreter/CMakeLists.txt
@@ -68,6 +68,3 @@
   LLDBInterpreterPropertiesGen
   LLDBInterpreterPropertiesEnumGen)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbInterpreter PRIVATE ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Host/CMakeLists.txt
===
--- lldb/source/Host/CMakeLists.txt
+++ lldb/source/Host/CMakeLists.txt
@@ -141,7 +141,7 @@
   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
 endif()
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND EXTRA_LIBS LibEdit::LibEdit)
 endif()
 if (LLDB_ENABLE_LZMA)
   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
@@ -151,7 +151,7 @@
 endif()
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
   if (LLVM_BUILD_STATIC)
 list(APPEND LLDB_SYSTEM_LIBS gpm)
   endif()
@@ -171,6 +171,3 @@
 Support
   )
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbHost PUBLIC ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Core/CMakeLists.txt
===
--- lldb/source/Core/CMakeLists.txt
+++ lldb/source/Core/CMakeLists.txt
@@ -103,10 +103,6 @@
 # TODO: Remove once we have better layering
 set_target_properties(lldbCore PROPERTIES LINK_INTERFACE_MULTIPLICITY 5)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbCore PRIVATE ${LibEdit_INCLUDE_DIRS})

[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-04-29 Thread Tobias Ribizel via Phabricator via lldb-commits
upsj updated this revision to Diff 426071.
upsj added a comment.

fix broken build without libedit, improve find module


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

Files:
  cmake/Modules/FindLibEdit.cmake
  lldb/cmake/modules/FindLibEdit.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/source/Core/CMakeLists.txt
  lldb/source/Host/CMakeLists.txt
  lldb/source/Interpreter/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/lib/LineEditor/CMakeLists.txt
  llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
  utils/bazel/llvm_configs/config.h.cmake

Index: utils/bazel/llvm_configs/config.h.cmake
===
--- utils/bazel/llvm_configs/config.h.cmake
+++ utils/bazel/llvm_configs/config.h.cmake
@@ -105,7 +105,7 @@
 #cmakedefine HAVE_ISATTY 1
 
 /* Define to 1 if you have the `edit' library (-ledit). */
-#cmakedefine HAVE_LIBEDIT ${HAVE_LIBEDIT}
+#cmakedefine HAVE_LIBEDIT ${LibEdit_FOUND}
 
 /* Define to 1 if you have the `pfm' library (-lpfm). */
 #cmakedefine HAVE_LIBPFM ${HAVE_LIBPFM}
Index: llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
===
--- llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
+++ llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
@@ -142,7 +142,7 @@
   #   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
   # endif()
   # if (LLDB_ENABLE_LIBEDIT)
-  #   list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  #   list(APPEND EXTRA_LIBS LibEdit::LibEdit)
   # endif()
   # if (LLDB_ENABLE_LZMA)
   #   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
Index: llvm/lib/LineEditor/CMakeLists.txt
===
--- llvm/lib/LineEditor/CMakeLists.txt
+++ llvm/lib/LineEditor/CMakeLists.txt
@@ -1,5 +1,5 @@
 if(HAVE_LIBEDIT)
-  set(link_libs edit)
+  set(link_libs LibEdit::LibEdit)
 endif()
 
 add_llvm_component_library(LLVMLineEditor
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -64,7 +64,6 @@
 check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
 
 check_include_file(mach/mach.h HAVE_MACH_MACH_H)
-check_include_file(histedit.h HAVE_HISTEDIT_H)
 check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H)
 if(APPLE)
   include(CheckCSourceCompiles)
@@ -184,10 +183,13 @@
   # Don't look for these libraries on Windows.
   if (NOT PURE_WINDOWS)
 # Skip libedit if using ASan as it contains memory leaks.
-if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
-  check_library_exists(edit el_init "" HAVE_LIBEDIT)
-else()
-  set(HAVE_LIBEDIT 0)
+if (LLVM_ENABLE_LIBEDIT)
+  if (LLVM_USE_SANITIZER MATCHES ".*Address.*")
+set(HAVE_LIBEDIT 0)
+  else()
+find_package(LibEdit REQUIRED)
+set(HAVE_LIBEDIT 1)
+  endif()
 endif()
 if(LLVM_ENABLE_TERMINFO)
   if(LLVM_ENABLE_TERMINFO STREQUAL FORCE_ON)
Index: lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
===
--- lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
+++ lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
@@ -10,7 +10,7 @@
 
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
 endif()
 
 add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
@@ -35,9 +35,3 @@
   LINK_COMPONENTS
 Support
   )
-
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbPluginScriptInterpreterPython PUBLIC
-${LibEdit_INCLUDE_DIRS}
-  )
-endif()
Index: lldb/source/Interpreter/CMakeLists.txt
===
--- lldb/source/Interpreter/CMakeLists.txt
+++ lldb/source/Interpreter/CMakeLists.txt
@@ -68,6 +68,3 @@
   LLDBInterpreterPropertiesGen
   LLDBInterpreterPropertiesEnumGen)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbInterpreter PRIVATE ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Host/CMakeLists.txt
===
--- lldb/source/Host/CMakeLists.txt
+++ lldb/source/Host/CMakeLists.txt
@@ -141,7 +141,7 @@
   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
 endif()
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND EXTRA_LIBS LibEdit::LibEdit)
 endif()
 if (LLDB_ENABLE_LZMA)
   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
@@ -151,7 +151,7 @@
 endif()
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
   if (LLVM_BUILD_STATIC)
 list(APPEND LLDB_SYSTEM_LIBS gpm)
   endif()
@@ -171,6 +171,3 @@

[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-04-29 Thread Tobias Ribizel via Phabricator via lldb-commits
upsj updated this revision to Diff 426068.
upsj added a comment.
Herald added a subscriber: JDevlieghere.

The previous setup didn't work for clang-query, so I added a CMake IMPORTED 
target for LibEdit and used it everywhere


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124673/new/

https://reviews.llvm.org/D124673

Files:
  cmake/Modules/FindLibEdit.cmake
  lldb/cmake/modules/FindLibEdit.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/source/Core/CMakeLists.txt
  lldb/source/Host/CMakeLists.txt
  lldb/source/Interpreter/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/lib/LineEditor/CMakeLists.txt
  llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
  utils/bazel/llvm_configs/config.h.cmake

Index: utils/bazel/llvm_configs/config.h.cmake
===
--- utils/bazel/llvm_configs/config.h.cmake
+++ utils/bazel/llvm_configs/config.h.cmake
@@ -105,7 +105,7 @@
 #cmakedefine HAVE_ISATTY 1
 
 /* Define to 1 if you have the `edit' library (-ledit). */
-#cmakedefine HAVE_LIBEDIT ${HAVE_LIBEDIT}
+#cmakedefine HAVE_LIBEDIT ${LibEdit_FOUND}
 
 /* Define to 1 if you have the `pfm' library (-lpfm). */
 #cmakedefine HAVE_LIBPFM ${HAVE_LIBPFM}
Index: llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
===
--- llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
+++ llvm/utils/gn/secondary/lldb/source/Host/BUILD.gn
@@ -142,7 +142,7 @@
   #   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
   # endif()
   # if (LLDB_ENABLE_LIBEDIT)
-  #   list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  #   list(APPEND EXTRA_LIBS LibEdit::LibEdit)
   # endif()
   # if (LLDB_ENABLE_LZMA)
   #   list(APPEND EXTRA_LIBS ${LIBLZMA_LIBRARIES})
Index: llvm/lib/LineEditor/CMakeLists.txt
===
--- llvm/lib/LineEditor/CMakeLists.txt
+++ llvm/lib/LineEditor/CMakeLists.txt
@@ -1,6 +1,4 @@
-if(HAVE_LIBEDIT)
-  set(link_libs edit)
-endif()
+# LibEdit is found in llvm/cmake/config-ix.cmake
 
 add_llvm_component_library(LLVMLineEditor
   LineEditor.cpp
@@ -9,7 +7,7 @@
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/LineEditor
 
   LINK_LIBS
-  ${link_libs}
+  LibEdit::LibEdit
 
   LINK_COMPONENTS
   Support
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -64,7 +64,6 @@
 check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
 
 check_include_file(mach/mach.h HAVE_MACH_MACH_H)
-check_include_file(histedit.h HAVE_HISTEDIT_H)
 check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H)
 if(APPLE)
   include(CheckCSourceCompiles)
@@ -184,10 +183,13 @@
   # Don't look for these libraries on Windows.
   if (NOT PURE_WINDOWS)
 # Skip libedit if using ASan as it contains memory leaks.
-if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
-  check_library_exists(edit el_init "" HAVE_LIBEDIT)
-else()
-  set(HAVE_LIBEDIT 0)
+if (LLVM_ENABLE_LIBEDIT)
+  if (LLVM_USE_SANITIZER MATCHES ".*Address.*")
+set(HAVE_LIBEDIT 0)
+  else()
+find_package(LibEdit REQUIRED)
+set(HAVE_LIBEDIT 1)
+  endif()
 endif()
 if(LLVM_ENABLE_TERMINFO)
   if(LLVM_ENABLE_TERMINFO STREQUAL FORCE_ON)
Index: lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
===
--- lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
+++ lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
@@ -10,7 +10,7 @@
 
 
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND LLDB_LIBEDIT_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND LLDB_LIBEDIT_LIBS LibEdit::LibEdit)
 endif()
 
 add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
@@ -35,9 +35,3 @@
   LINK_COMPONENTS
 Support
   )
-
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbPluginScriptInterpreterPython PUBLIC
-${LibEdit_INCLUDE_DIRS}
-  )
-endif()
Index: lldb/source/Interpreter/CMakeLists.txt
===
--- lldb/source/Interpreter/CMakeLists.txt
+++ lldb/source/Interpreter/CMakeLists.txt
@@ -68,6 +68,3 @@
   LLDBInterpreterPropertiesGen
   LLDBInterpreterPropertiesEnumGen)
 
-if (LLDB_ENABLE_LIBEDIT)
-  target_include_directories(lldbInterpreter PRIVATE ${LibEdit_INCLUDE_DIRS})
-endif()
Index: lldb/source/Host/CMakeLists.txt
===
--- lldb/source/Host/CMakeLists.txt
+++ lldb/source/Host/CMakeLists.txt
@@ -141,7 +141,7 @@
   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
 endif()
 if (LLDB_ENABLE_LIBEDIT)
-  list(APPEND EXTRA_LIBS ${LibEdit_LIBRARIES})
+  list(APPEND EXTRA_LIBS LibEdit::LibEdit)
 endif()
 if (LLDB_ENABLE_LZMA)
   list(APPEND EXTRA_LIBS 

[Lldb-commits] [PATCH] D124673: [llvm][lldb] use FindLibEdit.cmake everywhere

2022-04-29 Thread Tobias Ribizel via Phabricator via lldb-commits
upsj created this revision.
upsj added reviewers: mgorny, MaskRay.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
upsj requested review of this revision.
Herald added projects: LLDB, LLVM.
Herald added subscribers: llvm-commits, lldb-commits.

Currently, LLVM's LineEditor and LLDB both use libedit, but find them in 
different (inconsistent) ways.
This causes issues e.g. when you are using a locally installed version of 
libedit, which will not be used
by clang-query, but by lldb if picked up by FindLibEdit.cmake


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124673

Files:
  cmake/Modules/FindLibEdit.cmake
  lldb/cmake/modules/FindLibEdit.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  llvm/cmake/config-ix.cmake
  llvm/include/llvm/Config/config.h.cmake
  llvm/lib/LineEditor/CMakeLists.txt
  utils/bazel/llvm_configs/config.h.cmake

Index: utils/bazel/llvm_configs/config.h.cmake
===
--- utils/bazel/llvm_configs/config.h.cmake
+++ utils/bazel/llvm_configs/config.h.cmake
@@ -105,7 +105,7 @@
 #cmakedefine HAVE_ISATTY 1
 
 /* Define to 1 if you have the `edit' library (-ledit). */
-#cmakedefine HAVE_LIBEDIT ${HAVE_LIBEDIT}
+#cmakedefine HAVE_LIBEDIT ${LibEdit_FOUND}
 
 /* Define to 1 if you have the `pfm' library (-lpfm). */
 #cmakedefine HAVE_LIBPFM ${HAVE_LIBPFM}
Index: llvm/lib/LineEditor/CMakeLists.txt
===
--- llvm/lib/LineEditor/CMakeLists.txt
+++ llvm/lib/LineEditor/CMakeLists.txt
@@ -1,15 +1,14 @@
-if(HAVE_LIBEDIT)
-  set(link_libs edit)
-endif()
+# LibEdit is found in llvm/cmake/config-ix.cmake
 
 add_llvm_component_library(LLVMLineEditor
   LineEditor.cpp
 
   ADDITIONAL_HEADER_DIRS
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/LineEditor
+  ${LibEdit_INCLUDE_DIRS}
 
   LINK_LIBS
-  ${link_libs}
+  ${LibEdit_LIBRARIES}
 
   LINK_COMPONENTS
   Support
Index: llvm/include/llvm/Config/config.h.cmake
===
--- llvm/include/llvm/Config/config.h.cmake
+++ llvm/include/llvm/Config/config.h.cmake
@@ -105,7 +105,7 @@
 #cmakedefine HAVE_ISATTY 1
 
 /* Define to 1 if you have the `edit' library (-ledit). */
-#cmakedefine HAVE_LIBEDIT ${HAVE_LIBEDIT}
+#cmakedefine HAVE_LIBEDIT ${LibEdit_FOUND}
 
 /* Define to 1 if you have the `pfm' library (-lpfm). */
 #cmakedefine HAVE_LIBPFM ${HAVE_LIBPFM}
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -64,7 +64,6 @@
 check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
 
 check_include_file(mach/mach.h HAVE_MACH_MACH_H)
-check_include_file(histedit.h HAVE_HISTEDIT_H)
 check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H)
 if(APPLE)
   include(CheckCSourceCompiles)
@@ -184,10 +183,11 @@
   # Don't look for these libraries on Windows.
   if (NOT PURE_WINDOWS)
 # Skip libedit if using ASan as it contains memory leaks.
-if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
-  check_library_exists(edit el_init "" HAVE_LIBEDIT)
-else()
-  set(HAVE_LIBEDIT 0)
+if (LLVM_ENABLE_LIBEDIT)
+  if (LLVM_USE_SANITIZER MATCHES ".*Address.*")
+message(FATAL_ERROR "LLVM_ENABLE_LIBEDIT cannot be enabled with LLVM_USE_SANITIZER set to AddressSanitizer")
+  endif()
+  find_package(LibEdit REQUIRED)
 endif()
 if(LLVM_ENABLE_TERMINFO)
   if(LLVM_ENABLE_TERMINFO STREQUAL FORCE_ON)
Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -56,7 +56,9 @@
   message(STATUS "${description}: ${${variable}}")
 endmacro()
 
-add_optional_dependency(LLDB_ENABLE_LIBEDIT "Enable editline support in LLDB" LibEdit LibEdit_FOUND)
+if(LLVM_ENABLE_LIBEDIT)
+  find_package(LibEdit REQUIRED)
+endif()
 add_optional_dependency(LLDB_ENABLE_CURSES "Enable curses support in LLDB" CursesAndPanel CURSESANDPANEL_FOUND)
 add_optional_dependency(LLDB_ENABLE_LZMA "Enable LZMA compression support in LLDB" LibLZMA LIBLZMA_FOUND)
 add_optional_dependency(LLDB_ENABLE_LUA "Enable Lua scripting support in LLDB" LuaAndSwig LUAANDSWIG_FOUND)
Index: lldb/cmake/modules/FindLibEdit.cmake
===
--- /dev/null
+++ lldb/cmake/modules/FindLibEdit.cmake
@@ -1,64 +0,0 @@
-#.rst:
-# FindLibEdit
-# ---
-#
-# Find libedit library and headers
-#
-# The module defines the following variables:
-#
-# ::
-#
-#   LibEdit_FOUND  - true if libedit was found
-#   LibEdit_INCLUDE_DIRS   - include search path
-#   LibEdit_LIBRARIES  - libraries to link
-#   LibEdit_VERSION_STRING - version number
-
-if(LibEdit_INCLUDE_DIRS AND LibEdit_LIBRARIES)
-  set(LibEdit_FOUND TRUE)