xiaobai created this revision.
xiaobai added reviewers: eugene, labath, beanz.
Herald added a subscriber: mgorny.

Instead of checking if code compiles, I think it is a better to check
if the symbol exists. This is simpler and should do the same thing.


https://reviews.llvm.org/D47897

Files:
  cmake/modules/LLDBGenerateConfig.cmake


Index: cmake/modules/LLDBGenerateConfig.cmake
===================================================================
--- cmake/modules/LLDBGenerateConfig.cmake
+++ cmake/modules/LLDBGenerateConfig.cmake
@@ -14,14 +14,8 @@
 check_include_file(termios.h HAVE_TERMIOS_H)
 check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
 
-check_cxx_source_compiles("
-  #include <sys/uio.h>
-  int main() { process_vm_readv(0, nullptr, 0, nullptr, 0, 0); return 0; }"
-  HAVE_PROCESS_VM_READV)
-check_cxx_source_compiles("
-    #include <sys/syscall.h>
-    int main() { return __NR_process_vm_readv; }"
-    HAVE_NR_PROCESS_VM_READV)
+check_cxx_symbol_exists(process_vm_readv "sys/uio.h" HAVE_PROCESS_VM_READV)
+check_cxx_symbol_exists(__NR_process_vm_readv "sys/syscall.h" 
HAVE_NR_PROCESS_VM_READV)
 
 check_library_exists(compression compression_encode_buffer "" 
HAVE_LIBCOMPRESSION)
 


Index: cmake/modules/LLDBGenerateConfig.cmake
===================================================================
--- cmake/modules/LLDBGenerateConfig.cmake
+++ cmake/modules/LLDBGenerateConfig.cmake
@@ -14,14 +14,8 @@
 check_include_file(termios.h HAVE_TERMIOS_H)
 check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
 
-check_cxx_source_compiles("
-  #include <sys/uio.h>
-  int main() { process_vm_readv(0, nullptr, 0, nullptr, 0, 0); return 0; }"
-  HAVE_PROCESS_VM_READV)
-check_cxx_source_compiles("
-    #include <sys/syscall.h>
-    int main() { return __NR_process_vm_readv; }"
-    HAVE_NR_PROCESS_VM_READV)
+check_cxx_symbol_exists(process_vm_readv "sys/uio.h" HAVE_PROCESS_VM_READV)
+check_cxx_symbol_exists(__NR_process_vm_readv "sys/syscall.h" HAVE_NR_PROCESS_VM_READV)
 
 check_library_exists(compression compression_encode_buffer "" HAVE_LIBCOMPRESSION)
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH]... Alex Langford via Phabricator via lldb-commits

Reply via email to