[Lldb-commits] [lldb] r232648 - Fix linking of unit tests via CMake on Windows.

Zachary Turner zturner at google.com
Wed Mar 18 09:56:25 PDT 2015


Author: zturner
Date: Wed Mar 18 11:56:24 2015
New Revision: 232648

URL: http://llvm.org/viewvc/llvm-project?rev=232648&view=rev
Log:
Fix linking of unit tests via CMake on Windows.

A previous attempt to make the unit tests link properly on
Linux broke it for Windows.  This patch fixes it for both platforms.

Removed:
    lldb/trunk/unittests/Host/SocketTestMock.cpp
    lldb/trunk/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTestMock.cpp
Modified:
    lldb/trunk/cmake/LLDBDependencies.cmake
    lldb/trunk/cmake/modules/AddLLDB.cmake
    lldb/trunk/include/lldb/Host/msvc/Config.h
    lldb/trunk/source/API/CMakeLists.txt
    lldb/trunk/source/CMakeLists.txt
    lldb/trunk/unittests/CMakeLists.txt
    lldb/trunk/unittests/Host/CMakeLists.txt
    lldb/trunk/unittests/Interpreter/CMakeLists.txt
    lldb/trunk/unittests/Plugins/Process/Linux/CMakeLists.txt
    lldb/trunk/unittests/Utility/CMakeLists.txt
    lldb/trunk/unittests/gtest_common.h

Modified: lldb/trunk/cmake/LLDBDependencies.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/LLDBDependencies.cmake?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- lldb/trunk/cmake/LLDBDependencies.cmake (original)
+++ lldb/trunk/cmake/LLDBDependencies.cmake Wed Mar 18 11:56:24 2015
@@ -1,4 +1,5 @@
 set( LLDB_USED_LIBS
+  lldbBase
   lldbBreakpoint
   lldbCommands
   lldbDataFormatters

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Wed Mar 18 11:56:24 2015
@@ -1,78 +1,95 @@
-macro(add_lldb_library name)
-  # only supported parameters to this macro are the optional 
-  # MODULE;SHARED;STATIC library type and source files
-  cmake_parse_arguments(PARAM
-    "MODULE;SHARED;STATIC;OBJECT"
-    ""
-    ""
-    ${ARGN})
-  llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
-
-  if (MSVC_IDE OR XCODE)
-    string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
-    list(GET split_path -1 dir)
-    file(GLOB_RECURSE headers
-      ../../include/lldb${dir}/*.h)
-    set(srcs ${srcs} ${headers})
-  endif()
-  if (PARAM_MODULE)
-    set(libkind MODULE)
-  elseif (PARAM_SHARED)
-    set(libkind SHARED)
-  elseif (PARAM_STATIC)
-    set(libkind STATIC)
-  elseif (PARAM_OBJECT)
-    set(libkind OBJECT)
-  else ()
-    # library type unspecified - controlled by BUILD_SHARED_LIBS
-    unset(libkind)
-  endif()
-
-  #PIC not needed on Win
-  if (NOT MSVC)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
-  endif()
-
-  if (PARAM_OBJECT)
-    add_library(${name} ${libkind} ${srcs})
-  else()
-    llvm_add_library(${name} ${libkind} ${srcs})
-
-    if (PARAM_STATIC)
-      set(lldb_library_keyword ${cmake_2_8_12_INTERFACE})
-    else ()
-      set(lldb_library_keyword ${cmake_2_8_12_PUBLIC})
-    endif ()
-
-    if(LLDB_USED_LIBS)
-      # The Darwin linker doesn't understand --start-group/--end-group.
-      if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
-        target_link_libraries(${name} ${lldb_library_keyword}
-                              -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
-      else()
-        target_link_libraries(${name} ${lldb_library_keyword} ${LLDB_USED_LIBS})
-      endif()
-    endif()
-
-    target_link_libraries(${name} ${lldb_library_keyword} ${CLANG_USED_LIBS})
-    target_link_libraries(${name} ${lldb_library_keyword} ${LLVM_USED_LIBS})
-    llvm_config(${name} ${LLVM_LINK_COMPONENTS})
-    target_link_libraries(${name} ${lldb_library_keyword} ${LLVM_COMMON_LIBS})
-
-    install(TARGETS ${name}
-      LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-      ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
-  endif()
-
-  # Hack: only some LLDB libraries depend on the clang autogenerated headers,
-  # but it is simple enough to make all of LLDB depend on some of those
-  # headers without negatively impacting much of anything.
-  add_dependencies(${name} libclang)
-
-  set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
-endmacro(add_lldb_library)
-
-macro(add_lldb_executable name)
-  add_llvm_executable(${name} ${ARGN})
-  set_target_properties(${name} PROPERTIES FOLDER "lldb executables")
-endmacro(add_lldb_executable)
+function(lldb_link_common_libs name targetkind)
+  if (NOT LLDB_USED_LIBS)
+    return()
+  endif()
+
+  set(COMPILER_SUPPORTS_GROUPS OFF)
+  if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
+    # The Darwin linker doesn't understand --start-group/--end-group.
+    set(COMPILER_SUPPORTS_GROUPS ON)
+  endif()
+
+  if(${targetkind} MATCHES "SHARED")
+    set(LINK_KEYWORD ${cmake_2_8_12_PUBLIC})
+  endif()
+  
+  if(${targetkind} MATCHES "SHARED" OR ${targetkind} MATCHES "EXE")
+    if (COMPILER_SUPPORTS_GROUPS)
+      target_link_libraries(${name} ${LINK_KEYWORD}
+                            -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group)
+    else()
+      target_link_libraries(${name} ${LINK_KEYWORD} ${LLDB_USED_LIBS})
+    endif()
+  endif()
+endfunction(lldb_link_common_libs)
+
+macro(add_lldb_library name)
+  # only supported parameters to this macro are the optional 
+  # MODULE;SHARED;STATIC library type and source files
+  cmake_parse_arguments(PARAM
+    "MODULE;SHARED;STATIC;OBJECT"
+    ""
+    ""
+    ${ARGN})
+  llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
+
+  if (MSVC_IDE OR XCODE)
+    string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
+    list(GET split_path -1 dir)
+    file(GLOB_RECURSE headers
+      ../../include/lldb${dir}/*.h)
+    set(srcs ${srcs} ${headers})
+  endif()
+  if (PARAM_MODULE)
+    set(libkind MODULE)
+  elseif (PARAM_SHARED)
+    set(libkind SHARED)
+  elseif (PARAM_STATIC)
+    set(libkind STATIC)
+  elseif (PARAM_OBJECT)
+    set(libkind OBJECT)
+  else ()
+    # library type unspecified - controlled by BUILD_SHARED_LIBS
+    unset(libkind)
+  endif()
+
+  #PIC not needed on Win
+  if (NOT MSVC)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
+  endif()
+
+  if (PARAM_OBJECT)
+    add_library(${name} ${libkind} ${srcs})
+  else()
+    llvm_add_library(${name} ${libkind} ${srcs})
+
+    lldb_link_common_libs(${name} "${libkind}")
+
+    
+    target_link_libraries(${name} ${cmake_2_8_12_PUBLIC} ${CLANG_USED_LIBS})
+    llvm_config(${name} ${LLVM_LINK_COMPONENTS})
+
+    if (PARAM_SHARED)
+      install(TARGETS ${name}
+        RUNTIME DESTINATION bin
+        LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+        ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+    else()
+      install(TARGETS ${name}
+        LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+        ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+    endif()
+  endif()
+
+  # Hack: only some LLDB libraries depend on the clang autogenerated headers,
+  # but it is simple enough to make all of LLDB depend on some of those
+  # headers without negatively impacting much of anything.
+  add_dependencies(${name} libclang)
+
+  set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
+endmacro(add_lldb_library)
+
+macro(add_lldb_executable name)
+  add_llvm_executable(${name} ${ARGN})
+  set_target_properties(${name} PROPERTIES FOLDER "lldb executables")
+endmacro(add_lldb_executable)

Modified: lldb/trunk/include/lldb/Host/msvc/Config.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/msvc/Config.h?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/msvc/Config.h (original)
+++ lldb/trunk/include/lldb/Host/msvc/Config.h Wed Mar 18 11:56:24 2015
@@ -14,8 +14,8 @@
 // platform functionality availability.
 //----------------------------------------------------------------------
 
-#ifndef liblldb_Platform_Config_h_
-#define liblldb_Platform_Config_h_
+#ifndef liblldb_host_msvc_Config_h_
+#define liblldb_host_msvc_Config_h_
 
 #define LLDB_DISABLE_POSIX
 
@@ -28,8 +28,10 @@
 //#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1
 
 #if _HAS_EXCEPTIONS == 0
-// Exceptions are disabled so this isn't defined, but concrt assumes it is.
-static void *__uncaught_exception() { return nullptr; }
+// Due to a bug in <thread>, when _HAS_EXCEPTIONS == 0 the header will try to call
+// uncaught_exception() without having a declaration for it.  The fix for this is
+// to manually #include <eh.h>, which contains this declaration.
+#include <eh.h>
 #endif
 
 #endif // #ifndef liblldb_Platform_Config_h_

Modified: lldb/trunk/source/API/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/CMakeLists.txt?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- lldb/trunk/source/API/CMakeLists.txt (original)
+++ lldb/trunk/source/API/CMakeLists.txt Wed Mar 18 11:56:24 2015
@@ -4,22 +4,11 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows"
   add_definitions( -DEXPORT_LIBLLDB )
 endif()
 
-# An OBJECT library is a special type of CMake library that produces
-# no archive, has no link interface, and no link inputs.  It is like
-# a regular archive, just without the physical output.  To link against
-# an OBJECT library, you reference it in the *source* file list of a
-# library using the special syntax $<TARGET_OBJECTS:lldbAPI>.  This will
-# cause every object file to be passed to the linker independently, as
-# opposed to a single archive being passed to the linker.
-#
-# This is *extremely* important on Windows.  lldbAPI exports all of the
-# SB classes using __declspec(dllexport).  Unfortunately for technical
-# reasons it is not possible (well, extremely difficult) to get the linker
-# to propagate a __declspec(dllexport) attribute from a symbol in an
-# object file in an archive to a DLL that links against that archive.
-# The solution to this is for the DLL to link the object file directly.
-# So lldbAPI must be an OBJECT library.
-add_lldb_library(lldbAPI OBJECT
+# Include this so that add_lldb_library() has the list of dependencies
+# for liblldb to link against
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
+add_lldb_library(liblldb SHARED
   SBAddress.cpp
   SBAttachInfo.cpp
   SBBlock.cpp
@@ -77,4 +66,30 @@ add_lldb_library(lldbAPI OBJECT
   SBVariablesOptions.cpp
   SBWatchpoint.cpp
   SBUnixSignals.cpp
+  ${LLDB_WRAP_PYTHON}
+  ${LLDB_VERS_GENERATED_FILE}
+  )
+
+set_target_properties(liblldb
+  PROPERTIES
+  VERSION ${LLDB_VERSION}
   )
+
+if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
+  # Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs,
+  # so only it needs to explicitly link against ${PYTHON_LIBRARY}
+  if (MSVC AND NOT LLDB_DISABLE_PYTHON)
+    target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY})
+  endif()
+else()
+  set_target_properties(liblldb
+    PROPERTIES
+    OUTPUT_NAME lldb
+    )
+endif()
+
+if (LLDB_WRAP_PYTHON OR LLDB_VERS_GENERATED_FILE)
+  add_dependencies(liblldb swig_wrapper)
+endif()
+target_link_libraries(liblldb ${cmake_2_8_12_PRIVATE} ${LLDB_SYSTEM_LIBS})
+

Modified: lldb/trunk/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/CMakeLists.txt?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- lldb/trunk/source/CMakeLists.txt (original)
+++ lldb/trunk/source/CMakeLists.txt Wed Mar 18 11:56:24 2015
@@ -25,7 +25,11 @@ include_directories(
   )
 endif ()
 
-add_subdirectory(API)
+add_lldb_library(lldbBase
+  lldb.cpp
+  lldb-log.cpp
+  )
+
 add_subdirectory(Breakpoint)
 add_subdirectory(Commands)
 add_subdirectory(Core)
@@ -38,43 +42,8 @@ add_subdirectory(Symbol)
 add_subdirectory(Target)
 add_subdirectory(Utility)
 
-include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
-
-add_lldb_library(lldbBase STATIC
-  lldb.cpp
-  lldb-log.cpp
-  )
-
-add_lldb_library(liblldb SHARED
-  lldb.cpp
-  lldb-log.cpp
-  $<TARGET_OBJECTS:lldbAPI>
-  ${LLDB_WRAP_PYTHON}
-  ${LLDB_VERS_GENERATED_FILE}
-  )
-
-set_target_properties(liblldb
-  PROPERTIES
-  VERSION ${LLDB_VERSION}
-  )
-
-if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
-  # Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs,
-  # so only it needs to explicitly link against ${PYTHON_LIBRARY}
-  if (MSVC AND NOT LLDB_DISABLE_PYTHON)
-    target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY})
-  endif()
-else()
-  set_target_properties(liblldb
-    PROPERTIES
-    OUTPUT_NAME lldb
-    )
-endif()
-
-if (LLDB_WRAP_PYTHON OR LLDB_VERS_GENERATED_FILE)
-  add_dependencies(liblldb swig_wrapper)
-endif()
-target_link_libraries(liblldb ${cmake_2_8_12_PRIVATE} ${LLDB_SYSTEM_LIBS})
+# Build API last, since liblldb needs to link against every other target
+add_subdirectory(API)
 
 # Determine LLDB revision and repository. GetSourceVersion and GetRepositoryPath are shell-scripts, and as
 # such will not work on Windows.
@@ -102,7 +71,3 @@ endif ()
 # FIXME: implement svn/git revision and repository parsing solution on Windows. There is an SVN-only
 #        revision parsing solution in tools/clang/lib/Basic/CMakelists.txt.
 
-install(TARGETS liblldb
-  RUNTIME DESTINATION bin
-  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
-  ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})

Modified: lldb/trunk/unittests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/CMakeLists.txt?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- lldb/trunk/unittests/CMakeLists.txt (original)
+++ lldb/trunk/unittests/CMakeLists.txt Wed Mar 18 11:56:24 2015
@@ -10,11 +10,21 @@ else ()
   list(APPEND LLVM_COMPILE_FLAGS -include ${LLDB_GTEST_COMMON_INCLUDE})
 endif ()
 
-# add_lldb_unittest(test_dirname file1.cpp file2.cpp)
-#
-# Will compile the list of files together and link against
+include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
+
 function(add_lldb_unittest test_name)
-  add_unittest(LLDBUnitTests ${test_name} ${ARGN})
+  add_unittest(LLDBUnitTests
+    ${test_name}
+    ${ARGN}
+    )
+
+  if (MSVC)
+    target_link_libraries(${test_name} ${PYTHON_LIBRARY})
+  endif()
+
+  lldb_link_common_libs(${test_name} EXE)
+  target_link_libraries(${test_name} ${CLANG_USED_LIBS})
+  llvm_config(${test_name} ${LLVM_LINK_COMPONENTS})
 endfunction()
 
 add_subdirectory(Host)

Modified: lldb/trunk/unittests/Host/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/CMakeLists.txt?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- lldb/trunk/unittests/Host/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Host/CMakeLists.txt Wed Mar 18 11:56:24 2015
@@ -1,10 +1,4 @@
 add_lldb_unittest(HostTests
   SocketAddressTest.cpp
   SocketTest.cpp
-  SocketTestMock.cpp
-  )
-
-target_link_libraries(HostTests
-  lldbBase
-  ${PYTHON_LIBRARY}
   )

Removed: lldb/trunk/unittests/Host/SocketTestMock.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/SocketTestMock.cpp?rev=232647&view=auto
==============================================================================
--- lldb/trunk/unittests/Host/SocketTestMock.cpp (original)
+++ lldb/trunk/unittests/Host/SocketTestMock.cpp (removed)
@@ -1,64 +0,0 @@
-//===-- SocketTestMock.cpp --------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// This file provides a few necessary functions to link SocketTest.cpp
-// Bringing in the real implementations results in a cascade of dependencies
-// that pull in all of lldb.
-
-#include "lldb/Core/Log.h"
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-using namespace lldb_private;
-
-void
-lldb_private::Log::Error (char const*, ...)
-{
-}
-
-void
-lldb_private::Log::Printf (char const*, ...)
-{
-}
-
-Log*
-lldb_private::GetLogIfAnyCategoriesSet (unsigned int)
-{
-    return nullptr;
-}
-
-#include "lldb/Host/FileSystem.h"
-
-#ifdef _WIN32
-
-Error
-FileSystem::Unlink(const char *path)
-{
-    Error error;
-    BOOL result = ::DeleteFile(path);
-    if (!result)
-        error.SetError(::GetLastError(), lldb::eErrorTypeWin32);
-    return error;
-}
-
-#else
-
-Error
-FileSystem::Unlink (const char *path)
-{
-    Error error;
-    if (::unlink (path) == -1)
-        error.SetErrorToErrno ();
-    return error;
-}
-
-#endif
-

Modified: lldb/trunk/unittests/Interpreter/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Interpreter/CMakeLists.txt?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- lldb/trunk/unittests/Interpreter/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Interpreter/CMakeLists.txt Wed Mar 18 11:56:24 2015
@@ -3,6 +3,5 @@ add_lldb_unittest(InterpreterTests
   )
 
 target_link_libraries(InterpreterTests
-  lldbInterpreter
   ${PYTHON_LIBRARY}
   )

Modified: lldb/trunk/unittests/Plugins/Process/Linux/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Plugins/Process/Linux/CMakeLists.txt?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- lldb/trunk/unittests/Plugins/Process/Linux/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Plugins/Process/Linux/CMakeLists.txt Wed Mar 18 11:56:24 2015
@@ -1,9 +1,3 @@
 add_lldb_unittest(ProcessLinuxTests
   ThreadStateCoordinatorTest.cpp
-  ThreadStateCoordinatorTestMock.cpp
-  )
-
-target_link_libraries(ProcessLinuxTests
-  lldbBase
-  ${PYTHON_LIBRARY}
   )

Removed: lldb/trunk/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTestMock.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTestMock.cpp?rev=232647&view=auto
==============================================================================
--- lldb/trunk/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTestMock.cpp (original)
+++ lldb/trunk/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTestMock.cpp (removed)
@@ -1,32 +0,0 @@
-//===-- ThreadStateCoordinatorTestMock.cpp ----------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// This file provides a few necessary functions to link
-// ThreadStateCoordinatorTest.cpp Bringing in the real implementations results
-// in a cascade of dependencies that pull in all of lldb.
-
-#include "lldb/Core/Log.h"
-
-using namespace lldb_private;
-
-void
-lldb_private::Log::Error (char const*, ...)
-{
-}
-
-void
-lldb_private::Log::Printf (char const*, ...)
-{
-}
-
-Log*
-lldb_private::GetLogIfAnyCategoriesSet (unsigned int)
-{
-    return nullptr;
-}

Modified: lldb/trunk/unittests/Utility/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/CMakeLists.txt?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Utility/CMakeLists.txt Wed Mar 18 11:56:24 2015
@@ -2,8 +2,3 @@ add_lldb_unittest(UtilityTests
   StringExtractorTest.cpp
   UriParserTest.cpp
   )
-
-target_link_libraries(UtilityTests
-  lldbBase
-  ${PYTHON_LIBRARY}
-  )

Modified: lldb/trunk/unittests/gtest_common.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/gtest_common.h?rev=232648&r1=232647&r2=232648&view=diff
==============================================================================
--- lldb/trunk/unittests/gtest_common.h (original)
+++ lldb/trunk/unittests/gtest_common.h Wed Mar 18 11:56:24 2015
@@ -17,16 +17,8 @@
 // units.  Be very leary about putting anything in this file.
 
 #if defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0)
-// MSVC's STL implementation tries to work well with /EHs-c- and
-// _HAS_EXCEPTIONS=0.  But <thread> in particular doesn't work with it, because
-// it relies on <concrt.h> which tries to throw an exception without checking
-// for _HAS_EXCEPTIONS=0.  This causes the linker to require a definition of
-// __uncaught_exception(), but the STL doesn't define this function when
-// _HAS_EXCEPTIONS=0.  The workaround here is to just provide a stub
-// implementation to get it to link.
-inline bool
-__uncaught_exception()
-{
-    return true;
-}
+// Due to a bug in <thread>, when _HAS_EXCEPTIONS == 0 the header will try to call
+// uncaught_exception() without having a declaration for it.  The fix for this is
+// to manually #include <eh.h>, which contains this declaration.
+#include <eh.h>
 #endif





More information about the lldb-commits mailing list