Remove Xcode cmake win32 projects unittests from LLVM and
clang.xcodeproj INPUTS win32 from clang. Requested by: jkim Approved by: ed (mentor)
This commit is contained in:
parent
8340692f44
commit
1fbefe1829
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
||||
Xcode project files for LLVM, for Xcode 2.1
|
@ -1 +0,0 @@
|
||||
See docs/CMake.html for instructions on how to build LLVM with CMake.
|
@ -1,271 +0,0 @@
|
||||
include(CheckIncludeFile)
|
||||
include(CheckLibraryExists)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
if( UNIX )
|
||||
# Used by check_symbol_exists:
|
||||
set(CMAKE_REQUIRED_LIBRARIES m)
|
||||
endif()
|
||||
|
||||
# Helper macros and functions
|
||||
macro(add_cxx_include result files)
|
||||
set(${result} "")
|
||||
foreach (file_name ${files})
|
||||
set(${result} "${${result}}#include<${file_name}>\n")
|
||||
endforeach()
|
||||
endmacro(add_cxx_include files result)
|
||||
|
||||
function(check_type_exists type files variable)
|
||||
add_cxx_include(includes "${files}")
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
${includes} ${type} typeVar;
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
" ${variable})
|
||||
endfunction()
|
||||
|
||||
# include checks
|
||||
check_include_file(argz.h HAVE_ARGZ_H)
|
||||
check_include_file(assert.h HAVE_ASSERT_H)
|
||||
check_include_file(dirent.h HAVE_DIRENT_H)
|
||||
check_include_file(dl.h HAVE_DL_H)
|
||||
check_include_file(dld.h HAVE_DLD_H)
|
||||
check_include_file(dlfcn.h HAVE_DLFCN_H)
|
||||
check_include_file(errno.h HAVE_ERRNO_H)
|
||||
check_include_file(execinfo.h HAVE_EXECINFO_H)
|
||||
check_include_file(fcntl.h HAVE_FCNTL_H)
|
||||
check_include_file(inttypes.h HAVE_INTTYPES_H)
|
||||
check_include_file(limits.h HAVE_LIMITS_H)
|
||||
check_include_file(link.h HAVE_LINK_H)
|
||||
check_include_file(malloc.h HAVE_MALLOC_H)
|
||||
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
|
||||
check_include_file(memory.h HAVE_MEMORY_H)
|
||||
check_include_file(ndir.h HAVE_NDIR_H)
|
||||
if( NOT LLVM_ON_WIN32 )
|
||||
check_include_file(pthread.h HAVE_PTHREAD_H)
|
||||
endif()
|
||||
check_include_file(setjmp.h HAVE_SETJMP_H)
|
||||
check_include_file(signal.h HAVE_SIGNAL_H)
|
||||
check_include_file(stdint.h HAVE_STDINT_H)
|
||||
check_include_file(stdio.h HAVE_STDIO_H)
|
||||
check_include_file(stdlib.h HAVE_STDLIB_H)
|
||||
check_include_file(string.h HAVE_STRING_H)
|
||||
check_include_file(sys/dir.h HAVE_SYS_DIR_H)
|
||||
check_include_file(sys/dl.h HAVE_SYS_DL_H)
|
||||
check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H)
|
||||
check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
|
||||
check_include_file(sys/ndir.h HAVE_SYS_NDIR_H)
|
||||
check_include_file(sys/param.h HAVE_SYS_PARAM_H)
|
||||
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
|
||||
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
|
||||
check_include_file(sys/time.h HAVE_SYS_TIME_H)
|
||||
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_file(sys/wait.h HAVE_SYS_WAIT_H)
|
||||
check_include_file(termios.h HAVE_TERMIOS_H)
|
||||
check_include_file(unistd.h HAVE_UNISTD_H)
|
||||
check_include_file(utime.h HAVE_UTIME_H)
|
||||
check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H)
|
||||
check_include_file(windows.h HAVE_WINDOWS_H)
|
||||
|
||||
# library checks
|
||||
if( NOT LLVM_ON_WIN32 )
|
||||
check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD)
|
||||
check_library_exists(pthread pthread_getspecific "" HAVE_PTHREAD_GETSPECIFIC)
|
||||
check_library_exists(pthread pthread_rwlock_init "" HAVE_PTHREAD_RWLOCK_INIT)
|
||||
check_library_exists(dl dlopen "" HAVE_LIBDL)
|
||||
endif()
|
||||
|
||||
# function checks
|
||||
check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE)
|
||||
check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE)
|
||||
check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT)
|
||||
check_function_exists(isatty HAVE_ISATTY)
|
||||
check_symbol_exists(isinf cmath HAVE_ISINF_IN_CMATH)
|
||||
check_symbol_exists(isinf math.h HAVE_ISINF_IN_MATH_H)
|
||||
check_symbol_exists(finite ieeefp.h HAVE_FINITE_IN_IEEEFP_H)
|
||||
check_symbol_exists(isnan cmath HAVE_ISNAN_IN_CMATH)
|
||||
check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H)
|
||||
check_symbol_exists(ceilf math.h HAVE_CEILF)
|
||||
check_symbol_exists(floorf math.h HAVE_FLOORF)
|
||||
check_symbol_exists(nearbyintf math.h HAVE_NEARBYINTF)
|
||||
check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
|
||||
check_symbol_exists(malloc_zone_statistics malloc/malloc.h
|
||||
HAVE_MALLOC_ZONE_STATISTICS)
|
||||
check_symbol_exists(mkdtemp "stdlib.h;unistd.h" HAVE_MKDTEMP)
|
||||
check_symbol_exists(mkstemp "stdlib.h;unistd.h" HAVE_MKSTEMP)
|
||||
check_symbol_exists(mktemp "stdlib.h;unistd.h" HAVE_MKTEMP)
|
||||
if( NOT LLVM_ON_WIN32 )
|
||||
check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK)
|
||||
endif()
|
||||
check_symbol_exists(sbrk unistd.h HAVE_SBRK)
|
||||
check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
|
||||
check_symbol_exists(strerror string.h HAVE_STRERROR)
|
||||
check_symbol_exists(strerror_r string.h HAVE_STRERROR_R)
|
||||
check_symbol_exists(strerror_s string.h HAVE_STRERROR_S)
|
||||
check_symbol_exists(setenv stdlib.h HAVE_SETENV)
|
||||
|
||||
check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC)
|
||||
if( LLVM_USING_GLIBC )
|
||||
add_llvm_definitions( -D_GNU_SOURCE )
|
||||
endif()
|
||||
|
||||
# Type checks
|
||||
check_type_exists(std::bidirectional_iterator<int,int> "iterator;iostream" HAVE_BI_ITERATOR)
|
||||
check_type_exists(std::iterator<int,int,int> iterator HAVE_STD_ITERATOR)
|
||||
check_type_exists(std::forward_iterator<int,int> iterator HAVE_FWD_ITERATOR)
|
||||
|
||||
set(headers "")
|
||||
if (HAVE_SYS_TYPES_H)
|
||||
set(headers ${headers} "sys/types.h")
|
||||
endif()
|
||||
|
||||
if (HAVE_INTTYPES_H)
|
||||
set(headers ${headers} "inttypes.h")
|
||||
endif()
|
||||
|
||||
if (HAVE_STDINT_H)
|
||||
set(headers ${headers} "stdint.h")
|
||||
endif()
|
||||
|
||||
check_type_exists(uint64_t "${headers}" HAVE_UINT64_T)
|
||||
check_type_exists(u_int64_t "${headers}" HAVE_U_INT64_T)
|
||||
|
||||
# available programs checks
|
||||
function(llvm_find_program name)
|
||||
string(TOUPPER ${name} NAME)
|
||||
find_program(LLVM_PATH_${NAME} ${name})
|
||||
mark_as_advanced(LLVM_PATH_${NAME})
|
||||
if(LLVM_PATH_${NAME})
|
||||
set(HAVE_${NAME} 1 CACHE INTERNAL "Is ${name} available ?")
|
||||
mark_as_advanced(HAVE_${NAME})
|
||||
else(LLVM_PATH_${NAME})
|
||||
set(HAVE_${NAME} "" CACHE INTERNAL "Is ${name} available ?")
|
||||
endif(LLVM_PATH_${NAME})
|
||||
endfunction()
|
||||
|
||||
llvm_find_program(gv)
|
||||
llvm_find_program(circo)
|
||||
llvm_find_program(twopi)
|
||||
llvm_find_program(neato)
|
||||
llvm_find_program(fdp)
|
||||
llvm_find_program(dot)
|
||||
llvm_find_program(dotty)
|
||||
|
||||
# Define LLVM_MULTITHREADED if gcc atomic builtins exists.
|
||||
include(CheckAtomic)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
# On windows all code is position-independent and mingw warns if -fPIC
|
||||
# is in the command-line.
|
||||
if( NOT WIN32 )
|
||||
check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG)
|
||||
endif()
|
||||
|
||||
include(GetTargetTriple)
|
||||
get_target_triple(LLVM_HOSTTRIPLE)
|
||||
|
||||
# FIXME: We don't distinguish the target and the host. :(
|
||||
set(TARGET_TRIPLE "${LLVM_HOSTTRIPLE}")
|
||||
|
||||
# Determine the native architecture.
|
||||
string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
|
||||
if( LLVM_NATIVE_ARCH STREQUAL "host" )
|
||||
string(REGEX MATCH "^[^-]*" LLVM_NATIVE_ARCH ${LLVM_HOSTTRIPLE})
|
||||
endif ()
|
||||
|
||||
if (LLVM_NATIVE_ARCH MATCHES "i[2-6]86")
|
||||
set(LLVM_NATIVE_ARCH X86)
|
||||
elseif (LLVM_NATIVE_ARCH STREQUAL "x86")
|
||||
set(LLVM_NATIVE_ARCH X86)
|
||||
elseif (LLVM_NATIVE_ARCH STREQUAL "amd64")
|
||||
set(LLVM_NATIVE_ARCH X86)
|
||||
elseif (LLVM_NATIVE_ARCH STREQUAL "x86_64")
|
||||
set(LLVM_NATIVE_ARCH X86)
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "sparc")
|
||||
set(LLVM_NATIVE_ARCH Sparc)
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "powerpc")
|
||||
set(LLVM_NATIVE_ARCH PowerPC)
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "alpha")
|
||||
set(LLVM_NATIVE_ARCH Alpha)
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "arm")
|
||||
set(LLVM_NATIVE_ARCH ARM)
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "mips")
|
||||
set(LLVM_NATIVE_ARCH Mips)
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "pic16")
|
||||
set(LLVM_NATIVE_ARCH "PIC16")
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "xcore")
|
||||
set(LLVM_NATIVE_ARCH XCore)
|
||||
elseif (LLVM_NATIVE_ARCH MATCHES "msp430")
|
||||
set(LLVM_NATIVE_ARCH MSP430)
|
||||
else ()
|
||||
message(STATUS
|
||||
"Unknown architecture ${LLVM_NATIVE_ARCH}; lli will not JIT code")
|
||||
set(LLVM_NATIVE_ARCH)
|
||||
endif ()
|
||||
|
||||
if (LLVM_NATIVE_ARCH)
|
||||
list(FIND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH} NATIVE_ARCH_IDX)
|
||||
if (NATIVE_ARCH_IDX EQUAL -1)
|
||||
message(STATUS
|
||||
"Native target ${LLVM_NATIVE_ARCH} is not selected; lli will not JIT code")
|
||||
set(LLVM_NATIVE_ARCH)
|
||||
else ()
|
||||
message(STATUS "Native target architecture is ${LLVM_NATIVE_ARCH}")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if( MINGW )
|
||||
set(HAVE_LIBIMAGEHLP 1)
|
||||
set(HAVE_LIBPSAPI 1)
|
||||
# TODO: Check existence of libraries.
|
||||
# include(CheckLibraryExists)
|
||||
# CHECK_LIBRARY_EXISTS(imagehlp ??? . HAVE_LIBIMAGEHLP)
|
||||
endif( MINGW )
|
||||
|
||||
if( MSVC )
|
||||
set(error_t int)
|
||||
set(mode_t "unsigned short")
|
||||
set(LTDL_SHLIBPATH_VAR "PATH")
|
||||
set(LTDL_SYSSEARCHPATH "")
|
||||
set(LTDL_DLOPEN_DEPLIBS 1)
|
||||
set(SHLIBEXT ".lib")
|
||||
set(LTDL_OBJDIR "_libs")
|
||||
set(HAVE_STRTOLL 1)
|
||||
set(strtoll "_strtoi64")
|
||||
set(strtoull "_strtoui64")
|
||||
set(stricmp "_stricmp")
|
||||
set(strdup "_strdup")
|
||||
else( MSVC )
|
||||
set(LTDL_SHLIBPATH_VAR "LD_LIBRARY_PATH")
|
||||
set(LTDL_SYSSEARCHPATH "") # TODO
|
||||
set(LTDL_DLOPEN_DEPLIBS 0) # TODO
|
||||
endif( MSVC )
|
||||
|
||||
# FIXME: Signal handler return type, currently hardcoded to 'void'
|
||||
set(RETSIGTYPE void)
|
||||
|
||||
if( LLVM_ENABLE_THREADS )
|
||||
if( HAVE_PTHREAD_H OR WIN32 )
|
||||
set(ENABLE_THREADS 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( ENABLE_THREADS )
|
||||
message(STATUS "Threads enabled.")
|
||||
else( ENABLE_THREADS )
|
||||
message(STATUS "Threads disabled.")
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake
|
||||
${LLVM_BINARY_DIR}/include/llvm/Config/config.h
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/System/DataTypes.h.cmake
|
||||
${LLVM_BINARY_DIR}/include/llvm/System/DataTypes.h
|
||||
)
|
||||
|
@ -1,109 +0,0 @@
|
||||
include(LLVMProcessSources)
|
||||
include(LLVMConfig)
|
||||
|
||||
macro(add_llvm_library name)
|
||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
||||
add_library( ${name} ${ALL_FILES} )
|
||||
set( llvm_libs ${llvm_libs} ${name} PARENT_SCOPE)
|
||||
set( llvm_lib_targets ${llvm_lib_targets} ${name} PARENT_SCOPE )
|
||||
if( LLVM_COMMON_DEPENDS )
|
||||
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
|
||||
endif( LLVM_COMMON_DEPENDS )
|
||||
install(TARGETS ${name}
|
||||
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
||||
# The LLVM Target library shall be built before its sublibraries
|
||||
# (asmprinter, etc) because those may use tablegenned files which
|
||||
# generation is triggered by the main LLVM target library. Necessary
|
||||
# for parallel builds:
|
||||
if( CURRENT_LLVM_TARGET )
|
||||
add_dependencies(${name} ${CURRENT_LLVM_TARGET})
|
||||
endif()
|
||||
endmacro(add_llvm_library name)
|
||||
|
||||
|
||||
macro(add_llvm_loadable_module name)
|
||||
if( NOT LLVM_ON_UNIX )
|
||||
message(STATUS "Loadable modules not supported on this platform.
|
||||
${name} ignored.")
|
||||
else()
|
||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
||||
add_library( ${name} MODULE ${ALL_FILES} )
|
||||
set_target_properties( ${name} PROPERTIES PREFIX "" )
|
||||
|
||||
if (APPLE)
|
||||
# Darwin-specific linker flags for loadable modules.
|
||||
set_target_properties(${name} PROPERTIES
|
||||
LINK_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
|
||||
endif()
|
||||
|
||||
install(TARGETS ${name}
|
||||
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
endmacro(add_llvm_loadable_module name)
|
||||
|
||||
|
||||
macro(add_llvm_executable name)
|
||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
||||
if( EXCLUDE_FROM_ALL )
|
||||
add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
|
||||
else()
|
||||
add_executable(${name} ${ALL_FILES})
|
||||
endif()
|
||||
set(EXCLUDE_FROM_ALL OFF)
|
||||
if( LLVM_USED_LIBS )
|
||||
foreach(lib ${LLVM_USED_LIBS})
|
||||
target_link_libraries( ${name} ${lib} )
|
||||
endforeach(lib)
|
||||
endif( LLVM_USED_LIBS )
|
||||
if( LLVM_LINK_COMPONENTS )
|
||||
llvm_config(${name} ${LLVM_LINK_COMPONENTS})
|
||||
endif( LLVM_LINK_COMPONENTS )
|
||||
get_system_libs(llvm_system_libs)
|
||||
if( llvm_system_libs )
|
||||
target_link_libraries(${name} ${llvm_system_libs})
|
||||
endif()
|
||||
if( LLVM_COMMON_DEPENDS )
|
||||
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
|
||||
endif( LLVM_COMMON_DEPENDS )
|
||||
endmacro(add_llvm_executable name)
|
||||
|
||||
|
||||
macro(add_llvm_tool name)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR})
|
||||
if( NOT LLVM_BUILD_TOOLS )
|
||||
set(EXCLUDE_FROM_ALL ON)
|
||||
endif()
|
||||
add_llvm_executable(${name} ${ARGN})
|
||||
if( LLVM_BUILD_TOOLS )
|
||||
install(TARGETS ${name} RUNTIME DESTINATION bin)
|
||||
endif()
|
||||
endmacro(add_llvm_tool name)
|
||||
|
||||
|
||||
macro(add_llvm_example name)
|
||||
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_EXAMPLES_BINARY_DIR})
|
||||
if( NOT LLVM_BUILD_EXAMPLES )
|
||||
set(EXCLUDE_FROM_ALL ON)
|
||||
endif()
|
||||
add_llvm_executable(${name} ${ARGN})
|
||||
if( LLVM_BUILD_EXAMPLES )
|
||||
install(TARGETS ${name} RUNTIME DESTINATION examples)
|
||||
endif()
|
||||
endmacro(add_llvm_example name)
|
||||
|
||||
|
||||
macro(add_llvm_target target_name)
|
||||
if( TABLEGEN_OUTPUT )
|
||||
add_custom_target(${target_name}Table_gen
|
||||
DEPENDS ${TABLEGEN_OUTPUT})
|
||||
add_dependencies(${target_name}Table_gen ${LLVM_COMMON_DEPENDS})
|
||||
endif( TABLEGEN_OUTPUT )
|
||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_llvm_library(LLVM${target_name} ${ARGN} ${TABLEGEN_OUTPUT})
|
||||
if ( TABLEGEN_OUTPUT )
|
||||
add_dependencies(LLVM${target_name} ${target_name}Table_gen)
|
||||
endif (TABLEGEN_OUTPUT)
|
||||
set(CURRENT_LLVM_TARGET LLVM${target_name} PARENT_SCOPE)
|
||||
endmacro(add_llvm_target)
|
@ -1,11 +0,0 @@
|
||||
# There is no clear way of keeping track of compiler command-line
|
||||
# options chosen via `add_definitions', so we need our own method for
|
||||
# using it on tools/llvm-config/CMakeLists.txt.
|
||||
|
||||
# Beware that there is no implementation of remove_llvm_definitions.
|
||||
|
||||
macro(add_llvm_definitions)
|
||||
set(LLVM_DEFINITIONS "${LLVM_DEFINITIONS} ${ARGN}")
|
||||
add_definitions( ${ARGN} )
|
||||
endmacro(add_llvm_definitions)
|
||||
|
@ -1,29 +0,0 @@
|
||||
# atomic builtins are required for threading support.
|
||||
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#ifdef _MSC_VER
|
||||
#include <windows.h>
|
||||
#endif
|
||||
int main() {
|
||||
#ifdef _MSC_VER
|
||||
volatile LONG val = 1;
|
||||
MemoryBarrier();
|
||||
InterlockedCompareExchange(&val, 0, 1);
|
||||
InterlockedIncrement(&val);
|
||||
InterlockedDecrement(&val);
|
||||
#else
|
||||
volatile unsigned long val = 1;
|
||||
__sync_synchronize();
|
||||
__sync_val_compare_and_swap(&val, 1, 0);
|
||||
__sync_add_and_fetch(&val, 1);
|
||||
__sync_sub_and_fetch(&val, 1);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
" LLVM_MULTITHREADED)
|
||||
|
||||
if( NOT LLVM_MULTITHREADED )
|
||||
message(STATUS "Warning: LLVM will be built thread-unsafe because atomic builtins are missing")
|
||||
endif()
|
@ -1,26 +0,0 @@
|
||||
|
||||
if( ${LLVM_TABLEGEN} STREQUAL "tblgen" )
|
||||
set(CX_NATIVE_TG_DIR "${CMAKE_BINARY_DIR}/native")
|
||||
set(LLVM_TABLEGEN_EXE "${CX_NATIVE_TG_DIR}/bin/tblgen")
|
||||
|
||||
add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CX_NATIVE_TG_DIR}
|
||||
COMMENT "Creating ${CX_NATIVE_TG_DIR}...")
|
||||
|
||||
add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}/CMakeCache.txt
|
||||
COMMAND ${CMAKE_COMMAND} -UMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
|
||||
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}
|
||||
DEPENDS ${CX_NATIVE_TG_DIR}
|
||||
COMMENT "Configuring native TableGen...")
|
||||
|
||||
add_custom_command(OUTPUT ${LLVM_TABLEGEN_EXE}
|
||||
COMMAND ${CMAKE_BUILD_TOOL}
|
||||
DEPENDS ${CX_NATIVE_TG_DIR}/CMakeCache.txt
|
||||
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}/utils/TableGen
|
||||
COMMENT "Building native TableGen...")
|
||||
add_custom_target(NativeTableGen DEPENDS ${LLVM_TABLEGEN_EXE})
|
||||
|
||||
add_dependencies(tblgen NativeTableGen)
|
||||
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CX_NATIVE_TG_DIR})
|
||||
endif()
|
@ -1,52 +0,0 @@
|
||||
# - Try to find Bison
|
||||
# Once done this will define
|
||||
#
|
||||
# BISON_FOUND - system has Bison
|
||||
# BISON_EXECUTABLE - path of the bison executable
|
||||
# BISON_VERSION - the version string, like "2.5.31"
|
||||
#
|
||||
|
||||
MACRO(FIND_BISON)
|
||||
FIND_PROGRAM(BISON_EXECUTABLE NAMES bison)
|
||||
|
||||
IF(BISON_EXECUTABLE)
|
||||
SET(BISON_FOUND TRUE)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version
|
||||
OUTPUT_VARIABLE _BISON_VERSION
|
||||
)
|
||||
string (REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" BISON_VERSION "${_bison_VERSION}")
|
||||
ENDIF(BISON_EXECUTABLE)
|
||||
|
||||
IF(BISON_FOUND)
|
||||
IF(NOT Bison_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Bison: ${BISON_EXECUTABLE}")
|
||||
ENDIF(NOT Bison_FIND_QUIETLY)
|
||||
ELSE(BISON_FOUND)
|
||||
IF(Bison_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find Bison")
|
||||
ENDIF(Bison_FIND_REQUIRED)
|
||||
ENDIF(BISON_FOUND)
|
||||
ENDMACRO(FIND_BISON)
|
||||
|
||||
MACRO(BISON_GENERATOR _PREFIX _Y_INPUT _H_OUTPUT _CPP_OUTPUT)
|
||||
IF(BISON_EXECUTABLE)
|
||||
GET_FILENAME_COMPONENT(_Y_DIR ${_Y_INPUT} PATH)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${_CPP_OUTPUT}
|
||||
OUTPUT ${_H_OUTPUT}
|
||||
DEPENDS ${_Y_INPUT}
|
||||
COMMAND ${BISON_EXECUTABLE}
|
||||
ARGS
|
||||
-p ${_PREFIX} -o"${_CPP_OUTPUT}"
|
||||
--defines="${_H_OUTPUT}" ${_Y_INPUT}
|
||||
WORKING_DIRECTORY ${_Y_DIR}
|
||||
)
|
||||
SET_SOURCE_FILES_PROPERTIES(
|
||||
${_CPP_OUTPUT} ${_H_OUTPUT}
|
||||
GENERATED
|
||||
)
|
||||
ELSE(BISON_EXECUTABLE)
|
||||
MESSAGE(SEND_ERROR "Can't find bison program, and it's required")
|
||||
ENDIF(BISON_EXECUTABLE)
|
||||
ENDMACRO(BISON_GENERATOR)
|
@ -1,26 +0,0 @@
|
||||
# Returns the host triple.
|
||||
# Invokes config.guess
|
||||
|
||||
function( get_target_triple var )
|
||||
if( MSVC )
|
||||
if( CMAKE_CL_64 )
|
||||
set( value "x86_64-pc-win32" )
|
||||
else()
|
||||
set( value "i686-pc-win32" )
|
||||
endif()
|
||||
elseif( MINGW AND NOT MSYS )
|
||||
set( value "i686-pc-mingw32" )
|
||||
else( MSVC )
|
||||
set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess)
|
||||
execute_process(COMMAND sh ${config_guess}
|
||||
RESULT_VARIABLE TT_RV
|
||||
OUTPUT_VARIABLE TT_OUT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if( NOT TT_RV EQUAL 0 )
|
||||
message(FATAL_ERROR "Failed to execute ${config_guess}")
|
||||
endif( NOT TT_RV EQUAL 0 )
|
||||
set( value ${TT_OUT} )
|
||||
endif( MSVC )
|
||||
set( ${var} ${value} PARENT_SCOPE )
|
||||
message(STATUS "Target triple: ${value}")
|
||||
endfunction( get_target_triple var )
|
@ -1,129 +0,0 @@
|
||||
function(get_system_libs return_var)
|
||||
# Returns in `return_var' a list of system libraries used by LLVM.
|
||||
if( NOT MSVC )
|
||||
if( MINGW )
|
||||
set(system_libs ${system_libs} imagehlp psapi)
|
||||
elseif( CMAKE_HOST_UNIX )
|
||||
if( HAVE_LIBDL )
|
||||
set(system_libs ${system_libs} ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD )
|
||||
set(system_libs ${system_libs} pthread)
|
||||
endif()
|
||||
endif( MINGW )
|
||||
endif( NOT MSVC )
|
||||
set(${return_var} ${system_libs} PARENT_SCOPE)
|
||||
endfunction(get_system_libs)
|
||||
|
||||
|
||||
macro(llvm_config executable)
|
||||
explicit_llvm_config(${executable} ${ARGN})
|
||||
endmacro(llvm_config)
|
||||
|
||||
|
||||
function(explicit_llvm_config executable)
|
||||
set( link_components ${ARGN} )
|
||||
|
||||
explicit_map_components_to_libraries(LIBRARIES ${link_components})
|
||||
target_link_libraries(${executable} ${LIBRARIES})
|
||||
endfunction(explicit_llvm_config)
|
||||
|
||||
|
||||
function(explicit_map_components_to_libraries out_libs)
|
||||
set( link_components ${ARGN} )
|
||||
foreach(c ${link_components})
|
||||
# add codegen, asmprinter, asmparser, disassembler
|
||||
list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
|
||||
if( NOT idx LESS 0 )
|
||||
list(FIND llvm_libs "LLVM${c}CodeGen" idx)
|
||||
if( NOT idx LESS 0 )
|
||||
list(APPEND expanded_components "LLVM${c}CodeGen")
|
||||
else()
|
||||
list(FIND llvm_libs "LLVM${c}" idx)
|
||||
if( NOT idx LESS 0 )
|
||||
list(APPEND expanded_components "LLVM${c}")
|
||||
else()
|
||||
message(FATAL_ERROR "Target ${c} is not in the set of libraries.")
|
||||
endif()
|
||||
endif()
|
||||
list(FIND llvm_libs "LLVM${c}AsmPrinter" asmidx)
|
||||
if( NOT asmidx LESS 0 )
|
||||
list(APPEND expanded_components "LLVM${c}AsmPrinter")
|
||||
endif()
|
||||
list(FIND llvm_libs "LLVM${c}AsmParser" asmidx)
|
||||
if( NOT asmidx LESS 0 )
|
||||
list(APPEND expanded_components "LLVM${c}AsmParser")
|
||||
endif()
|
||||
list(FIND llvm_libs "LLVM${c}Info" asmidx)
|
||||
if( NOT asmidx LESS 0 )
|
||||
list(APPEND expanded_components "LLVM${c}Info")
|
||||
endif()
|
||||
list(FIND llvm_libs "LLVM${c}Disassembler" asmidx)
|
||||
if( NOT asmidx LESS 0 )
|
||||
list(APPEND expanded_components "LLVM${c}Disassembler")
|
||||
endif()
|
||||
elseif( c STREQUAL "native" )
|
||||
list(APPEND expanded_components "LLVM${LLVM_NATIVE_ARCH}CodeGen")
|
||||
elseif( c STREQUAL "nativecodegen" )
|
||||
list(APPEND expanded_components "LLVM${LLVM_NATIVE_ARCH}CodeGen")
|
||||
elseif( c STREQUAL "backend" )
|
||||
# same case as in `native'.
|
||||
elseif( c STREQUAL "engine" )
|
||||
# TODO: as we assume we are on X86, this is `jit'.
|
||||
list(APPEND expanded_components "LLVMJIT")
|
||||
elseif( c STREQUAL "all" )
|
||||
list(APPEND expanded_components ${llvm_libs})
|
||||
else( NOT idx LESS 0 )
|
||||
list(APPEND expanded_components LLVM${c})
|
||||
endif( NOT idx LESS 0 )
|
||||
endforeach(c)
|
||||
# We must match capitalization.
|
||||
string(TOUPPER "${llvm_libs}" capitalized_libs)
|
||||
list(REMOVE_DUPLICATES expanded_components)
|
||||
list(LENGTH expanded_components lst_size)
|
||||
set(result "")
|
||||
while( 0 LESS ${lst_size} )
|
||||
list(GET expanded_components 0 c)
|
||||
string(TOUPPER "${c}" capitalized)
|
||||
list(FIND capitalized_libs ${capitalized} idx)
|
||||
if( idx LESS 0 )
|
||||
message(FATAL_ERROR "Library ${c} not found in list of llvm libraries.")
|
||||
endif( idx LESS 0 )
|
||||
list(GET llvm_libs ${idx} canonical_lib)
|
||||
list(REMOVE_ITEM result ${canonical_lib})
|
||||
list(APPEND result ${canonical_lib})
|
||||
foreach(c ${MSVC_LIB_DEPS_${canonical_lib}})
|
||||
list(REMOVE_ITEM expanded_components ${c})
|
||||
endforeach()
|
||||
list(APPEND expanded_components ${MSVC_LIB_DEPS_${canonical_lib}})
|
||||
list(REMOVE_AT expanded_components 0)
|
||||
list(LENGTH expanded_components lst_size)
|
||||
endwhile( 0 LESS ${lst_size} )
|
||||
set(${out_libs} ${result} PARENT_SCOPE)
|
||||
endfunction(explicit_map_components_to_libraries)
|
||||
|
||||
|
||||
# The library dependency data is contained in the file
|
||||
# LLVMLibDeps.cmake on this directory. It is automatically generated
|
||||
# by tools/llvm-config/CMakeLists.txt when the build comprises all the
|
||||
# targets and we are on a environment Posix enough to build the
|
||||
# llvm-config script. This, in practice, just excludes MSVC.
|
||||
|
||||
# When you remove or rename a library from the build, be sure to
|
||||
# remove its file from lib/ as well, or the GenLibDeps.pl script will
|
||||
# include it on its analysis!
|
||||
|
||||
# The format generated by GenLibDeps.pl
|
||||
|
||||
# LLVMARMAsmPrinter.o: LLVMARMCodeGen.o libLLVMAsmPrinter.a libLLVMCodeGen.a libLLVMCore.a libLLVMSupport.a libLLVMTarget.a
|
||||
|
||||
# is translated to:
|
||||
|
||||
# set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMSupport LLVMTarget)
|
||||
|
||||
# It is necessary to remove the `lib' prefix and the `.a'.
|
||||
|
||||
# This 'sed' script should do the trick:
|
||||
# sed -e s'#\.a##g' -e 's#libLLVM#LLVM#g' -e 's#: # #' -e 's#\(.*\)#set(MSVC_LIB_DEPS_\1)#' ~/llvm/tools/llvm-config/LibDeps.txt
|
||||
|
||||
include(LLVMLibDeps)
|
@ -1,72 +0,0 @@
|
||||
set(MSVC_LIB_DEPS_LLVMARMAsmParser LLVMARMInfo LLVMMCParser LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMARMCodeGen LLVMARMInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMARMCodeGen LLVMARMInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMARMInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMAlphaAsmPrinter LLVMAlphaInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMAlphaCodeGen LLVMAlphaInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMAlphaInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMArchive LLVMBitReader LLVMCore LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMAsmParser LLVMCore LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMAsmPrinter LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMBitReader LLVMCore LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMBitWriter LLVMCore LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMBlackfinAsmPrinter LLVMAsmPrinter LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMBlackfinInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCBackend LLVMAnalysis LLVMCBackendInfo LLVMCodeGen LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils LLVMipa)
|
||||
set(MSVC_LIB_DEPS_LLVMCBackendInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCellSPUAsmPrinter LLVMAsmPrinter LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMCellSPUInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCodeGen LLVMAnalysis LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMCore LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMCppBackend LLVMCore LLVMCppBackendInfo LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMExecutionEngine LLVMCore LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMInstCombine LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMInterpreter LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMJIT LLVMAnalysis LLVMCodeGen LLVMCore LLVMExecutionEngine LLVMMC LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMLinker LLVMArchive LLVMBitReader LLVMCore LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeCodeGen LLVMCodeGen LLVMCore LLVMMBlazeInfo LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMC LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMMCParser LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMSIL LLVMAnalysis LLVMCodeGen LLVMCore LLVMMSILInfo LLVMScalarOpts LLVMSupport LLVMTarget LLVMTransformUtils LLVMipa)
|
||||
set(MSVC_LIB_DEPS_LLVMMSILInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMSP430Info LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMSP430CodeGen LLVMCodeGen LLVMCore LLVMMC LLVMMSP430Info LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMipsAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMipsCodeGen LLVMMipsInfo LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMipsCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMMipsInfo LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMipsInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMPIC16 LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMPIC16Info LLVMSelectionDAG LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMPIC16AsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPIC16 LLVMPIC16Info LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMPIC16Info LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCInfo LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMPowerPCCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCInfo LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMScalarOpts LLVMAnalysis LLVMCore LLVMInstCombine LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMSelectionDAG LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSparcAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSparcInfo LLVMSupport LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSparcCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSparcInfo LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSparcInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMSystem )
|
||||
set(MSVC_LIB_DEPS_LLVMSystemZAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystemZInfo LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSystemZCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystemZInfo LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSystemZInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMTarget LLVMCore LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMTransformUtils LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget LLVMipa)
|
||||
set(MSVC_LIB_DEPS_LLVMX86AsmParser LLVMMC LLVMMCParser LLVMSupport LLVMTarget LLVMX86Info)
|
||||
set(MSVC_LIB_DEPS_LLVMX86AsmPrinter LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget LLVMX86CodeGen LLVMX86Info)
|
||||
set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget LLVMX86Info)
|
||||
set(MSVC_LIB_DEPS_LLVMX86Disassembler LLVMMC LLVMSupport LLVMX86Info)
|
||||
set(MSVC_LIB_DEPS_LLVMX86Info LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMXCore LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMTarget LLVMXCoreInfo)
|
||||
set(MSVC_LIB_DEPS_LLVMXCoreAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMTarget LLVMXCoreInfo)
|
||||
set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMipa LLVMAnalysis LLVMCore LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMipo LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils LLVMipa)
|
@ -1,54 +0,0 @@
|
||||
include(AddFileDependencies)
|
||||
|
||||
|
||||
macro(add_td_sources srcs)
|
||||
file(GLOB tds *.td)
|
||||
if( tds )
|
||||
source_group("TableGen descriptions" FILES ${tds})
|
||||
set_source_files_properties(${tds} PROPERTIES HEADER_FILE_ONLY ON)
|
||||
list(APPEND ${srcs} ${tds})
|
||||
endif()
|
||||
endmacro(add_td_sources)
|
||||
|
||||
|
||||
macro(add_header_files srcs)
|
||||
file(GLOB hds *.h)
|
||||
if( hds )
|
||||
set_source_files_properties(${hds} PROPERTIES HEADER_FILE_ONLY ON)
|
||||
list(APPEND ${srcs} ${hds})
|
||||
endif()
|
||||
endmacro(add_header_files)
|
||||
|
||||
|
||||
function(llvm_process_sources OUT_VAR)
|
||||
set( sources ${ARGN} )
|
||||
llvm_check_source_file_list( ${sources} )
|
||||
# Create file dependencies on the tablegenned files, if any. Seems
|
||||
# that this is not strictly needed, as dependencies of the .cpp
|
||||
# sources on the tablegenned .inc files are detected and handled,
|
||||
# but just in case...
|
||||
foreach( s ${sources} )
|
||||
set( f ${CMAKE_CURRENT_SOURCE_DIR}/${s} )
|
||||
add_file_dependencies( ${f} ${TABLEGEN_OUTPUT} )
|
||||
endforeach(s)
|
||||
if( MSVC_IDE )
|
||||
# This adds .td and .h files to the Visual Studio solution:
|
||||
add_td_sources(sources)
|
||||
add_header_files(sources)
|
||||
endif()
|
||||
set( ${OUT_VAR} ${sources} PARENT_SCOPE )
|
||||
endfunction(llvm_process_sources)
|
||||
|
||||
|
||||
function(llvm_check_source_file_list)
|
||||
set(listed ${ARGN})
|
||||
file(GLOB globbed *.cpp)
|
||||
foreach(g ${globbed})
|
||||
get_filename_component(fn ${g} NAME)
|
||||
list(FIND listed ${fn} idx)
|
||||
if( idx LESS 0 )
|
||||
message(SEND_ERROR "Found unknown source file ${g}
|
||||
Please update ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt\n")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction(llvm_check_source_file_list)
|
@ -1,20 +0,0 @@
|
||||
# LLVM_TARGET_DEFINITIONS must contain the name of the .td file to process.
|
||||
# Extra parameters for `tblgen' may come after `ofn' parameter.
|
||||
# Adds the name of the generated file to TABLEGEN_OUTPUT.
|
||||
|
||||
macro(tablegen ofn)
|
||||
file(GLOB local_tds "*.td")
|
||||
file(GLOB_RECURSE global_tds "${LLVM_MAIN_SRC_DIR}/include/llvm/*.td")
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
||||
COMMAND ${LLVM_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-I ${LLVM_MAIN_SRC_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS}
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
||||
DEPENDS tblgen ${local_tds} ${global_tds}
|
||||
COMMENT "Building ${ofn}..."
|
||||
)
|
||||
set(TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR}/${ofn})
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${ofn}
|
||||
PROPERTIES GENERATED 1)
|
||||
endmacro(tablegen)
|
@ -1,11 +0,0 @@
|
||||
# Discover the projects that use CMake in the subdirectories.
|
||||
# Note that explicit cmake invocation is required every time a new project is
|
||||
# added or removed.
|
||||
file(GLOB entries *)
|
||||
foreach(entry ${entries})
|
||||
if(IS_DIRECTORY ${entry} AND EXISTS ${entry}/CMakeLists.txt)
|
||||
if(NOT ${entry} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}/compiler-rt)
|
||||
add_subdirectory(${entry})
|
||||
endif()
|
||||
endif()
|
||||
endforeach(entry)
|
@ -1,25 +0,0 @@
|
||||
##===- projects/Makefile ------------------------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
LEVEL=..
|
||||
|
||||
include $(LEVEL)/Makefile.config
|
||||
|
||||
# Compile all subdirs, except for the test suite, which lives in test-suite.
|
||||
# Before 2008.06.24 it lived in llvm-test, so exclude that as well for now.
|
||||
DIRS:= $(filter-out llvm-test test-suite,$(patsubst $(PROJ_SRC_DIR)/%/Makefile,%,$(wildcard $(PROJ_SRC_DIR)/*/Makefile)))
|
||||
|
||||
# Don't build compiler-rt either, it isn't designed to be built directly.
|
||||
DIRS := $(filter-out compiler-rt,$(DIRS))
|
||||
|
||||
# Sparc cannot link shared libraries (libtool problem?)
|
||||
ifeq ($(ARCH), Sparc)
|
||||
DIRS := $(filter-out sample, $(DIRS))
|
||||
endif
|
||||
|
||||
include $(PROJ_SRC_ROOT)/Makefile.rules
|
@ -1,18 +0,0 @@
|
||||
##===- projects/sample/Makefile ----------------------------*- Makefile -*-===##
|
||||
#
|
||||
# This is a sample Makefile for a project that uses LLVM.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
#
|
||||
# Indicates our relative path to the top of the project's root directory.
|
||||
#
|
||||
LEVEL = .
|
||||
DIRS = lib tools
|
||||
EXTRA_DIST = include
|
||||
|
||||
#
|
||||
# Include the Master Makefile that knows how to build all.
|
||||
#
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
@ -1,22 +0,0 @@
|
||||
# Set the name of the project here
|
||||
PROJECT_NAME := sample
|
||||
PROJ_VERSION := 0.9
|
||||
|
||||
# Set this variable to the top of the LLVM source tree.
|
||||
LLVM_SRC_ROOT = @LLVM_SRC@
|
||||
|
||||
# Set this variable to the top level directory where LLVM was built
|
||||
# (this is *not* the same as OBJ_ROOT as defined in LLVM's Makefile.config).
|
||||
LLVM_OBJ_ROOT = @LLVM_OBJ@
|
||||
|
||||
# Set the directory root of this project's source files
|
||||
PROJ_SRC_ROOT := $(subst //,/,@abs_top_srcdir@)
|
||||
|
||||
# Set the root directory of this project's object files
|
||||
PROJ_OBJ_ROOT := $(subst //,/,@abs_top_objdir@)
|
||||
|
||||
# Set the root directory of this project's install prefix
|
||||
PROJ_INSTALL_ROOT := @prefix@
|
||||
|
||||
# Include LLVM's Master Makefile.
|
||||
include $(LLVM_SRC_ROOT)/Makefile.common
|
@ -1,52 +0,0 @@
|
||||
#!/bin/sh
|
||||
die () {
|
||||
echo "$@" 1>&2
|
||||
exit 1
|
||||
}
|
||||
test -d autoconf && test -f autoconf/configure.ac && cd autoconf
|
||||
test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first"
|
||||
autoconf --version | egrep '2\.[56][0-9]' > /dev/null
|
||||
if test $? -ne 0 ; then
|
||||
die "Your autoconf was not detected as being 2.5x or 2.6x"
|
||||
fi
|
||||
cwd=`pwd`
|
||||
if test -d ../../../autoconf/m4 ; then
|
||||
cd ../../../autoconf/m4
|
||||
llvm_m4=`pwd`
|
||||
llvm_src_root=../../..
|
||||
llvm_obj_root=../../..
|
||||
cd $cwd
|
||||
elif test -d ../../llvm/autoconf/m4 ; then
|
||||
cd ../../llvm/autoconf/m4
|
||||
llvm_m4=`pwd`
|
||||
llvm_src_root=../..
|
||||
llvm_obj_root=../..
|
||||
cd $cwd
|
||||
else
|
||||
while true ; do
|
||||
echo "LLVM source root not found."
|
||||
read -p "Enter full path to LLVM source:" REPLY
|
||||
if test -d "$REPLY/autoconf/m4" ; then
|
||||
llvm_src_root="$REPLY"
|
||||
llvm_m4="$REPLY/autoconf/m4"
|
||||
read -p "Enter full path to LLVM objects (empty for same as source):" REPLY
|
||||
if test -d "$REPLY" ; then
|
||||
llvm_obj_root="$REPLY"
|
||||
else
|
||||
llvm_obj_root="$llvm_src_root"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
# Patch the LLVM_ROOT in configure.ac, if it needs it
|
||||
cp configure.ac configure.bak
|
||||
sed -e "s#^LLVM_SRC_ROOT=.*#LLVM_SRC_ROOT=\"$llvm_src_root\"#" \
|
||||
-e "s#^LLVM_OBJ_ROOT=.*#LLVM_OBJ_ROOT=\"$llvm_obj_root\"#" configure.bak > configure.ac
|
||||
echo "Regenerating aclocal.m4 with aclocal"
|
||||
rm -f aclocal.m4
|
||||
aclocal -I $llvm_m4 -I "$llvm_m4/.." || die "aclocal failed"
|
||||
echo "Regenerating configure with autoconf"
|
||||
autoconf --warnings=all -o ../configure configure.ac || die "autoconf failed"
|
||||
cd ..
|
||||
exit 0
|
@ -1,24 +0,0 @@
|
||||
------------------------------------------------------------------------------
|
||||
Autoconf Files
|
||||
------------------------------------------------------------------------------
|
||||
All autoconf files are licensed under the LLVM license with the following
|
||||
additions:
|
||||
|
||||
llvm/autoconf/install-sh:
|
||||
This script is licensed under the LLVM license, with the following
|
||||
additional copyrights and restrictions:
|
||||
|
||||
Copyright 1991 by the Massachusetts Institute of Technology
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation, and that the name of M.I.T. not be used in advertising or
|
||||
publicity pertaining to distribution of the software without specific,
|
||||
written prior permission. M.I.T. makes no representations about the
|
||||
suitability of this software for any purpose. It is provided "as is"
|
||||
without express or implied warranty.
|
||||
|
||||
Please see the source files for additional copyrights.
|
||||
|
1388
contrib/llvm/projects/sample/autoconf/config.guess
vendored
1388
contrib/llvm/projects/sample/autoconf/config.guess
vendored
File diff suppressed because it is too large
Load Diff
1489
contrib/llvm/projects/sample/autoconf/config.sub
vendored
1489
contrib/llvm/projects/sample/autoconf/config.sub
vendored
File diff suppressed because it is too large
Load Diff
@ -1,69 +0,0 @@
|
||||
dnl **************************************************************************
|
||||
dnl * Initialize
|
||||
dnl **************************************************************************
|
||||
AC_INIT([[[SAMPLE]]],[[[x.xx]]],[bugs@yourdomain])
|
||||
|
||||
dnl Identify where LLVM source tree is
|
||||
LLVM_SRC_ROOT="../../"
|
||||
LLVM_OBJ_ROOT="../../"
|
||||
|
||||
dnl Tell autoconf that this is an LLVM project being configured
|
||||
dnl This provides the --with-llvmsrc and --with-llvmobj options
|
||||
LLVM_CONFIG_PROJECT($LLVM_SRC_ROOT,$LLVM_OBJ_ROOT)
|
||||
|
||||
dnl Tell autoconf that the auxilliary files are actually located in
|
||||
dnl the LLVM autoconf directory, not here.
|
||||
AC_CONFIG_AUX_DIR($LLVM_SRC/autoconf)
|
||||
|
||||
dnl Verify that the source directory is valid
|
||||
AC_CONFIG_SRCDIR(["Makefile.common.in"])
|
||||
|
||||
dnl Configure a common Makefile
|
||||
AC_CONFIG_FILES(Makefile.common)
|
||||
|
||||
dnl Configure project makefiles
|
||||
dnl List every Makefile that exists within your source tree
|
||||
AC_CONFIG_MAKEFILE(Makefile)
|
||||
AC_CONFIG_MAKEFILE(lib/Makefile)
|
||||
AC_CONFIG_MAKEFILE(lib/sample/Makefile)
|
||||
AC_CONFIG_MAKEFILE(tools/Makefile)
|
||||
AC_CONFIG_MAKEFILE(tools/sample/Makefile)
|
||||
|
||||
dnl **************************************************************************
|
||||
dnl * Determine which system we are building on
|
||||
dnl **************************************************************************
|
||||
|
||||
dnl **************************************************************************
|
||||
dnl * Check for programs.
|
||||
dnl **************************************************************************
|
||||
|
||||
dnl **************************************************************************
|
||||
dnl * Check for libraries.
|
||||
dnl **************************************************************************
|
||||
|
||||
dnl **************************************************************************
|
||||
dnl * Checks for header files.
|
||||
dnl **************************************************************************
|
||||
|
||||
dnl **************************************************************************
|
||||
dnl * Checks for typedefs, structures, and compiler characteristics.
|
||||
dnl **************************************************************************
|
||||
|
||||
dnl **************************************************************************
|
||||
dnl * Checks for library functions.
|
||||
dnl **************************************************************************
|
||||
|
||||
dnl **************************************************************************
|
||||
dnl * Enable various compile-time options
|
||||
dnl **************************************************************************
|
||||
|
||||
dnl **************************************************************************
|
||||
dnl * Set the location of various third-party software packages
|
||||
dnl **************************************************************************
|
||||
|
||||
dnl **************************************************************************
|
||||
dnl * Create the output files
|
||||
dnl **************************************************************************
|
||||
|
||||
dnl This must be last
|
||||
AC_OUTPUT
|
2365
contrib/llvm/projects/sample/configure
vendored
2365
contrib/llvm/projects/sample/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>SAMPLE PROJECT DOCUMENTATION</h1>
|
||||
<p>This is just a placeholder</p>
|
||||
</body>
|
||||
</html>
|
@ -1,8 +0,0 @@
|
||||
/*
|
||||
* File: sample.h
|
||||
*
|
||||
* This is a sample header file that is global to the entire project.
|
||||
* It is located here so that everyone will find it.
|
||||
*/
|
||||
extern int compute_sample (int a);
|
||||
|
@ -1,13 +0,0 @@
|
||||
##===- projects/sample/lib/Makefile ------------------------*- Makefile -*-===##
|
||||
|
||||
#
|
||||
# Relative path to the top of the source tree.
|
||||
#
|
||||
LEVEL=..
|
||||
|
||||
#
|
||||
# List all of the subdirectories that we will compile.
|
||||
#
|
||||
DIRS=sample
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
@ -1,16 +0,0 @@
|
||||
##===- projects/sample/lib/sample/Makefile -----------------*- Makefile -*-===##
|
||||
|
||||
#
|
||||
# Indicate where we are relative to the top of the source tree.
|
||||
#
|
||||
LEVEL=../..
|
||||
|
||||
#
|
||||
# Give the name of a library. This will build a dynamic version.
|
||||
#
|
||||
LIBRARYNAME=sample
|
||||
|
||||
#
|
||||
# Include Makefile.common so we know what to do.
|
||||
#
|
||||
include $(LEVEL)/Makefile.common
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* File: sample.c
|
||||
*
|
||||
* Description:
|
||||
* This is a sample source file for a library. It helps to demonstrate
|
||||
* how to setup a project that uses the LLVM build system, header files,
|
||||
* and libraries.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* LLVM Header File
|
||||
#include "llvm/System/DataTypes.h"
|
||||
*/
|
||||
|
||||
/* Header file global to this project */
|
||||
#include "sample.h"
|
||||
|
||||
int
|
||||
compute_sample (int a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
##===- projects/sample/tools/Makefile ----------------------*- Makefile -*-===##
|
||||
|
||||
#
|
||||
# Relative path to the top of the source tree.
|
||||
#
|
||||
LEVEL=..
|
||||
|
||||
#
|
||||
# List all of the subdirectories that we will compile.
|
||||
#
|
||||
DIRS=sample
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
@ -1,23 +0,0 @@
|
||||
##===- projects/sample/tools/sample/Makefile ---------------*- Makefile -*-===##
|
||||
|
||||
#
|
||||
# Indicate where we are relative to the top of the source tree.
|
||||
#
|
||||
LEVEL=../..
|
||||
|
||||
#
|
||||
# Give the name of the tool.
|
||||
#
|
||||
TOOLNAME=Sample
|
||||
|
||||
#
|
||||
# List libraries that we'll need
|
||||
# We use LIBS because sample is a dynamic library.
|
||||
#
|
||||
USEDLIBS = sample.a
|
||||
|
||||
#
|
||||
# Include Makefile.common so we know what to do.
|
||||
#
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
@ -1,14 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "sample.h"
|
||||
|
||||
int
|
||||
main (int argc, char ** argv)
|
||||
{
|
||||
printf ("%d\n", compute_sample (5));
|
||||
exit (0);
|
||||
}
|
||||
|
@ -1,2 +0,0 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
@ -1,51 +0,0 @@
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <cerrno>
|
||||
#include <cfloat>
|
||||
#include <ciso646>
|
||||
#include <climits>
|
||||
#include <clocale>
|
||||
#include <cmath>
|
||||
#include <complex>
|
||||
#include <csetjmp>
|
||||
#include <csignal>
|
||||
#include <cstdarg>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <cwchar>
|
||||
#include <cwctype>
|
||||
#include <deque>
|
||||
#include <exception>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
#include <iosfwd>
|
||||
#include <iostream>
|
||||
#include <istream>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <list>
|
||||
#include <locale>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <numeric>
|
||||
#include <ostream>
|
||||
#include <queue>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <stack>
|
||||
#include <stdexcept>
|
||||
#include <streambuf>
|
||||
#include <string>
|
||||
#include <strstream>
|
||||
#include <typeinfo>
|
||||
#include <utility>
|
||||
#include <valarray>
|
||||
#include <vector>
|
@ -1,639 +0,0 @@
|
||||
/* Test for integer constant types. */
|
||||
|
||||
/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
/* Assertion that constant C is of type T. */
|
||||
#define ASSERT_CONST_TYPE(C, T) \
|
||||
do { \
|
||||
typedef T type; \
|
||||
typedef type **typepp; \
|
||||
typedef __typeof__((C)) ctype; \
|
||||
typedef ctype **ctypepp; \
|
||||
typepp x = 0; \
|
||||
ctypepp y = 0; \
|
||||
x = y; \
|
||||
y = x; \
|
||||
} while (0)
|
||||
|
||||
/* (T *) if E is zero, (void *) otherwise. */
|
||||
#define type_if_not(T, E) __typeof__(0 ? (T *)0 : (void *)(E))
|
||||
|
||||
/* (T *) if E is nonzero, (void *) otherwise. */
|
||||
#define type_if(T, E) type_if_not(T, !(E))
|
||||
|
||||
/* Combine pointer types, all but one (void *). */
|
||||
#define type_comb2(T1, T2) __typeof__(0 ? (T1)0 : (T2)0)
|
||||
#define type_comb3(T1, T2, T3) type_comb2(T1, type_comb2(T2, T3))
|
||||
#define type_comb4(T1, T2, T3, T4) \
|
||||
type_comb2(T1, type_comb2(T2, type_comb2(T3, T4)))
|
||||
#define type_comb6(T1, T2, T3, T4, T5, T6) \
|
||||
type_comb2(T1, \
|
||||
type_comb2(T2, \
|
||||
type_comb2(T3, \
|
||||
type_comb2(T4, \
|
||||
type_comb2(T5, T6)))))
|
||||
|
||||
/* (T1 *) if E1, otherwise (T2 *) if E2. */
|
||||
#define first_of2p(T1, E1, T2, E2) type_comb2(type_if(T1, (E1)), \
|
||||
type_if(T2, (!(E1) && (E2))))
|
||||
/* (T1 *) if E1, otherwise (T2 *) if E2, otherwise (T3 *) if E3. */
|
||||
#define first_of3p(T1, E1, T2, E2, T3, E3) \
|
||||
type_comb3(type_if(T1, (E1)), \
|
||||
type_if(T2, (!(E1) && (E2))), \
|
||||
type_if(T3, (!(E1) && !(E2) && (E3))))
|
||||
/* (T1 *) if E1, otherwise (T2 *) if E2, otherwise (T3 *) if E3, otherwise
|
||||
(T4 *) if E4. */
|
||||
#define first_of4p(T1, E1, T2, E2, T3, E3, T4, E4) \
|
||||
type_comb4(type_if(T1, (E1)), \
|
||||
type_if(T2, (!(E1) && (E2))), \
|
||||
type_if(T3, (!(E1) && !(E2) && (E3))), \
|
||||
type_if(T4, (!(E1) && !(E2) && !(E3) && (E4))))
|
||||
/* (T1 *) if E1, otherwise (T2 *) if E2, otherwise (T3 *) if E3, otherwise
|
||||
(T4 *) if E4, otherwise (T5 *) if E5, otherwise (T6 *) if E6. */
|
||||
#define first_of6p(T1, E1, T2, E2, T3, E3, T4, E4, T5, E5, T6, E6) \
|
||||
type_comb6(type_if(T1, (E1)), \
|
||||
type_if(T2, (!(E1) && (E2))), \
|
||||
type_if(T3, (!(E1) && !(E2) && (E3))), \
|
||||
type_if(T4, (!(E1) && !(E2) && !(E3) && (E4))), \
|
||||
type_if(T5, (!(E1) && !(E2) && !(E3) && !(E4) && (E5))), \
|
||||
type_if(T6, (!(E1) && !(E2) && !(E3) \
|
||||
&& !(E4) && !(E5) && (E6))))
|
||||
|
||||
/* Likewise, but return the original type rather than a pointer type. */
|
||||
#define first_of2(T1, E1, T2, E2) \
|
||||
__typeof__(*((first_of2p(T1, (E1), T2, (E2)))0))
|
||||
#define first_of3(T1, E1, T2, E2, T3, E3) \
|
||||
__typeof__(*((first_of3p(T1, (E1), T2, (E2), T3, (E3)))0))
|
||||
#define first_of4(T1, E1, T2, E2, T3, E3, T4, E4) \
|
||||
__typeof__(*((first_of4p(T1, (E1), T2, (E2), T3, (E3), T4, (E4)))0))
|
||||
#define first_of6(T1, E1, T2, E2, T3, E3, T4, E4, T5, E5, T6, E6) \
|
||||
__typeof__(*((first_of6p(T1, (E1), T2, (E2), T3, (E3), \
|
||||
T4, (E4), T5, (E5), T6, (E6)))0))
|
||||
|
||||
/* Types of constants according to the C99 rules. */
|
||||
#define C99_UNSUF_DEC_TYPE(C) \
|
||||
first_of3(int, (C) <= INT_MAX, \
|
||||
long int, (C) <= LONG_MAX, \
|
||||
long long int, (C) <= LLONG_MAX)
|
||||
#define C99_UNSUF_OCTHEX_TYPE(C) \
|
||||
first_of6(int, (C) <= INT_MAX, \
|
||||
unsigned int, (C) <= UINT_MAX, \
|
||||
long int, (C) <= LONG_MAX, \
|
||||
unsigned long int, (C) <= ULONG_MAX, \
|
||||
long long int, (C) <= LLONG_MAX, \
|
||||
unsigned long long int, (C) <= ULLONG_MAX)
|
||||
#define C99_SUFu_TYPE(C) \
|
||||
first_of3(unsigned int, (C) <= UINT_MAX, \
|
||||
unsigned long int, (C) <= ULONG_MAX, \
|
||||
unsigned long long int, (C) <= ULLONG_MAX)
|
||||
#define C99_SUFl_DEC_TYPE(C) \
|
||||
first_of2(long int, (C) <= LONG_MAX, \
|
||||
long long int, (C) <= LLONG_MAX)
|
||||
#define C99_SUFl_OCTHEX_TYPE(C) \
|
||||
first_of4(long int, (C) <= LONG_MAX, \
|
||||
unsigned long int, (C) <= ULONG_MAX, \
|
||||
long long int, (C) <= LLONG_MAX, \
|
||||
unsigned long long int, (C) <= ULLONG_MAX)
|
||||
#define C99_SUFul_TYPE(C) \
|
||||
first_of2(unsigned long int, (C) <= ULONG_MAX, \
|
||||
unsigned long long int, (C) <= ULLONG_MAX)
|
||||
#define C99_SUFll_OCTHEX_TYPE(C) \
|
||||
first_of2(long long int, (C) <= LLONG_MAX, \
|
||||
unsigned long long int, (C) <= ULLONG_MAX)
|
||||
|
||||
/* Checks that constants have correct type. */
|
||||
#define CHECK_UNSUF_DEC_TYPE(C) ASSERT_CONST_TYPE((C), C99_UNSUF_DEC_TYPE((C)))
|
||||
#define CHECK_UNSUF_OCTHEX_TYPE(C) \
|
||||
ASSERT_CONST_TYPE((C), C99_UNSUF_OCTHEX_TYPE((C)))
|
||||
#define CHECK_SUFu_TYPE(C) ASSERT_CONST_TYPE((C), C99_SUFu_TYPE((C)))
|
||||
#define CHECK_SUFl_DEC_TYPE(C) ASSERT_CONST_TYPE((C), C99_SUFl_DEC_TYPE((C)))
|
||||
#define CHECK_SUFl_OCTHEX_TYPE(C) \
|
||||
ASSERT_CONST_TYPE((C), C99_SUFl_OCTHEX_TYPE((C)))
|
||||
#define CHECK_SUFul_TYPE(C) ASSERT_CONST_TYPE((C), C99_SUFul_TYPE((C)))
|
||||
#define CHECK_SUFll_DEC_TYPE(C) ASSERT_CONST_TYPE((C), long long int)
|
||||
#define CHECK_SUFll_OCTHEX_TYPE(C) \
|
||||
ASSERT_CONST_TYPE((C), C99_SUFll_OCTHEX_TYPE((C)))
|
||||
#define CHECK_SUFull_TYPE(C) ASSERT_CONST_TYPE((C), unsigned long long int)
|
||||
|
||||
/* Check a decimal value, with all suffixes. */
|
||||
#define CHECK_DEC_CONST(C) \
|
||||
CHECK_UNSUF_DEC_TYPE(C); \
|
||||
CHECK_SUFu_TYPE(C##u); \
|
||||
CHECK_SUFu_TYPE(C##U); \
|
||||
CHECK_SUFl_DEC_TYPE(C##l); \
|
||||
CHECK_SUFl_DEC_TYPE(C##L); \
|
||||
CHECK_SUFul_TYPE(C##ul); \
|
||||
CHECK_SUFul_TYPE(C##uL); \
|
||||
CHECK_SUFul_TYPE(C##Ul); \
|
||||
CHECK_SUFul_TYPE(C##UL); \
|
||||
CHECK_SUFll_DEC_TYPE(C##ll); \
|
||||
CHECK_SUFll_DEC_TYPE(C##LL); \
|
||||
CHECK_SUFull_TYPE(C##ull); \
|
||||
CHECK_SUFull_TYPE(C##uLL); \
|
||||
CHECK_SUFull_TYPE(C##Ull); \
|
||||
CHECK_SUFull_TYPE(C##ULL);
|
||||
|
||||
/* Check an octal or hexadecimal value, with all suffixes. */
|
||||
#define CHECK_OCTHEX_CONST(C) \
|
||||
CHECK_UNSUF_OCTHEX_TYPE(C); \
|
||||
CHECK_SUFu_TYPE(C##u); \
|
||||
CHECK_SUFu_TYPE(C##U); \
|
||||
CHECK_SUFl_OCTHEX_TYPE(C##l); \
|
||||
CHECK_SUFl_OCTHEX_TYPE(C##L); \
|
||||
CHECK_SUFul_TYPE(C##ul); \
|
||||
CHECK_SUFul_TYPE(C##uL); \
|
||||
CHECK_SUFul_TYPE(C##Ul); \
|
||||
CHECK_SUFul_TYPE(C##UL); \
|
||||
CHECK_SUFll_OCTHEX_TYPE(C##ll); \
|
||||
CHECK_SUFll_OCTHEX_TYPE(C##LL); \
|
||||
CHECK_SUFull_TYPE(C##ull); \
|
||||
CHECK_SUFull_TYPE(C##uLL); \
|
||||
CHECK_SUFull_TYPE(C##Ull); \
|
||||
CHECK_SUFull_TYPE(C##ULL);
|
||||
|
||||
#define CHECK_OCT_CONST(C) CHECK_OCTHEX_CONST(C)
|
||||
#define CHECK_HEX_CONST(C) \
|
||||
CHECK_OCTHEX_CONST(0x##C); \
|
||||
CHECK_OCTHEX_CONST(0X##C);
|
||||
|
||||
/* True iff "long long" is at least B bits. This presumes that (B-2)/3 is at
|
||||
most 63. */
|
||||
#define LLONG_AT_LEAST(B) \
|
||||
(LLONG_MAX >> ((B)-2)/3 >> ((B)-2)/3 \
|
||||
>> ((B)-2 - ((B)-2)/3 - ((B)-2)/3))
|
||||
|
||||
#define LLONG_HAS_BITS(B) (LLONG_AT_LEAST((B)) && !LLONG_AT_LEAST((B) + 1))
|
||||
|
||||
void
|
||||
foo (void)
|
||||
{
|
||||
/* Decimal. */
|
||||
/* Check all 2^n and 2^n - 1 up to 2^71 - 1. */
|
||||
CHECK_DEC_CONST(1);
|
||||
CHECK_DEC_CONST(2);
|
||||
CHECK_DEC_CONST(3);
|
||||
CHECK_DEC_CONST(4);
|
||||
CHECK_DEC_CONST(7);
|
||||
CHECK_DEC_CONST(8);
|
||||
CHECK_DEC_CONST(15);
|
||||
CHECK_DEC_CONST(16);
|
||||
CHECK_DEC_CONST(31);
|
||||
CHECK_DEC_CONST(32);
|
||||
CHECK_DEC_CONST(63);
|
||||
CHECK_DEC_CONST(64);
|
||||
CHECK_DEC_CONST(127);
|
||||
CHECK_DEC_CONST(128);
|
||||
CHECK_DEC_CONST(255);
|
||||
CHECK_DEC_CONST(256);
|
||||
CHECK_DEC_CONST(511);
|
||||
CHECK_DEC_CONST(512);
|
||||
CHECK_DEC_CONST(1023);
|
||||
CHECK_DEC_CONST(1024);
|
||||
CHECK_DEC_CONST(2047);
|
||||
CHECK_DEC_CONST(2048);
|
||||
CHECK_DEC_CONST(4095);
|
||||
CHECK_DEC_CONST(4096);
|
||||
CHECK_DEC_CONST(8191);
|
||||
CHECK_DEC_CONST(8192);
|
||||
CHECK_DEC_CONST(16383);
|
||||
CHECK_DEC_CONST(16384);
|
||||
CHECK_DEC_CONST(32767);
|
||||
CHECK_DEC_CONST(32768);
|
||||
CHECK_DEC_CONST(65535);
|
||||
CHECK_DEC_CONST(65536);
|
||||
CHECK_DEC_CONST(131071);
|
||||
CHECK_DEC_CONST(131072);
|
||||
CHECK_DEC_CONST(262143);
|
||||
CHECK_DEC_CONST(262144);
|
||||
CHECK_DEC_CONST(524287);
|
||||
CHECK_DEC_CONST(524288);
|
||||
CHECK_DEC_CONST(1048575);
|
||||
CHECK_DEC_CONST(1048576);
|
||||
CHECK_DEC_CONST(2097151);
|
||||
CHECK_DEC_CONST(2097152);
|
||||
CHECK_DEC_CONST(4194303);
|
||||
CHECK_DEC_CONST(4194304);
|
||||
CHECK_DEC_CONST(8388607);
|
||||
CHECK_DEC_CONST(8388608);
|
||||
CHECK_DEC_CONST(16777215);
|
||||
CHECK_DEC_CONST(16777216);
|
||||
CHECK_DEC_CONST(33554431);
|
||||
CHECK_DEC_CONST(33554432);
|
||||
CHECK_DEC_CONST(67108863);
|
||||
CHECK_DEC_CONST(67108864);
|
||||
CHECK_DEC_CONST(134217727);
|
||||
CHECK_DEC_CONST(134217728);
|
||||
CHECK_DEC_CONST(268435455);
|
||||
CHECK_DEC_CONST(268435456);
|
||||
CHECK_DEC_CONST(536870911);
|
||||
CHECK_DEC_CONST(536870912);
|
||||
CHECK_DEC_CONST(1073741823);
|
||||
CHECK_DEC_CONST(1073741824);
|
||||
CHECK_DEC_CONST(2147483647);
|
||||
CHECK_DEC_CONST(2147483648);
|
||||
CHECK_DEC_CONST(4294967295);
|
||||
CHECK_DEC_CONST(4294967296);
|
||||
CHECK_DEC_CONST(8589934591);
|
||||
CHECK_DEC_CONST(8589934592);
|
||||
CHECK_DEC_CONST(17179869183);
|
||||
CHECK_DEC_CONST(17179869184);
|
||||
CHECK_DEC_CONST(34359738367);
|
||||
CHECK_DEC_CONST(34359738368);
|
||||
CHECK_DEC_CONST(68719476735);
|
||||
CHECK_DEC_CONST(68719476736);
|
||||
CHECK_DEC_CONST(137438953471);
|
||||
CHECK_DEC_CONST(137438953472);
|
||||
CHECK_DEC_CONST(274877906943);
|
||||
CHECK_DEC_CONST(274877906944);
|
||||
CHECK_DEC_CONST(549755813887);
|
||||
CHECK_DEC_CONST(549755813888);
|
||||
CHECK_DEC_CONST(1099511627775);
|
||||
CHECK_DEC_CONST(1099511627776);
|
||||
CHECK_DEC_CONST(2199023255551);
|
||||
CHECK_DEC_CONST(2199023255552);
|
||||
CHECK_DEC_CONST(4398046511103);
|
||||
CHECK_DEC_CONST(4398046511104);
|
||||
CHECK_DEC_CONST(8796093022207);
|
||||
CHECK_DEC_CONST(8796093022208);
|
||||
CHECK_DEC_CONST(17592186044415);
|
||||
CHECK_DEC_CONST(17592186044416);
|
||||
CHECK_DEC_CONST(35184372088831);
|
||||
CHECK_DEC_CONST(35184372088832);
|
||||
CHECK_DEC_CONST(70368744177663);
|
||||
CHECK_DEC_CONST(70368744177664);
|
||||
CHECK_DEC_CONST(140737488355327);
|
||||
CHECK_DEC_CONST(140737488355328);
|
||||
CHECK_DEC_CONST(281474976710655);
|
||||
CHECK_DEC_CONST(281474976710656);
|
||||
CHECK_DEC_CONST(562949953421311);
|
||||
CHECK_DEC_CONST(562949953421312);
|
||||
CHECK_DEC_CONST(1125899906842623);
|
||||
CHECK_DEC_CONST(1125899906842624);
|
||||
CHECK_DEC_CONST(2251799813685247);
|
||||
CHECK_DEC_CONST(2251799813685248);
|
||||
CHECK_DEC_CONST(4503599627370495);
|
||||
CHECK_DEC_CONST(4503599627370496);
|
||||
CHECK_DEC_CONST(9007199254740991);
|
||||
CHECK_DEC_CONST(9007199254740992);
|
||||
CHECK_DEC_CONST(18014398509481983);
|
||||
CHECK_DEC_CONST(18014398509481984);
|
||||
CHECK_DEC_CONST(36028797018963967);
|
||||
CHECK_DEC_CONST(36028797018963968);
|
||||
CHECK_DEC_CONST(72057594037927935);
|
||||
CHECK_DEC_CONST(72057594037927936);
|
||||
CHECK_DEC_CONST(144115188075855871);
|
||||
CHECK_DEC_CONST(144115188075855872);
|
||||
CHECK_DEC_CONST(288230376151711743);
|
||||
CHECK_DEC_CONST(288230376151711744);
|
||||
CHECK_DEC_CONST(576460752303423487);
|
||||
CHECK_DEC_CONST(576460752303423488);
|
||||
CHECK_DEC_CONST(1152921504606846975);
|
||||
CHECK_DEC_CONST(1152921504606846976);
|
||||
CHECK_DEC_CONST(2305843009213693951);
|
||||
CHECK_DEC_CONST(2305843009213693952);
|
||||
CHECK_DEC_CONST(4611686018427387903);
|
||||
CHECK_DEC_CONST(4611686018427387904);
|
||||
CHECK_DEC_CONST(9223372036854775807);
|
||||
#if LLONG_AT_LEAST(65)
|
||||
CHECK_DEC_CONST(9223372036854775808);
|
||||
CHECK_DEC_CONST(18446744073709551615);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(66)
|
||||
CHECK_DEC_CONST(18446744073709551616);
|
||||
CHECK_DEC_CONST(36893488147419103231);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(67)
|
||||
CHECK_DEC_CONST(36893488147419103232);
|
||||
CHECK_DEC_CONST(73786976294838206463);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(68)
|
||||
CHECK_DEC_CONST(73786976294838206464);
|
||||
CHECK_DEC_CONST(147573952589676412927);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(69)
|
||||
CHECK_DEC_CONST(147573952589676412928);
|
||||
CHECK_DEC_CONST(295147905179352825855);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(70)
|
||||
CHECK_DEC_CONST(295147905179352825856);
|
||||
CHECK_DEC_CONST(590295810358705651711);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(71)
|
||||
CHECK_DEC_CONST(590295810358705651712);
|
||||
CHECK_DEC_CONST(1180591620717411303423);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(72)
|
||||
CHECK_DEC_CONST(1180591620717411303424);
|
||||
CHECK_DEC_CONST(2361183241434822606847);
|
||||
#endif
|
||||
/* Octal and hexadecimal. */
|
||||
/* Check all 2^n and 2^n - 1 up to 2^72 - 1. */
|
||||
CHECK_OCT_CONST(0);
|
||||
CHECK_HEX_CONST(0);
|
||||
CHECK_OCT_CONST(01);
|
||||
CHECK_HEX_CONST(1);
|
||||
CHECK_OCT_CONST(02);
|
||||
CHECK_HEX_CONST(2);
|
||||
CHECK_OCT_CONST(03);
|
||||
CHECK_HEX_CONST(3);
|
||||
CHECK_OCT_CONST(04);
|
||||
CHECK_HEX_CONST(4);
|
||||
CHECK_OCT_CONST(07);
|
||||
CHECK_HEX_CONST(7);
|
||||
CHECK_OCT_CONST(010);
|
||||
CHECK_HEX_CONST(8);
|
||||
CHECK_OCT_CONST(017);
|
||||
CHECK_HEX_CONST(f);
|
||||
CHECK_OCT_CONST(020);
|
||||
CHECK_HEX_CONST(10);
|
||||
CHECK_OCT_CONST(037);
|
||||
CHECK_HEX_CONST(1f);
|
||||
CHECK_OCT_CONST(040);
|
||||
CHECK_HEX_CONST(20);
|
||||
CHECK_OCT_CONST(077);
|
||||
CHECK_HEX_CONST(3f);
|
||||
CHECK_OCT_CONST(0100);
|
||||
CHECK_HEX_CONST(40);
|
||||
CHECK_OCT_CONST(0177);
|
||||
CHECK_HEX_CONST(7f);
|
||||
CHECK_OCT_CONST(0200);
|
||||
CHECK_HEX_CONST(80);
|
||||
CHECK_OCT_CONST(0377);
|
||||
CHECK_HEX_CONST(ff);
|
||||
CHECK_OCT_CONST(0400);
|
||||
CHECK_HEX_CONST(100);
|
||||
CHECK_OCT_CONST(0777);
|
||||
CHECK_HEX_CONST(1ff);
|
||||
CHECK_OCT_CONST(01000);
|
||||
CHECK_HEX_CONST(200);
|
||||
CHECK_OCT_CONST(01777);
|
||||
CHECK_HEX_CONST(3ff);
|
||||
CHECK_OCT_CONST(02000);
|
||||
CHECK_HEX_CONST(400);
|
||||
CHECK_OCT_CONST(03777);
|
||||
CHECK_HEX_CONST(7ff);
|
||||
CHECK_OCT_CONST(04000);
|
||||
CHECK_HEX_CONST(800);
|
||||
CHECK_OCT_CONST(07777);
|
||||
CHECK_HEX_CONST(fff);
|
||||
CHECK_OCT_CONST(010000);
|
||||
CHECK_HEX_CONST(1000);
|
||||
CHECK_OCT_CONST(017777);
|
||||
CHECK_HEX_CONST(1fff);
|
||||
CHECK_OCT_CONST(020000);
|
||||
CHECK_HEX_CONST(2000);
|
||||
CHECK_OCT_CONST(037777);
|
||||
CHECK_HEX_CONST(3fff);
|
||||
CHECK_OCT_CONST(040000);
|
||||
CHECK_HEX_CONST(4000);
|
||||
CHECK_OCT_CONST(077777);
|
||||
CHECK_HEX_CONST(7fff);
|
||||
CHECK_OCT_CONST(0100000);
|
||||
CHECK_HEX_CONST(8000);
|
||||
CHECK_OCT_CONST(0177777);
|
||||
CHECK_HEX_CONST(ffff);
|
||||
CHECK_OCT_CONST(0200000);
|
||||
CHECK_HEX_CONST(10000);
|
||||
CHECK_OCT_CONST(0377777);
|
||||
CHECK_HEX_CONST(1ffff);
|
||||
CHECK_OCT_CONST(0400000);
|
||||
CHECK_HEX_CONST(20000);
|
||||
CHECK_OCT_CONST(0777777);
|
||||
CHECK_HEX_CONST(3ffff);
|
||||
CHECK_OCT_CONST(01000000);
|
||||
CHECK_HEX_CONST(40000);
|
||||
CHECK_OCT_CONST(01777777);
|
||||
CHECK_HEX_CONST(7ffff);
|
||||
CHECK_OCT_CONST(02000000);
|
||||
CHECK_HEX_CONST(80000);
|
||||
CHECK_OCT_CONST(03777777);
|
||||
CHECK_HEX_CONST(fffff);
|
||||
CHECK_OCT_CONST(04000000);
|
||||
CHECK_HEX_CONST(100000);
|
||||
CHECK_OCT_CONST(07777777);
|
||||
CHECK_HEX_CONST(1fffff);
|
||||
CHECK_OCT_CONST(010000000);
|
||||
CHECK_HEX_CONST(200000);
|
||||
CHECK_OCT_CONST(017777777);
|
||||
CHECK_HEX_CONST(3fffff);
|
||||
CHECK_OCT_CONST(020000000);
|
||||
CHECK_HEX_CONST(400000);
|
||||
CHECK_OCT_CONST(037777777);
|
||||
CHECK_HEX_CONST(7fffff);
|
||||
CHECK_OCT_CONST(040000000);
|
||||
CHECK_HEX_CONST(800000);
|
||||
CHECK_OCT_CONST(077777777);
|
||||
CHECK_HEX_CONST(ffffff);
|
||||
CHECK_OCT_CONST(0100000000);
|
||||
CHECK_HEX_CONST(1000000);
|
||||
CHECK_OCT_CONST(0177777777);
|
||||
CHECK_HEX_CONST(1ffffff);
|
||||
CHECK_OCT_CONST(0200000000);
|
||||
CHECK_HEX_CONST(2000000);
|
||||
CHECK_OCT_CONST(0377777777);
|
||||
CHECK_HEX_CONST(3ffffff);
|
||||
CHECK_OCT_CONST(0400000000);
|
||||
CHECK_HEX_CONST(4000000);
|
||||
CHECK_OCT_CONST(0777777777);
|
||||
CHECK_HEX_CONST(7ffffff);
|
||||
CHECK_OCT_CONST(01000000000);
|
||||
CHECK_HEX_CONST(8000000);
|
||||
CHECK_OCT_CONST(01777777777);
|
||||
CHECK_HEX_CONST(fffffff);
|
||||
CHECK_OCT_CONST(02000000000);
|
||||
CHECK_HEX_CONST(10000000);
|
||||
CHECK_OCT_CONST(03777777777);
|
||||
CHECK_HEX_CONST(1fffffff);
|
||||
CHECK_OCT_CONST(04000000000);
|
||||
CHECK_HEX_CONST(20000000);
|
||||
CHECK_OCT_CONST(07777777777);
|
||||
CHECK_HEX_CONST(3fffffff);
|
||||
CHECK_OCT_CONST(010000000000);
|
||||
CHECK_HEX_CONST(40000000);
|
||||
CHECK_OCT_CONST(017777777777);
|
||||
CHECK_HEX_CONST(7fffffff);
|
||||
CHECK_OCT_CONST(020000000000);
|
||||
CHECK_HEX_CONST(80000000);
|
||||
CHECK_OCT_CONST(037777777777);
|
||||
CHECK_HEX_CONST(ffffffff);
|
||||
CHECK_OCT_CONST(040000000000);
|
||||
CHECK_HEX_CONST(100000000);
|
||||
CHECK_OCT_CONST(077777777777);
|
||||
CHECK_HEX_CONST(1ffffffff);
|
||||
CHECK_OCT_CONST(0100000000000);
|
||||
CHECK_HEX_CONST(200000000);
|
||||
CHECK_OCT_CONST(0177777777777);
|
||||
CHECK_HEX_CONST(3ffffffff);
|
||||
CHECK_OCT_CONST(0200000000000);
|
||||
CHECK_HEX_CONST(400000000);
|
||||
CHECK_OCT_CONST(0377777777777);
|
||||
CHECK_HEX_CONST(7ffffffff);
|
||||
CHECK_OCT_CONST(0400000000000);
|
||||
CHECK_HEX_CONST(800000000);
|
||||
CHECK_OCT_CONST(0777777777777);
|
||||
CHECK_HEX_CONST(fffffffff);
|
||||
CHECK_OCT_CONST(01000000000000);
|
||||
CHECK_HEX_CONST(1000000000);
|
||||
CHECK_OCT_CONST(01777777777777);
|
||||
CHECK_HEX_CONST(1fffffffff);
|
||||
CHECK_OCT_CONST(02000000000000);
|
||||
CHECK_HEX_CONST(2000000000);
|
||||
CHECK_OCT_CONST(03777777777777);
|
||||
CHECK_HEX_CONST(3fffffffff);
|
||||
CHECK_OCT_CONST(04000000000000);
|
||||
CHECK_HEX_CONST(4000000000);
|
||||
CHECK_OCT_CONST(07777777777777);
|
||||
CHECK_HEX_CONST(7fffffffff);
|
||||
CHECK_OCT_CONST(010000000000000);
|
||||
CHECK_HEX_CONST(8000000000);
|
||||
CHECK_OCT_CONST(017777777777777);
|
||||
CHECK_HEX_CONST(ffffffffff);
|
||||
CHECK_OCT_CONST(020000000000000);
|
||||
CHECK_HEX_CONST(10000000000);
|
||||
CHECK_OCT_CONST(037777777777777);
|
||||
CHECK_HEX_CONST(1ffffffffff);
|
||||
CHECK_OCT_CONST(040000000000000);
|
||||
CHECK_HEX_CONST(20000000000);
|
||||
CHECK_OCT_CONST(077777777777777);
|
||||
CHECK_HEX_CONST(3ffffffffff);
|
||||
CHECK_OCT_CONST(0100000000000000);
|
||||
CHECK_HEX_CONST(40000000000);
|
||||
CHECK_OCT_CONST(0177777777777777);
|
||||
CHECK_HEX_CONST(7ffffffffff);
|
||||
CHECK_OCT_CONST(0200000000000000);
|
||||
CHECK_HEX_CONST(80000000000);
|
||||
CHECK_OCT_CONST(0377777777777777);
|
||||
CHECK_HEX_CONST(fffffffffff);
|
||||
CHECK_OCT_CONST(0400000000000000);
|
||||
CHECK_HEX_CONST(100000000000);
|
||||
CHECK_OCT_CONST(0777777777777777);
|
||||
CHECK_HEX_CONST(1fffffffffff);
|
||||
CHECK_OCT_CONST(01000000000000000);
|
||||
CHECK_HEX_CONST(200000000000);
|
||||
CHECK_OCT_CONST(01777777777777777);
|
||||
CHECK_HEX_CONST(3fffffffffff);
|
||||
CHECK_OCT_CONST(02000000000000000);
|
||||
CHECK_HEX_CONST(400000000000);
|
||||
CHECK_OCT_CONST(03777777777777777);
|
||||
CHECK_HEX_CONST(7fffffffffff);
|
||||
CHECK_OCT_CONST(04000000000000000);
|
||||
CHECK_HEX_CONST(800000000000);
|
||||
CHECK_OCT_CONST(07777777777777777);
|
||||
CHECK_HEX_CONST(ffffffffffff);
|
||||
CHECK_OCT_CONST(010000000000000000);
|
||||
CHECK_HEX_CONST(1000000000000);
|
||||
CHECK_OCT_CONST(017777777777777777);
|
||||
CHECK_HEX_CONST(1ffffffffffff);
|
||||
CHECK_OCT_CONST(020000000000000000);
|
||||
CHECK_HEX_CONST(2000000000000);
|
||||
CHECK_OCT_CONST(037777777777777777);
|
||||
CHECK_HEX_CONST(3ffffffffffff);
|
||||
CHECK_OCT_CONST(040000000000000000);
|
||||
CHECK_HEX_CONST(4000000000000);
|
||||
CHECK_OCT_CONST(077777777777777777);
|
||||
CHECK_HEX_CONST(7ffffffffffff);
|
||||
CHECK_OCT_CONST(0100000000000000000);
|
||||
CHECK_HEX_CONST(8000000000000);
|
||||
CHECK_OCT_CONST(0177777777777777777);
|
||||
CHECK_HEX_CONST(fffffffffffff);
|
||||
CHECK_OCT_CONST(0200000000000000000);
|
||||
CHECK_HEX_CONST(10000000000000);
|
||||
CHECK_OCT_CONST(0377777777777777777);
|
||||
CHECK_HEX_CONST(1fffffffffffff);
|
||||
CHECK_OCT_CONST(0400000000000000000);
|
||||
CHECK_HEX_CONST(20000000000000);
|
||||
CHECK_OCT_CONST(0777777777777777777);
|
||||
CHECK_HEX_CONST(3fffffffffffff);
|
||||
CHECK_OCT_CONST(01000000000000000000);
|
||||
CHECK_HEX_CONST(40000000000000);
|
||||
CHECK_OCT_CONST(01777777777777777777);
|
||||
CHECK_HEX_CONST(7fffffffffffff);
|
||||
CHECK_OCT_CONST(02000000000000000000);
|
||||
CHECK_HEX_CONST(80000000000000);
|
||||
CHECK_OCT_CONST(03777777777777777777);
|
||||
CHECK_HEX_CONST(ffffffffffffff);
|
||||
CHECK_OCT_CONST(04000000000000000000);
|
||||
CHECK_HEX_CONST(100000000000000);
|
||||
CHECK_OCT_CONST(07777777777777777777);
|
||||
CHECK_HEX_CONST(1ffffffffffffff);
|
||||
CHECK_OCT_CONST(010000000000000000000);
|
||||
CHECK_HEX_CONST(200000000000000);
|
||||
CHECK_OCT_CONST(017777777777777777777);
|
||||
CHECK_HEX_CONST(3ffffffffffffff);
|
||||
CHECK_OCT_CONST(020000000000000000000);
|
||||
CHECK_HEX_CONST(400000000000000);
|
||||
CHECK_OCT_CONST(037777777777777777777);
|
||||
CHECK_HEX_CONST(7ffffffffffffff);
|
||||
CHECK_OCT_CONST(040000000000000000000);
|
||||
CHECK_HEX_CONST(800000000000000);
|
||||
CHECK_OCT_CONST(077777777777777777777);
|
||||
CHECK_HEX_CONST(fffffffffffffff);
|
||||
CHECK_OCT_CONST(0100000000000000000000);
|
||||
CHECK_HEX_CONST(1000000000000000);
|
||||
CHECK_OCT_CONST(0177777777777777777777);
|
||||
CHECK_HEX_CONST(1fffffffffffffff);
|
||||
CHECK_OCT_CONST(0200000000000000000000);
|
||||
CHECK_HEX_CONST(2000000000000000);
|
||||
CHECK_OCT_CONST(0377777777777777777777);
|
||||
CHECK_HEX_CONST(3fffffffffffffff);
|
||||
CHECK_OCT_CONST(0400000000000000000000);
|
||||
CHECK_HEX_CONST(4000000000000000);
|
||||
CHECK_OCT_CONST(0777777777777777777777);
|
||||
CHECK_HEX_CONST(7fffffffffffffff);
|
||||
CHECK_OCT_CONST(01000000000000000000000);
|
||||
CHECK_HEX_CONST(8000000000000000);
|
||||
CHECK_OCT_CONST(01777777777777777777777);
|
||||
CHECK_HEX_CONST(ffffffffffffffff);
|
||||
#if LLONG_AT_LEAST(65)
|
||||
CHECK_OCT_CONST(02000000000000000000000);
|
||||
CHECK_HEX_CONST(10000000000000000);
|
||||
CHECK_OCT_CONST(03777777777777777777777);
|
||||
CHECK_HEX_CONST(1ffffffffffffffff);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(66)
|
||||
CHECK_OCT_CONST(04000000000000000000000);
|
||||
CHECK_HEX_CONST(20000000000000000);
|
||||
CHECK_OCT_CONST(07777777777777777777777);
|
||||
CHECK_HEX_CONST(3ffffffffffffffff);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(67)
|
||||
CHECK_OCT_CONST(010000000000000000000000);
|
||||
CHECK_HEX_CONST(40000000000000000);
|
||||
CHECK_OCT_CONST(017777777777777777777777);
|
||||
CHECK_HEX_CONST(7ffffffffffffffff);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(68)
|
||||
CHECK_OCT_CONST(020000000000000000000000);
|
||||
CHECK_HEX_CONST(80000000000000000);
|
||||
CHECK_OCT_CONST(037777777777777777777777);
|
||||
CHECK_HEX_CONST(fffffffffffffffff);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(69)
|
||||
CHECK_OCT_CONST(040000000000000000000000);
|
||||
CHECK_HEX_CONST(100000000000000000);
|
||||
CHECK_OCT_CONST(077777777777777777777777);
|
||||
CHECK_HEX_CONST(1fffffffffffffffff);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(70)
|
||||
CHECK_OCT_CONST(0100000000000000000000000);
|
||||
CHECK_HEX_CONST(200000000000000000);
|
||||
CHECK_OCT_CONST(0177777777777777777777777);
|
||||
CHECK_HEX_CONST(3fffffffffffffffff);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(71)
|
||||
CHECK_OCT_CONST(0200000000000000000000000);
|
||||
CHECK_HEX_CONST(400000000000000000);
|
||||
CHECK_OCT_CONST(0377777777777777777777777);
|
||||
CHECK_HEX_CONST(7fffffffffffffffff);
|
||||
#endif
|
||||
#if LLONG_AT_LEAST(72)
|
||||
CHECK_OCT_CONST(0400000000000000000000000);
|
||||
CHECK_HEX_CONST(800000000000000000);
|
||||
CHECK_OCT_CONST(0777777777777777777777777);
|
||||
CHECK_HEX_CONST(ffffffffffffffffff);
|
||||
#endif
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
//#import<vecLib/vecLib.h>
|
@ -1,5 +0,0 @@
|
||||
// clang -I/usr/include/c++/4.0.0 -I/usr/include/c++/4.0.0/powerpc-apple-darwin8 -I/usr/include/c++/4.0.0/backward INPUTS/iostream.cc -Eonly
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <stdint.h>
|
@ -1,17 +0,0 @@
|
||||
|
||||
// This pounds on macro expansion for performance reasons. This is currently
|
||||
// heavily constrained by darwin's malloc.
|
||||
|
||||
// Function-like macros.
|
||||
#define A0(A, B) A B
|
||||
#define A1(A, B) A0(A,B) A0(A,B) A0(A,B) A0(A,B) A0(A,B) A0(A,B)
|
||||
#define A2(A, B) A1(A,B) A1(A,B) A1(A,B) A1(A,B) A1(A,B) A1(A,B)
|
||||
#define A3(A, B) A2(A,B) A2(A,B) A2(A,B) A2(A,B) A2(A,B) A2(A,B)
|
||||
#define A4(A, B) A3(A,B) A3(A,B) A3(A,B) A3(A,B) A3(A,B) A3(A,B)
|
||||
#define A5(A, B) A4(A,B) A4(A,B) A4(A,B) A4(A,B) A4(A,B) A4(A,B)
|
||||
#define A6(A, B) A5(A,B) A5(A,B) A5(A,B) A5(A,B) A5(A,B) A5(A,B)
|
||||
#define A7(A, B) A6(A,B) A6(A,B) A6(A,B) A6(A,B) A6(A,B) A6(A,B)
|
||||
#define A8(A, B) A7(A,B) A7(A,B) A7(A,B) A7(A,B) A7(A,B) A7(A,B)
|
||||
|
||||
A8(a, b)
|
||||
|
@ -1,16 +0,0 @@
|
||||
|
||||
// This pounds on macro expansion for performance reasons. This is currently
|
||||
// heavily constrained by darwin's malloc.
|
||||
|
||||
// Object-like expansions
|
||||
#define A0 a b
|
||||
#define A1 A0 A0 A0 A0 A0 A0
|
||||
#define A2 A1 A1 A1 A1 A1 A1
|
||||
#define A3 A2 A2 A2 A2 A2 A2
|
||||
#define A4 A3 A3 A3 A3 A3 A3
|
||||
#define A5 A4 A4 A4 A4 A4 A4
|
||||
#define A6 A5 A5 A5 A5 A5 A5
|
||||
#define A7 A6 A6 A6 A6 A6 A6
|
||||
#define A8 A7 A7 A7 A7 A7 A7
|
||||
|
||||
A8
|
@ -1,47 +0,0 @@
|
||||
#define __extension__
|
||||
|
||||
#define __stpcpy(dest, src) (__extension__ (__builtin_constant_p (src) ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8 ? __stpcpy_small (dest, __stpcpy_args (src), strlen (src) + 1) : ((char *) __mempcpy (dest, src, strlen (src) + 1) - 1)) : __stpcpy (dest, src)))
|
||||
#define stpcpy(dest, src) __stpcpy (dest, src)
|
||||
#define __stpcpy_args(src) __extension__ __STRING2_SMALL_GET16 (src, 0), __extension__ __STRING2_SMALL_GET16 (src, 4), __extension__ __STRING2_SMALL_GET32 (src, 0), __extension__ __STRING2_SMALL_GET32 (src, 4)
|
||||
|
||||
#define __mempcpy(dest, src, n) (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) && __string2_1bptr_p (src) && n <= 8 ? __mempcpy_small (dest, __mempcpy_args (src), n) : __mempcpy (dest, src, n)))
|
||||
#define mempcpy(dest, src, n) __mempcpy (dest, src, n)
|
||||
#define __mempcpy_args(src) ((char *) (src))[0], ((char *) (src))[2], ((char *) (src))[4], ((char *) (src))[6], __extension__ __STRING2_SMALL_GET16 (src, 0), __extension__ __STRING2_SMALL_GET16 (src, 4), __extension__ __STRING2_SMALL_GET32 (src, 0), __extension__ __STRING2_SMALL_GET32 (src, 4)
|
||||
|
||||
#define __STRING2_SMALL_GET16(src, idx) (((__const unsigned char *) (__const char *) (src))[idx + 1] << 8 | ((__const unsigned char *) (__const char *) (src))[idx])
|
||||
|
||||
#define __STRING2_SMALL_GET32(src, idx) (((((__const unsigned char *) (__const char *) (src))[idx + 3] << 8 | ((__const unsigned char *) (__const char *) (src))[idx + 2]) << 8 | ((__const unsigned char *) (__const char *) (src))[idx + 1]) << 8 | ((__const unsigned char *) (__const char *) (src))[idx])
|
||||
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
||||
stpcpy (stpcpy (stpcpy (stpcpy (a, b), c), d), e)
|
File diff suppressed because it is too large
Load Diff
@ -1,347 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="clangAST"
|
||||
ProjectGUID="{5125C3DB-FBD6-4BF8-8D8B-CE51D6E93BCD}"
|
||||
RootNamespace="clangAST"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4146"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4146"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\APValue.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\ASTConsumer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\ASTContext.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\Builtins.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\CFG.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\Decl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\DeclarationName.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\DeclBase.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\DeclCXX.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\DeclGroup.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\DeclObjC.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\DeclSerialization.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\Expr.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\ExprConstant.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\ExprCXX.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\InheritViz.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\ParentMap.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\Stmt.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\StmtDumper.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\StmtIterator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\StmtPrinter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\StmtSerialization.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\StmtViz.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\TranslationUnit.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\Type.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\AST\TypeSerialization.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\AST.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\ASTConsumer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\ASTContext.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\Builtins.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\CFG.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\Decl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\DeclCXX.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\DeclObjC.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\Expr.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\ExprCXX.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\ParentMap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\PrettyPrinter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\RecordLayout.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\Stmt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\StmtGraphTraits.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\StmtIterator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\StmtVisitor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\Type.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\AST\TypeOrdering.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1,351 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="clangAnalysis"
|
||||
ProjectGUID="{6C98551A-4C36-4E74-8419-4D3EEEC9D8E0}"
|
||||
RootNamespace="clangAnalysis"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4146"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4146"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\BasicConstraintManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\BasicObjCFoundationChecks.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\BasicObjCFoundationChecks.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\BasicStore.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\BasicValueFactory.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\BugReporter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\CFRefCount.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\CheckDeadStores.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\CheckNSError.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\CheckObjCDealloc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\CheckObjCInstMethSignature.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\CheckObjCUnusedIVars.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\Environment.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\ExplodedGraph.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\GRBlockCounter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\GRCoreEngine.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\GRExprEngine.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\GRExprEngineInternalChecks.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\GRSimpleVals.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\GRSimpleVals.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\GRState.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\GRTransferFuncs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\LiveVariables.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\MemRegion.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\PathDiagnostic.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\RegionStore.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\SVals.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\SymbolManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\UninitializedValues.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Analysis\ExprDeclBitVector.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Analysis\LiveVariables.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Analysis\LocalCheckers.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Analysis\ProgramEdge.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Analysis\UninitializedValues.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="Visitors"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Analysis\Visitors\CFGRecStmtDeclVisitor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Analysis\Visitors\CFGRecStmtVisitor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Analysis\Visitors\CFGStmtVisitor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Analysis\Visitors\CFGVarDeclVisitor.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="ADT"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Analysis\ADT\PersistentMap.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Support"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Analysis\Support\IntrusiveSPtr.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="FlowSensitive"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Analysis\FlowSensitive\DataflowSolver.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Analysis\FlowSensitive\DataflowValues.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1,236 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="clangBasic"
|
||||
ProjectGUID="{298B4876-6EF1-4E80-85D7-72F80693BBEB}"
|
||||
RootNamespace="Basic"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\clangBasic.pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)\clangBasic.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\clangBasic.pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4355,4146,4800"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)\clangBasic.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\lib\Basic\Diagnostic.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Basic\FileManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Basic\IdentifierTable.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Basic\LangOptions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Basic\SourceLocation.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Basic\SourceManager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Basic\TargetInfo.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Basic\Targets.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Basic\TokenKinds.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Basic\Diagnostic.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Basic\FileManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Basic\IdentifierTable.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Basic\LangOptions.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Basic\SourceLocation.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Basic\SourceManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Basic\TargetInfo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Basic\TokenKinds.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1,271 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="clangCodeGen"
|
||||
ProjectGUID="{4CEC5897-D957-47E7-A6AE-2021D4F44A8F}"
|
||||
RootNamespace="clangCodeGen"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4146"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4146"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGBuiltin.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGCall.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGCXX.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGDebugInfo.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGDecl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGExpr.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGExprAgg.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGExprComplex.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGExprConstant.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGExprScalar.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGObjC.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGObjCGNU.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGObjCMac.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGStmt.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CodeGenFunction.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CodeGenModule.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CodeGenTypes.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\ModuleBuilder.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGCall.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGDebugInfo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGObjCRuntime.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CGValue.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CodeGenFunction.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CodeGenModule.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\CodeGen\CodeGenTypes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\CodeGen\ModuleBuilder.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1,270 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="clangDriver"
|
||||
ProjectGUID="{7E7DA455-C276-4B93-8D02-8F7E2F629BAF}"
|
||||
RootNamespace="clangDriver"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
ManagedExtensions="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4355,4146,4800"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\clang.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(TargetDir)/clang.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="mkdir "%DSTROOT%\AppleInternal\Bin"
copy "$(TargetDir)$(TargetName).exe" "%DSTROOT%\AppleInternal\Bin"
"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4355,4146,4800"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)\clang.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(TargetDir)/clang.pdb"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="mkdir "%DSTROOT%\AppleInternal\Bin"
copy "$(TargetDir)$(TargetName).exe" "%DSTROOT%\AppleInternal\Bin"
"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\Driver\AnalysisConsumer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\ASTConsumers.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\Backend.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\CacheTokens.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\clang-cc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\DependencyFile.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\DiagChecker.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\HTMLPrint.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\PrintParserCallbacks.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\PrintPreprocessedOutput.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\RewriteBlocks.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\RewriteMacros.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\RewriteObjC.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\SerializationTest.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\Driver\AnalysisConsumer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\ASTConsumers.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\clang-cc.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1,283 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="clangLex"
|
||||
ProjectGUID="{030F6909-B2FA-4E53-BEA7-9A559CFC2F73}"
|
||||
RootNamespace="clangLex"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4146"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4146"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\HeaderMap.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\HeaderSearch.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\Lexer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\LiteralSupport.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\MacroArgs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\MacroInfo.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\PPCaching.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\PPDirectives.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\PPExpressions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\PPLexerChange.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\PPMacroExpansion.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\Pragma.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\Preprocessor.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\PreprocessorLexer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\PTHLexer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\ScratchBuffer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Lex\TokenLexer.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Lex\DirectoryLookup.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Lex\HeaderSearch.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Lex\Lexer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Lex\LiteralSupport.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Lex\MacroExpander.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Lex\MacroInfo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Lex\MultipleIncludeOpt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Lex\PPCallbacks.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Lex\Pragma.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Lex\Preprocessor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Lex\ScratchBuffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Lex\Token.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1,205 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="clangLibDriver"
|
||||
ProjectGUID="{AECB78DF-C319-4D49-B2FD-F98F62EBBDF4}"
|
||||
RootNamespace="clangLibDriver"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\lib\Driver\HTMLDiagnostics.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Driver\InitHeaderSearch.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Driver\ManagerRegistry.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Driver\PlistDiagnostics.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Driver\RewriteTest.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Driver\TextDiagnosticBuffer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Driver\TextDiagnosticPrinter.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Driver\HTMLDiagnostics.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Driver\InitHeaderSearch.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Driver\TextDiagnosticBuffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Driver\TextDiagnosticPrinter.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1,248 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="clangParse"
|
||||
ProjectGUID="{05DF3074-11AF-491A-B078-83BD2EDC31F6}"
|
||||
RootNamespace="clangParse"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
DisableLanguageExtensions="true"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4146"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4146"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\AttributeList.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\DeclSpec.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\MinimalAction.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\ParseCXXInlineMethods.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\ParseDecl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\ParseDeclCXX.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\ParseExpr.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\ParseExprCXX.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\ParseInit.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\ParseObjc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\ParsePragma.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\Parser.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\ParseStmt.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\ParseTemplate.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Parse\ParseTentative.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Parse\Action.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Parse\AttributeList.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Parse\DeclSpec.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Parse\Parser.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Parse\Scope.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1,191 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="clangRewrite"
|
||||
ProjectGUID="{F9FBDDA2-9EE1-473C-A456-BE20B7B2439D}"
|
||||
RootNamespace="clangRewrite"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\lib\Rewrite\DeltaTree.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Rewrite\HTMLRewrite.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Rewrite\Rewriter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Rewrite\RewriteRope.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Rewrite\TokenRewriter.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Rewrite\Rewriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\clang\Rewrite\RewriteRope.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1,263 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="clangSema"
|
||||
ProjectGUID="{4727E8B7-AA99-41C9-AB09-A8A862595DB7}"
|
||||
RootNamespace="clangSema"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4146"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\..\..\..\win32\common.vsprops"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\include;..\..\..\..\include;..\..\..\..\win32"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;__STDC_LIMIT_MACROS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4146"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\IdentifierResolver.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\ParseAST.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\Sema.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaChecking.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaCXXScopeSpec.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaDecl.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaDeclAttr.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaDeclCXX.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaDeclObjC.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaExpr.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaExprCXX.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaExprObjC.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaInherit.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaInit.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaLookup.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaNamedCast.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaOverload.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaStmt.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaTemplate.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaType.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\CXXFieldCollector.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\IdentifierResolver.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\Sema.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Sema\SemaUtil.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
@ -1,579 +0,0 @@
|
||||
//===- llvm/unittest/ADT/APFloat.cpp - APFloat unit tests ---------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/APFloat.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static double convertToDoubleFromString(const char *Str) {
|
||||
llvm::APFloat F(0.0);
|
||||
F.convertFromString(Str, llvm::APFloat::rmNearestTiesToEven);
|
||||
return F.convertToDouble();
|
||||
}
|
||||
|
||||
static std::string convertToString(double d, unsigned Prec, unsigned Pad) {
|
||||
llvm::SmallVector<char, 100> Buffer;
|
||||
llvm::APFloat F(d);
|
||||
F.toString(Buffer, Prec, Pad);
|
||||
return std::string(Buffer.data(), Buffer.size());
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(APFloatTest, Zero) {
|
||||
EXPECT_EQ(0.0f, APFloat(APFloat::IEEEsingle, 0.0f).convertToFloat());
|
||||
EXPECT_EQ(-0.0f, APFloat(APFloat::IEEEsingle, -0.0f).convertToFloat());
|
||||
|
||||
EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, 0.0).convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, -0.0).convertToDouble());
|
||||
}
|
||||
|
||||
TEST(APFloatTest, fromZeroDecimalString) {
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, ".0").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+.0").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-.0").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.0").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.0").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.0").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "00000.").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+00000.").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-00000.").convertToDouble());
|
||||
|
||||
EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, ".00000").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+.00000").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-.00000").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0000.00000").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0000.00000").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0000.00000").convertToDouble());
|
||||
}
|
||||
|
||||
TEST(APFloatTest, fromZeroDecimalSingleExponentString) {
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0e1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0e1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0e1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0e+1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0e+1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0e+1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0e-1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0e-1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0e-1").convertToDouble());
|
||||
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.e1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.e1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.e1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.e+1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.e+1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.e+1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.e-1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.e-1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.e-1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, ".0e1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+.0e1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-.0e1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, ".0e+1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+.0e+1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-.0e+1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, ".0e-1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+.0e-1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-.0e-1").convertToDouble());
|
||||
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.0e1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.0e1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.0e1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.0e+1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.0e+1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.0e+1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0.0e-1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0.0e-1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0.0e-1").convertToDouble());
|
||||
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "000.0000e1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+000.0000e+1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-000.0000e+1").convertToDouble());
|
||||
}
|
||||
|
||||
TEST(APFloatTest, fromZeroDecimalLargeExponentString) {
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0e1234").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0e1234").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0e1234").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0e+1234").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0e+1234").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0e+1234").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0e-1234").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0e-1234").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0e-1234").convertToDouble());
|
||||
|
||||
EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "000.0000e1234").convertToDouble());
|
||||
EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, "000.0000e-1234").convertToDouble());
|
||||
|
||||
EXPECT_EQ(0.0, APFloat(APFloat::IEEEdouble, StringRef("0e1234\02", 6)).convertToDouble());
|
||||
}
|
||||
|
||||
TEST(APFloatTest, fromZeroHexadecimalString) {
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0p1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0p1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0p1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0p+1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0p+1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0p+1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0p-1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0p-1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0p-1").convertToDouble());
|
||||
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.p1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0.p1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0.p1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.p+1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0.p+1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0.p+1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.p-1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0.p-1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0.p-1").convertToDouble());
|
||||
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x.0p1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x.0p1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x.0p1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x.0p+1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x.0p+1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x.0p+1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x.0p-1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x.0p-1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x.0p-1").convertToDouble());
|
||||
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.0p1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0.0p1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0.0p1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.0p+1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0.0p+1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0.0p+1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.0p-1").convertToDouble());
|
||||
EXPECT_EQ(+0.0, APFloat(APFloat::IEEEdouble, "+0x0.0p-1").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0.0p-1").convertToDouble());
|
||||
|
||||
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x00000.p1").convertToDouble());
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0000.00000p1").convertToDouble());
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x.00000p1").convertToDouble());
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.p1").convertToDouble());
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0p1234").convertToDouble());
|
||||
EXPECT_EQ(-0.0, APFloat(APFloat::IEEEdouble, "-0x0p1234").convertToDouble());
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x00000.p1234").convertToDouble());
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0000.00000p1234").convertToDouble());
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x.00000p1234").convertToDouble());
|
||||
EXPECT_EQ( 0.0, APFloat(APFloat::IEEEdouble, "0x0.p1234").convertToDouble());
|
||||
}
|
||||
|
||||
TEST(APFloatTest, fromDecimalString) {
|
||||
EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble, "1").convertToDouble());
|
||||
EXPECT_EQ(2.0, APFloat(APFloat::IEEEdouble, "2.").convertToDouble());
|
||||
EXPECT_EQ(0.5, APFloat(APFloat::IEEEdouble, ".5").convertToDouble());
|
||||
EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble, "1.0").convertToDouble());
|
||||
EXPECT_EQ(-2.0, APFloat(APFloat::IEEEdouble, "-2").convertToDouble());
|
||||
EXPECT_EQ(-4.0, APFloat(APFloat::IEEEdouble, "-4.").convertToDouble());
|
||||
EXPECT_EQ(-0.5, APFloat(APFloat::IEEEdouble, "-.5").convertToDouble());
|
||||
EXPECT_EQ(-1.5, APFloat(APFloat::IEEEdouble, "-1.5").convertToDouble());
|
||||
EXPECT_EQ(1.25e12, APFloat(APFloat::IEEEdouble, "1.25e12").convertToDouble());
|
||||
EXPECT_EQ(1.25e+12, APFloat(APFloat::IEEEdouble, "1.25e+12").convertToDouble());
|
||||
EXPECT_EQ(1.25e-12, APFloat(APFloat::IEEEdouble, "1.25e-12").convertToDouble());
|
||||
EXPECT_EQ(1024.0, APFloat(APFloat::IEEEdouble, "1024.").convertToDouble());
|
||||
EXPECT_EQ(1024.05, APFloat(APFloat::IEEEdouble, "1024.05000").convertToDouble());
|
||||
EXPECT_EQ(0.05, APFloat(APFloat::IEEEdouble, ".05000").convertToDouble());
|
||||
EXPECT_EQ(2.0, APFloat(APFloat::IEEEdouble, "2.").convertToDouble());
|
||||
EXPECT_EQ(2.0e2, APFloat(APFloat::IEEEdouble, "2.e2").convertToDouble());
|
||||
EXPECT_EQ(2.0e+2, APFloat(APFloat::IEEEdouble, "2.e+2").convertToDouble());
|
||||
EXPECT_EQ(2.0e-2, APFloat(APFloat::IEEEdouble, "2.e-2").convertToDouble());
|
||||
EXPECT_EQ(2.05e2, APFloat(APFloat::IEEEdouble, "002.05000e2").convertToDouble());
|
||||
EXPECT_EQ(2.05e+2, APFloat(APFloat::IEEEdouble, "002.05000e+2").convertToDouble());
|
||||
EXPECT_EQ(2.05e-2, APFloat(APFloat::IEEEdouble, "002.05000e-2").convertToDouble());
|
||||
EXPECT_EQ(2.05e12, APFloat(APFloat::IEEEdouble, "002.05000e12").convertToDouble());
|
||||
EXPECT_EQ(2.05e+12, APFloat(APFloat::IEEEdouble, "002.05000e+12").convertToDouble());
|
||||
EXPECT_EQ(2.05e-12, APFloat(APFloat::IEEEdouble, "002.05000e-12").convertToDouble());
|
||||
|
||||
// These are "carefully selected" to overflow the fast log-base
|
||||
// calculations in APFloat.cpp
|
||||
EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "99e99999").isInfinity());
|
||||
EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-99e99999").isInfinity());
|
||||
EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "1e-99999").isPosZero());
|
||||
EXPECT_TRUE(APFloat(APFloat::IEEEdouble, "-1e-99999").isNegZero());
|
||||
}
|
||||
|
||||
TEST(APFloatTest, fromHexadecimalString) {
|
||||
EXPECT_EQ( 1.0, APFloat(APFloat::IEEEdouble, "0x1p0").convertToDouble());
|
||||
EXPECT_EQ(+1.0, APFloat(APFloat::IEEEdouble, "+0x1p0").convertToDouble());
|
||||
EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble, "-0x1p0").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 1.0, APFloat(APFloat::IEEEdouble, "0x1p+0").convertToDouble());
|
||||
EXPECT_EQ(+1.0, APFloat(APFloat::IEEEdouble, "+0x1p+0").convertToDouble());
|
||||
EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble, "-0x1p+0").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 1.0, APFloat(APFloat::IEEEdouble, "0x1p-0").convertToDouble());
|
||||
EXPECT_EQ(+1.0, APFloat(APFloat::IEEEdouble, "+0x1p-0").convertToDouble());
|
||||
EXPECT_EQ(-1.0, APFloat(APFloat::IEEEdouble, "-0x1p-0").convertToDouble());
|
||||
|
||||
|
||||
EXPECT_EQ( 2.0, APFloat(APFloat::IEEEdouble, "0x1p1").convertToDouble());
|
||||
EXPECT_EQ(+2.0, APFloat(APFloat::IEEEdouble, "+0x1p1").convertToDouble());
|
||||
EXPECT_EQ(-2.0, APFloat(APFloat::IEEEdouble, "-0x1p1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 2.0, APFloat(APFloat::IEEEdouble, "0x1p+1").convertToDouble());
|
||||
EXPECT_EQ(+2.0, APFloat(APFloat::IEEEdouble, "+0x1p+1").convertToDouble());
|
||||
EXPECT_EQ(-2.0, APFloat(APFloat::IEEEdouble, "-0x1p+1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.5, APFloat(APFloat::IEEEdouble, "0x1p-1").convertToDouble());
|
||||
EXPECT_EQ(+0.5, APFloat(APFloat::IEEEdouble, "+0x1p-1").convertToDouble());
|
||||
EXPECT_EQ(-0.5, APFloat(APFloat::IEEEdouble, "-0x1p-1").convertToDouble());
|
||||
|
||||
|
||||
EXPECT_EQ( 3.0, APFloat(APFloat::IEEEdouble, "0x1.8p1").convertToDouble());
|
||||
EXPECT_EQ(+3.0, APFloat(APFloat::IEEEdouble, "+0x1.8p1").convertToDouble());
|
||||
EXPECT_EQ(-3.0, APFloat(APFloat::IEEEdouble, "-0x1.8p1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 3.0, APFloat(APFloat::IEEEdouble, "0x1.8p+1").convertToDouble());
|
||||
EXPECT_EQ(+3.0, APFloat(APFloat::IEEEdouble, "+0x1.8p+1").convertToDouble());
|
||||
EXPECT_EQ(-3.0, APFloat(APFloat::IEEEdouble, "-0x1.8p+1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.75, APFloat(APFloat::IEEEdouble, "0x1.8p-1").convertToDouble());
|
||||
EXPECT_EQ(+0.75, APFloat(APFloat::IEEEdouble, "+0x1.8p-1").convertToDouble());
|
||||
EXPECT_EQ(-0.75, APFloat(APFloat::IEEEdouble, "-0x1.8p-1").convertToDouble());
|
||||
|
||||
|
||||
EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble, "0x1000.000p1").convertToDouble());
|
||||
EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble, "+0x1000.000p1").convertToDouble());
|
||||
EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble, "-0x1000.000p1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble, "0x1000.000p+1").convertToDouble());
|
||||
EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble, "+0x1000.000p+1").convertToDouble());
|
||||
EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble, "-0x1000.000p+1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 2048.0, APFloat(APFloat::IEEEdouble, "0x1000.000p-1").convertToDouble());
|
||||
EXPECT_EQ(+2048.0, APFloat(APFloat::IEEEdouble, "+0x1000.000p-1").convertToDouble());
|
||||
EXPECT_EQ(-2048.0, APFloat(APFloat::IEEEdouble, "-0x1000.000p-1").convertToDouble());
|
||||
|
||||
|
||||
EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble, "0x1000p1").convertToDouble());
|
||||
EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble, "+0x1000p1").convertToDouble());
|
||||
EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble, "-0x1000p1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 8192.0, APFloat(APFloat::IEEEdouble, "0x1000p+1").convertToDouble());
|
||||
EXPECT_EQ(+8192.0, APFloat(APFloat::IEEEdouble, "+0x1000p+1").convertToDouble());
|
||||
EXPECT_EQ(-8192.0, APFloat(APFloat::IEEEdouble, "-0x1000p+1").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 2048.0, APFloat(APFloat::IEEEdouble, "0x1000p-1").convertToDouble());
|
||||
EXPECT_EQ(+2048.0, APFloat(APFloat::IEEEdouble, "+0x1000p-1").convertToDouble());
|
||||
EXPECT_EQ(-2048.0, APFloat(APFloat::IEEEdouble, "-0x1000p-1").convertToDouble());
|
||||
|
||||
|
||||
EXPECT_EQ( 16384.0, APFloat(APFloat::IEEEdouble, "0x10p10").convertToDouble());
|
||||
EXPECT_EQ(+16384.0, APFloat(APFloat::IEEEdouble, "+0x10p10").convertToDouble());
|
||||
EXPECT_EQ(-16384.0, APFloat(APFloat::IEEEdouble, "-0x10p10").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 16384.0, APFloat(APFloat::IEEEdouble, "0x10p+10").convertToDouble());
|
||||
EXPECT_EQ(+16384.0, APFloat(APFloat::IEEEdouble, "+0x10p+10").convertToDouble());
|
||||
EXPECT_EQ(-16384.0, APFloat(APFloat::IEEEdouble, "-0x10p+10").convertToDouble());
|
||||
|
||||
EXPECT_EQ( 0.015625, APFloat(APFloat::IEEEdouble, "0x10p-10").convertToDouble());
|
||||
EXPECT_EQ(+0.015625, APFloat(APFloat::IEEEdouble, "+0x10p-10").convertToDouble());
|
||||
EXPECT_EQ(-0.015625, APFloat(APFloat::IEEEdouble, "-0x10p-10").convertToDouble());
|
||||
|
||||
EXPECT_EQ(1.0625, APFloat(APFloat::IEEEdouble, "0x1.1p0").convertToDouble());
|
||||
EXPECT_EQ(1.0, APFloat(APFloat::IEEEdouble, "0x1p0").convertToDouble());
|
||||
|
||||
EXPECT_EQ(2.71828, convertToDoubleFromString("2.71828"));
|
||||
}
|
||||
|
||||
TEST(APFloatTest, toString) {
|
||||
ASSERT_EQ("10", convertToString(10.0, 6, 3));
|
||||
ASSERT_EQ("1.0E+1", convertToString(10.0, 6, 0));
|
||||
ASSERT_EQ("10100", convertToString(1.01E+4, 5, 2));
|
||||
ASSERT_EQ("1.01E+4", convertToString(1.01E+4, 4, 2));
|
||||
ASSERT_EQ("1.01E+4", convertToString(1.01E+4, 5, 1));
|
||||
ASSERT_EQ("0.0101", convertToString(1.01E-2, 5, 2));
|
||||
ASSERT_EQ("0.0101", convertToString(1.01E-2, 4, 2));
|
||||
ASSERT_EQ("1.01E-2", convertToString(1.01E-2, 5, 1));
|
||||
ASSERT_EQ("0.7853981633974483", convertToString(0.78539816339744830961, 0, 3));
|
||||
ASSERT_EQ("4.940656458412465E-324", convertToString(4.9406564584124654e-324, 0, 3));
|
||||
ASSERT_EQ("873.1834", convertToString(873.1834, 0, 1));
|
||||
ASSERT_EQ("8.731834E+2", convertToString(873.1834, 0, 0));
|
||||
}
|
||||
|
||||
static APInt nanbits(const fltSemantics &Sem,
|
||||
bool SNaN, bool Negative, uint64_t fill) {
|
||||
APInt apfill(64, fill);
|
||||
if (SNaN)
|
||||
return APFloat::getSNaN(Sem, Negative, &apfill).bitcastToAPInt();
|
||||
else
|
||||
return APFloat::getQNaN(Sem, Negative, &apfill).bitcastToAPInt();
|
||||
}
|
||||
|
||||
TEST(APFloatTest, makeNaN) {
|
||||
ASSERT_EQ(0x7fc00000, nanbits(APFloat::IEEEsingle, false, false, 0));
|
||||
ASSERT_EQ(0xffc00000, nanbits(APFloat::IEEEsingle, false, true, 0));
|
||||
ASSERT_EQ(0x7fc0ae72, nanbits(APFloat::IEEEsingle, false, false, 0xae72));
|
||||
ASSERT_EQ(0x7fffae72, nanbits(APFloat::IEEEsingle, false, false, 0xffffae72));
|
||||
ASSERT_EQ(0x7fa00000, nanbits(APFloat::IEEEsingle, true, false, 0));
|
||||
ASSERT_EQ(0xffa00000, nanbits(APFloat::IEEEsingle, true, true, 0));
|
||||
ASSERT_EQ(0x7f80ae72, nanbits(APFloat::IEEEsingle, true, false, 0xae72));
|
||||
ASSERT_EQ(0x7fbfae72, nanbits(APFloat::IEEEsingle, true, false, 0xffffae72));
|
||||
|
||||
ASSERT_EQ(0x7ff8000000000000ULL, nanbits(APFloat::IEEEdouble, false, false, 0));
|
||||
ASSERT_EQ(0xfff8000000000000ULL, nanbits(APFloat::IEEEdouble, false, true, 0));
|
||||
ASSERT_EQ(0x7ff800000000ae72ULL, nanbits(APFloat::IEEEdouble, false, false, 0xae72));
|
||||
ASSERT_EQ(0x7fffffffffffae72ULL, nanbits(APFloat::IEEEdouble, false, false, 0xffffffffffffae72ULL));
|
||||
ASSERT_EQ(0x7ff4000000000000ULL, nanbits(APFloat::IEEEdouble, true, false, 0));
|
||||
ASSERT_EQ(0xfff4000000000000ULL, nanbits(APFloat::IEEEdouble, true, true, 0));
|
||||
ASSERT_EQ(0x7ff000000000ae72ULL, nanbits(APFloat::IEEEdouble, true, false, 0xae72));
|
||||
ASSERT_EQ(0x7ff7ffffffffae72ULL, nanbits(APFloat::IEEEdouble, true, false, 0xffffffffffffae72ULL));
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#ifndef NDEBUG
|
||||
TEST(APFloatTest, SemanticsDeath) {
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEsingle, 0.0f).convertToDouble(), "Float semantics are not IEEEdouble");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, 0.0 ).convertToFloat(), "Float semantics are not IEEEsingle");
|
||||
}
|
||||
|
||||
TEST(APFloatTest, StringDecimalDeath) {
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ""), "Invalid string length");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+"), "String has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-"), "String has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("\0", 1)), "Invalid character in significand");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1\0", 2)), "Invalid character in significand");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1\02", 3)), "Invalid character in significand");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1\02e1", 5)), "Invalid character in significand");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1e\0", 3)), "Invalid character in exponent");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1e1\0", 4)), "Invalid character in exponent");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("1e1\02", 5)), "Invalid character in exponent");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.0f"), "Invalid character in significand");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".."), "String contains multiple dots");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "..0"), "String contains multiple dots");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.0.0"), "String contains multiple dots");
|
||||
}
|
||||
|
||||
TEST(APFloatTest, StringDecimalSignificandDeath) {
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "."), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+."), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-."), "Significand has no digits");
|
||||
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "e"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+e"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-e"), "Significand has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "e1"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+e1"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-e1"), "Significand has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".e1"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+.e1"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-.e1"), "Significand has no digits");
|
||||
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".e"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+.e"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-.e"), "Significand has no digits");
|
||||
}
|
||||
|
||||
TEST(APFloatTest, StringDecimalExponentDeath) {
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1e"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+1e"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-1e"), "Exponent has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.e"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+1.e"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-1.e"), "Exponent has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".1e"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+.1e"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-.1e"), "Exponent has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.1e"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+1.1e"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-1.1e"), "Exponent has no digits");
|
||||
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1e+"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1e-"), "Exponent has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".1e"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".1e+"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, ".1e-"), "Exponent has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.0e"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.0e+"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "1.0e-"), "Exponent has no digits");
|
||||
}
|
||||
|
||||
TEST(APFloatTest, StringHexadecimalDeath) {
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x"), "Invalid string");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x"), "Invalid string");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x"), "Invalid string");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x0"), "Hex strings require an exponent");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x0"), "Hex strings require an exponent");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x0"), "Hex strings require an exponent");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x0."), "Hex strings require an exponent");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x0."), "Hex strings require an exponent");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x0."), "Hex strings require an exponent");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.0"), "Hex strings require an exponent");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.0"), "Hex strings require an exponent");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.0"), "Hex strings require an exponent");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x0.0"), "Hex strings require an exponent");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x0.0"), "Hex strings require an exponent");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x0.0"), "Hex strings require an exponent");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x\0", 3)), "Invalid character in significand");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1\0", 4)), "Invalid character in significand");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1\02", 5)), "Invalid character in significand");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1\02p1", 7)), "Invalid character in significand");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1p\0", 5)), "Invalid character in exponent");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1p1\0", 6)), "Invalid character in exponent");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, StringRef("0x1p1\02", 7)), "Invalid character in exponent");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1p0f"), "Invalid character in exponent");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x..p1"), "String contains multiple dots");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x..0p1"), "String contains multiple dots");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.0.0p1"), "String contains multiple dots");
|
||||
}
|
||||
|
||||
TEST(APFloatTest, StringHexadecimalSignificandDeath) {
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x."), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x."), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x."), "Significand has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0xp"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0xp"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0xp"), "Significand has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0xp+"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0xp+"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0xp+"), "Significand has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0xp-"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0xp-"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0xp-"), "Significand has no digits");
|
||||
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.p"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.p"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.p"), "Significand has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.p+"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.p+"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.p+"), "Significand has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.p-"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.p-"), "Significand has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.p-"), "Significand has no digits");
|
||||
}
|
||||
|
||||
TEST(APFloatTest, StringHexadecimalExponentDeath) {
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1p"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1p"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1p"), "Exponent has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1p+"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1p+"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1p+"), "Exponent has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1p-"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1p-"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1p-"), "Exponent has no digits");
|
||||
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.p"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1.p"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1.p"), "Exponent has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.p+"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1.p+"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1.p+"), "Exponent has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.p-"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1.p-"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1.p-"), "Exponent has no digits");
|
||||
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.1p"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.1p"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.1p"), "Exponent has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.1p+"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.1p+"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.1p+"), "Exponent has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x.1p-"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x.1p-"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x.1p-"), "Exponent has no digits");
|
||||
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.1p"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1.1p"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1.1p"), "Exponent has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.1p+"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1.1p+"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1.1p+"), "Exponent has no digits");
|
||||
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "0x1.1p-"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "+0x1.1p-"), "Exponent has no digits");
|
||||
EXPECT_DEATH(APFloat(APFloat::IEEEdouble, "-0x1.1p-"), "Exponent has no digits");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
@ -1,346 +0,0 @@
|
||||
//===- llvm/unittest/ADT/APInt.cpp - APInt unit tests ---------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <ostream>
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/APInt.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
// Test that APInt shift left works when bitwidth > 64 and shiftamt == 0
|
||||
TEST(APIntTest, ShiftLeftByZero) {
|
||||
APInt One = APInt::getNullValue(65) + 1;
|
||||
APInt Shl = One.shl(0);
|
||||
EXPECT_EQ(true, Shl[0]);
|
||||
EXPECT_EQ(false, Shl[1]);
|
||||
}
|
||||
|
||||
TEST(APIntTest, i128_NegativeCount) {
|
||||
APInt Minus3(128, static_cast<uint64_t>(-3), true);
|
||||
EXPECT_EQ(126u, Minus3.countLeadingOnes());
|
||||
EXPECT_EQ(-3, Minus3.getSExtValue());
|
||||
|
||||
APInt Minus1(128, static_cast<uint64_t>(-1), true);
|
||||
EXPECT_EQ(0u, Minus1.countLeadingZeros());
|
||||
EXPECT_EQ(128u, Minus1.countLeadingOnes());
|
||||
EXPECT_EQ(128u, Minus1.getActiveBits());
|
||||
EXPECT_EQ(0u, Minus1.countTrailingZeros());
|
||||
EXPECT_EQ(128u, Minus1.countTrailingOnes());
|
||||
EXPECT_EQ(128u, Minus1.countPopulation());
|
||||
EXPECT_EQ(-1, Minus1.getSExtValue());
|
||||
}
|
||||
|
||||
TEST(APIntTest, i33_Count) {
|
||||
APInt i33minus2(33, static_cast<uint64_t>(-2), true);
|
||||
EXPECT_EQ(0u, i33minus2.countLeadingZeros());
|
||||
EXPECT_EQ(32u, i33minus2.countLeadingOnes());
|
||||
EXPECT_EQ(33u, i33minus2.getActiveBits());
|
||||
EXPECT_EQ(1u, i33minus2.countTrailingZeros());
|
||||
EXPECT_EQ(32u, i33minus2.countPopulation());
|
||||
EXPECT_EQ(-2, i33minus2.getSExtValue());
|
||||
EXPECT_EQ(((uint64_t)-2)&((1ull<<33) -1), i33minus2.getZExtValue());
|
||||
}
|
||||
|
||||
TEST(APIntTest, i65_Count) {
|
||||
APInt i65minus(65, 0, true);
|
||||
i65minus.set(64);
|
||||
EXPECT_EQ(0u, i65minus.countLeadingZeros());
|
||||
EXPECT_EQ(1u, i65minus.countLeadingOnes());
|
||||
EXPECT_EQ(65u, i65minus.getActiveBits());
|
||||
EXPECT_EQ(64u, i65minus.countTrailingZeros());
|
||||
EXPECT_EQ(1u, i65minus.countPopulation());
|
||||
}
|
||||
|
||||
TEST(APIntTest, i128_PositiveCount) {
|
||||
APInt u128max = APInt::getAllOnesValue(128);
|
||||
EXPECT_EQ(128u, u128max.countLeadingOnes());
|
||||
EXPECT_EQ(0u, u128max.countLeadingZeros());
|
||||
EXPECT_EQ(128u, u128max.getActiveBits());
|
||||
EXPECT_EQ(0u, u128max.countTrailingZeros());
|
||||
EXPECT_EQ(128u, u128max.countTrailingOnes());
|
||||
EXPECT_EQ(128u, u128max.countPopulation());
|
||||
|
||||
APInt u64max(128, static_cast<uint64_t>(-1), false);
|
||||
EXPECT_EQ(64u, u64max.countLeadingZeros());
|
||||
EXPECT_EQ(0u, u64max.countLeadingOnes());
|
||||
EXPECT_EQ(64u, u64max.getActiveBits());
|
||||
EXPECT_EQ(0u, u64max.countTrailingZeros());
|
||||
EXPECT_EQ(64u, u64max.countTrailingOnes());
|
||||
EXPECT_EQ(64u, u64max.countPopulation());
|
||||
EXPECT_EQ((uint64_t)~0ull, u64max.getZExtValue());
|
||||
|
||||
APInt zero(128, 0, true);
|
||||
EXPECT_EQ(128u, zero.countLeadingZeros());
|
||||
EXPECT_EQ(0u, zero.countLeadingOnes());
|
||||
EXPECT_EQ(0u, zero.getActiveBits());
|
||||
EXPECT_EQ(128u, zero.countTrailingZeros());
|
||||
EXPECT_EQ(0u, zero.countTrailingOnes());
|
||||
EXPECT_EQ(0u, zero.countPopulation());
|
||||
EXPECT_EQ(0u, zero.getSExtValue());
|
||||
EXPECT_EQ(0u, zero.getZExtValue());
|
||||
|
||||
APInt one(128, 1, true);
|
||||
EXPECT_EQ(127u, one.countLeadingZeros());
|
||||
EXPECT_EQ(0u, one.countLeadingOnes());
|
||||
EXPECT_EQ(1u, one.getActiveBits());
|
||||
EXPECT_EQ(0u, one.countTrailingZeros());
|
||||
EXPECT_EQ(1u, one.countTrailingOnes());
|
||||
EXPECT_EQ(1u, one.countPopulation());
|
||||
EXPECT_EQ(1, one.getSExtValue());
|
||||
EXPECT_EQ(1u, one.getZExtValue());
|
||||
}
|
||||
|
||||
TEST(APIntTest, i1) {
|
||||
const APInt neg_two(1, static_cast<uint64_t>(-2), true);
|
||||
const APInt neg_one(1, static_cast<uint64_t>(-1), true);
|
||||
const APInt zero(1, 0);
|
||||
const APInt one(1, 1);
|
||||
const APInt two(1, 2);
|
||||
|
||||
EXPECT_EQ(0, neg_two.getSExtValue());
|
||||
EXPECT_EQ(-1, neg_one.getSExtValue());
|
||||
EXPECT_EQ(1u, neg_one.getZExtValue());
|
||||
EXPECT_EQ(0u, zero.getZExtValue());
|
||||
EXPECT_EQ(-1, one.getSExtValue());
|
||||
EXPECT_EQ(1u, one.getZExtValue());
|
||||
EXPECT_EQ(0u, two.getZExtValue());
|
||||
EXPECT_EQ(0, two.getSExtValue());
|
||||
|
||||
// Basic equalities for 1-bit values.
|
||||
EXPECT_EQ(zero, two);
|
||||
EXPECT_EQ(zero, neg_two);
|
||||
EXPECT_EQ(one, neg_one);
|
||||
EXPECT_EQ(two, neg_two);
|
||||
|
||||
// Additions.
|
||||
EXPECT_EQ(two, one + one);
|
||||
EXPECT_EQ(zero, neg_one + one);
|
||||
EXPECT_EQ(neg_two, neg_one + neg_one);
|
||||
|
||||
// Subtractions.
|
||||
EXPECT_EQ(neg_two, neg_one - one);
|
||||
EXPECT_EQ(two, one - neg_one);
|
||||
EXPECT_EQ(zero, one - one);
|
||||
|
||||
// Shifts.
|
||||
EXPECT_EQ(zero, one << one);
|
||||
EXPECT_EQ(one, one << zero);
|
||||
EXPECT_EQ(zero, one.shl(1));
|
||||
EXPECT_EQ(one, one.shl(0));
|
||||
EXPECT_EQ(zero, one.lshr(1));
|
||||
EXPECT_EQ(zero, one.ashr(1));
|
||||
|
||||
// Multiplies.
|
||||
EXPECT_EQ(neg_one, neg_one * one);
|
||||
EXPECT_EQ(neg_one, one * neg_one);
|
||||
EXPECT_EQ(one, neg_one * neg_one);
|
||||
EXPECT_EQ(one, one * one);
|
||||
|
||||
// Divides.
|
||||
EXPECT_EQ(neg_one, one.sdiv(neg_one));
|
||||
EXPECT_EQ(neg_one, neg_one.sdiv(one));
|
||||
EXPECT_EQ(one, neg_one.sdiv(neg_one));
|
||||
EXPECT_EQ(one, one.sdiv(one));
|
||||
|
||||
EXPECT_EQ(neg_one, one.udiv(neg_one));
|
||||
EXPECT_EQ(neg_one, neg_one.udiv(one));
|
||||
EXPECT_EQ(one, neg_one.udiv(neg_one));
|
||||
EXPECT_EQ(one, one.udiv(one));
|
||||
|
||||
// Remainders.
|
||||
EXPECT_EQ(zero, neg_one.srem(one));
|
||||
EXPECT_EQ(zero, neg_one.urem(one));
|
||||
EXPECT_EQ(zero, one.srem(neg_one));
|
||||
}
|
||||
|
||||
TEST(APIntTest, fromString) {
|
||||
EXPECT_EQ(APInt(32, 0), APInt(32, "0", 2));
|
||||
EXPECT_EQ(APInt(32, 1), APInt(32, "1", 2));
|
||||
EXPECT_EQ(APInt(32, 2), APInt(32, "10", 2));
|
||||
EXPECT_EQ(APInt(32, 3), APInt(32, "11", 2));
|
||||
EXPECT_EQ(APInt(32, 4), APInt(32, "100", 2));
|
||||
|
||||
EXPECT_EQ(APInt(32, 0), APInt(32, "+0", 2));
|
||||
EXPECT_EQ(APInt(32, 1), APInt(32, "+1", 2));
|
||||
EXPECT_EQ(APInt(32, 2), APInt(32, "+10", 2));
|
||||
EXPECT_EQ(APInt(32, 3), APInt(32, "+11", 2));
|
||||
EXPECT_EQ(APInt(32, 4), APInt(32, "+100", 2));
|
||||
|
||||
EXPECT_EQ(APInt(32, uint64_t(-0LL)), APInt(32, "-0", 2));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-1LL)), APInt(32, "-1", 2));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-2LL)), APInt(32, "-10", 2));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-3LL)), APInt(32, "-11", 2));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-4LL)), APInt(32, "-100", 2));
|
||||
|
||||
|
||||
EXPECT_EQ(APInt(32, 0), APInt(32, "0", 8));
|
||||
EXPECT_EQ(APInt(32, 1), APInt(32, "1", 8));
|
||||
EXPECT_EQ(APInt(32, 7), APInt(32, "7", 8));
|
||||
EXPECT_EQ(APInt(32, 8), APInt(32, "10", 8));
|
||||
EXPECT_EQ(APInt(32, 15), APInt(32, "17", 8));
|
||||
EXPECT_EQ(APInt(32, 16), APInt(32, "20", 8));
|
||||
|
||||
EXPECT_EQ(APInt(32, +0), APInt(32, "+0", 8));
|
||||
EXPECT_EQ(APInt(32, +1), APInt(32, "+1", 8));
|
||||
EXPECT_EQ(APInt(32, +7), APInt(32, "+7", 8));
|
||||
EXPECT_EQ(APInt(32, +8), APInt(32, "+10", 8));
|
||||
EXPECT_EQ(APInt(32, +15), APInt(32, "+17", 8));
|
||||
EXPECT_EQ(APInt(32, +16), APInt(32, "+20", 8));
|
||||
|
||||
EXPECT_EQ(APInt(32, uint64_t(-0LL)), APInt(32, "-0", 8));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-1LL)), APInt(32, "-1", 8));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-7LL)), APInt(32, "-7", 8));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-8LL)), APInt(32, "-10", 8));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-15LL)), APInt(32, "-17", 8));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-16LL)), APInt(32, "-20", 8));
|
||||
|
||||
|
||||
EXPECT_EQ(APInt(32, 0), APInt(32, "0", 10));
|
||||
EXPECT_EQ(APInt(32, 1), APInt(32, "1", 10));
|
||||
EXPECT_EQ(APInt(32, 9), APInt(32, "9", 10));
|
||||
EXPECT_EQ(APInt(32, 10), APInt(32, "10", 10));
|
||||
EXPECT_EQ(APInt(32, 19), APInt(32, "19", 10));
|
||||
EXPECT_EQ(APInt(32, 20), APInt(32, "20", 10));
|
||||
|
||||
EXPECT_EQ(APInt(32, uint64_t(-0LL)), APInt(32, "-0", 10));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-1LL)), APInt(32, "-1", 10));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-9LL)), APInt(32, "-9", 10));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-10LL)), APInt(32, "-10", 10));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-19LL)), APInt(32, "-19", 10));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-20LL)), APInt(32, "-20", 10));
|
||||
|
||||
|
||||
EXPECT_EQ(APInt(32, 0), APInt(32, "0", 16));
|
||||
EXPECT_EQ(APInt(32, 1), APInt(32, "1", 16));
|
||||
EXPECT_EQ(APInt(32, 15), APInt(32, "F", 16));
|
||||
EXPECT_EQ(APInt(32, 16), APInt(32, "10", 16));
|
||||
EXPECT_EQ(APInt(32, 31), APInt(32, "1F", 16));
|
||||
EXPECT_EQ(APInt(32, 32), APInt(32, "20", 16));
|
||||
|
||||
EXPECT_EQ(APInt(32, uint64_t(-0LL)), APInt(32, "-0", 16));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-1LL)), APInt(32, "-1", 16));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-15LL)), APInt(32, "-F", 16));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-16LL)), APInt(32, "-10", 16));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-31LL)), APInt(32, "-1F", 16));
|
||||
EXPECT_EQ(APInt(32, uint64_t(-32LL)), APInt(32, "-20", 16));
|
||||
}
|
||||
|
||||
TEST(APIntTest, StringBitsNeeded2) {
|
||||
EXPECT_EQ(1U, APInt::getBitsNeeded( "0", 2));
|
||||
EXPECT_EQ(1U, APInt::getBitsNeeded( "1", 2));
|
||||
EXPECT_EQ(2U, APInt::getBitsNeeded( "10", 2));
|
||||
EXPECT_EQ(2U, APInt::getBitsNeeded( "11", 2));
|
||||
EXPECT_EQ(3U, APInt::getBitsNeeded("100", 2));
|
||||
|
||||
EXPECT_EQ(1U, APInt::getBitsNeeded( "+0", 2));
|
||||
EXPECT_EQ(1U, APInt::getBitsNeeded( "+1", 2));
|
||||
EXPECT_EQ(2U, APInt::getBitsNeeded( "+10", 2));
|
||||
EXPECT_EQ(2U, APInt::getBitsNeeded( "+11", 2));
|
||||
EXPECT_EQ(3U, APInt::getBitsNeeded("+100", 2));
|
||||
|
||||
EXPECT_EQ(2U, APInt::getBitsNeeded( "-0", 2));
|
||||
EXPECT_EQ(2U, APInt::getBitsNeeded( "-1", 2));
|
||||
EXPECT_EQ(3U, APInt::getBitsNeeded( "-10", 2));
|
||||
EXPECT_EQ(3U, APInt::getBitsNeeded( "-11", 2));
|
||||
EXPECT_EQ(4U, APInt::getBitsNeeded("-100", 2));
|
||||
}
|
||||
|
||||
TEST(APIntTest, StringBitsNeeded8) {
|
||||
EXPECT_EQ(3U, APInt::getBitsNeeded( "0", 8));
|
||||
EXPECT_EQ(3U, APInt::getBitsNeeded( "7", 8));
|
||||
EXPECT_EQ(6U, APInt::getBitsNeeded("10", 8));
|
||||
EXPECT_EQ(6U, APInt::getBitsNeeded("17", 8));
|
||||
EXPECT_EQ(6U, APInt::getBitsNeeded("20", 8));
|
||||
|
||||
EXPECT_EQ(3U, APInt::getBitsNeeded( "+0", 8));
|
||||
EXPECT_EQ(3U, APInt::getBitsNeeded( "+7", 8));
|
||||
EXPECT_EQ(6U, APInt::getBitsNeeded("+10", 8));
|
||||
EXPECT_EQ(6U, APInt::getBitsNeeded("+17", 8));
|
||||
EXPECT_EQ(6U, APInt::getBitsNeeded("+20", 8));
|
||||
|
||||
EXPECT_EQ(4U, APInt::getBitsNeeded( "-0", 8));
|
||||
EXPECT_EQ(4U, APInt::getBitsNeeded( "-7", 8));
|
||||
EXPECT_EQ(7U, APInt::getBitsNeeded("-10", 8));
|
||||
EXPECT_EQ(7U, APInt::getBitsNeeded("-17", 8));
|
||||
EXPECT_EQ(7U, APInt::getBitsNeeded("-20", 8));
|
||||
}
|
||||
|
||||
TEST(APIntTest, StringBitsNeeded10) {
|
||||
EXPECT_EQ(1U, APInt::getBitsNeeded( "0", 10));
|
||||
EXPECT_EQ(2U, APInt::getBitsNeeded( "3", 10));
|
||||
EXPECT_EQ(4U, APInt::getBitsNeeded( "9", 10));
|
||||
EXPECT_EQ(4U, APInt::getBitsNeeded("10", 10));
|
||||
EXPECT_EQ(5U, APInt::getBitsNeeded("19", 10));
|
||||
EXPECT_EQ(5U, APInt::getBitsNeeded("20", 10));
|
||||
|
||||
EXPECT_EQ(1U, APInt::getBitsNeeded( "+0", 10));
|
||||
EXPECT_EQ(4U, APInt::getBitsNeeded( "+9", 10));
|
||||
EXPECT_EQ(4U, APInt::getBitsNeeded("+10", 10));
|
||||
EXPECT_EQ(5U, APInt::getBitsNeeded("+19", 10));
|
||||
EXPECT_EQ(5U, APInt::getBitsNeeded("+20", 10));
|
||||
|
||||
EXPECT_EQ(2U, APInt::getBitsNeeded( "-0", 10));
|
||||
EXPECT_EQ(5U, APInt::getBitsNeeded( "-9", 10));
|
||||
EXPECT_EQ(5U, APInt::getBitsNeeded("-10", 10));
|
||||
EXPECT_EQ(6U, APInt::getBitsNeeded("-19", 10));
|
||||
EXPECT_EQ(6U, APInt::getBitsNeeded("-20", 10));
|
||||
}
|
||||
|
||||
TEST(APIntTest, StringBitsNeeded16) {
|
||||
EXPECT_EQ(4U, APInt::getBitsNeeded( "0", 16));
|
||||
EXPECT_EQ(4U, APInt::getBitsNeeded( "F", 16));
|
||||
EXPECT_EQ(8U, APInt::getBitsNeeded("10", 16));
|
||||
EXPECT_EQ(8U, APInt::getBitsNeeded("1F", 16));
|
||||
EXPECT_EQ(8U, APInt::getBitsNeeded("20", 16));
|
||||
|
||||
EXPECT_EQ(4U, APInt::getBitsNeeded( "+0", 16));
|
||||
EXPECT_EQ(4U, APInt::getBitsNeeded( "+F", 16));
|
||||
EXPECT_EQ(8U, APInt::getBitsNeeded("+10", 16));
|
||||
EXPECT_EQ(8U, APInt::getBitsNeeded("+1F", 16));
|
||||
EXPECT_EQ(8U, APInt::getBitsNeeded("+20", 16));
|
||||
|
||||
EXPECT_EQ(5U, APInt::getBitsNeeded( "-0", 16));
|
||||
EXPECT_EQ(5U, APInt::getBitsNeeded( "-F", 16));
|
||||
EXPECT_EQ(9U, APInt::getBitsNeeded("-10", 16));
|
||||
EXPECT_EQ(9U, APInt::getBitsNeeded("-1F", 16));
|
||||
EXPECT_EQ(9U, APInt::getBitsNeeded("-20", 16));
|
||||
}
|
||||
|
||||
TEST(APIntTest, Log2) {
|
||||
EXPECT_EQ(APInt(15, 7).logBase2(), 2U);
|
||||
EXPECT_EQ(APInt(15, 7).ceilLogBase2(), 3U);
|
||||
EXPECT_EQ(APInt(15, 7).exactLogBase2(), -1);
|
||||
EXPECT_EQ(APInt(15, 8).logBase2(), 3U);
|
||||
EXPECT_EQ(APInt(15, 8).ceilLogBase2(), 3U);
|
||||
EXPECT_EQ(APInt(15, 8).exactLogBase2(), 3);
|
||||
EXPECT_EQ(APInt(15, 9).logBase2(), 3U);
|
||||
EXPECT_EQ(APInt(15, 9).ceilLogBase2(), 4U);
|
||||
EXPECT_EQ(APInt(15, 9).exactLogBase2(), -1);
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#ifndef NDEBUG
|
||||
TEST(APIntTest, StringDeath) {
|
||||
EXPECT_DEATH(APInt(0, "", 0), "Bitwidth too small");
|
||||
EXPECT_DEATH(APInt(32, "", 0), "Invalid string length");
|
||||
EXPECT_DEATH(APInt(32, "0", 0), "Radix should be 2, 8, 10, or 16!");
|
||||
EXPECT_DEATH(APInt(32, "", 10), "Invalid string length");
|
||||
EXPECT_DEATH(APInt(32, "-", 10), "String is only a sign, needs a value.");
|
||||
EXPECT_DEATH(APInt(1, "1234", 10), "Insufficient bit width");
|
||||
EXPECT_DEATH(APInt(32, "\0", 10), "Invalid string length");
|
||||
EXPECT_DEATH(APInt(32, StringRef("1\02", 3), 10), "Invalid character in digit string");
|
||||
EXPECT_DEATH(APInt(32, "1L", 10), "Invalid character in digit string");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
@ -1,194 +0,0 @@
|
||||
//===- llvm/unittest/ADT/BitVectorTest.cpp - BitVector tests --------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// Some of these tests fail on PowerPC for unknown reasons.
|
||||
#ifndef __ppc__
|
||||
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(BitVectorTest, TrivialOperation) {
|
||||
BitVector Vec;
|
||||
EXPECT_EQ(0U, Vec.count());
|
||||
EXPECT_EQ(0U, Vec.size());
|
||||
EXPECT_FALSE(Vec.any());
|
||||
EXPECT_TRUE(Vec.none());
|
||||
EXPECT_TRUE(Vec.empty());
|
||||
|
||||
Vec.resize(5, true);
|
||||
EXPECT_EQ(5U, Vec.count());
|
||||
EXPECT_EQ(5U, Vec.size());
|
||||
EXPECT_TRUE(Vec.any());
|
||||
EXPECT_FALSE(Vec.none());
|
||||
EXPECT_FALSE(Vec.empty());
|
||||
|
||||
Vec.resize(11);
|
||||
EXPECT_EQ(5U, Vec.count());
|
||||
EXPECT_EQ(11U, Vec.size());
|
||||
EXPECT_TRUE(Vec.any());
|
||||
EXPECT_FALSE(Vec.none());
|
||||
EXPECT_FALSE(Vec.empty());
|
||||
|
||||
BitVector Inv = ~Vec;
|
||||
EXPECT_EQ(6U, Inv.count());
|
||||
EXPECT_EQ(11U, Inv.size());
|
||||
EXPECT_TRUE(Inv.any());
|
||||
EXPECT_FALSE(Inv.none());
|
||||
EXPECT_FALSE(Inv.empty());
|
||||
|
||||
EXPECT_FALSE(Inv == Vec);
|
||||
EXPECT_TRUE(Inv != Vec);
|
||||
Vec = ~Vec;
|
||||
EXPECT_TRUE(Inv == Vec);
|
||||
EXPECT_FALSE(Inv != Vec);
|
||||
|
||||
// Add some "interesting" data to Vec.
|
||||
Vec.resize(23, true);
|
||||
Vec.resize(25, false);
|
||||
Vec.resize(26, true);
|
||||
Vec.resize(29, false);
|
||||
Vec.resize(33, true);
|
||||
Vec.resize(57, false);
|
||||
unsigned Count = 0;
|
||||
for (unsigned i = Vec.find_first(); i != -1u; i = Vec.find_next(i)) {
|
||||
++Count;
|
||||
EXPECT_TRUE(Vec[i]);
|
||||
EXPECT_TRUE(Vec.test(i));
|
||||
}
|
||||
EXPECT_EQ(Count, Vec.count());
|
||||
EXPECT_EQ(Count, 23u);
|
||||
EXPECT_FALSE(Vec[0]);
|
||||
EXPECT_TRUE(Vec[32]);
|
||||
EXPECT_FALSE(Vec[56]);
|
||||
Vec.resize(61, false);
|
||||
|
||||
BitVector Copy = Vec;
|
||||
BitVector Alt(3, false);
|
||||
Alt.resize(6, true);
|
||||
std::swap(Alt, Vec);
|
||||
EXPECT_TRUE(Copy == Alt);
|
||||
EXPECT_TRUE(Vec.size() == 6);
|
||||
EXPECT_TRUE(Vec.count() == 3);
|
||||
EXPECT_TRUE(Vec.find_first() == 3);
|
||||
std::swap(Copy, Vec);
|
||||
|
||||
// Add some more "interesting" data.
|
||||
Vec.resize(68, true);
|
||||
Vec.resize(78, false);
|
||||
Vec.resize(89, true);
|
||||
Vec.resize(90, false);
|
||||
Vec.resize(91, true);
|
||||
Vec.resize(130, false);
|
||||
Count = 0;
|
||||
for (unsigned i = Vec.find_first(); i != -1u; i = Vec.find_next(i)) {
|
||||
++Count;
|
||||
EXPECT_TRUE(Vec[i]);
|
||||
EXPECT_TRUE(Vec.test(i));
|
||||
}
|
||||
EXPECT_EQ(Count, Vec.count());
|
||||
EXPECT_EQ(Count, 42u);
|
||||
EXPECT_FALSE(Vec[0]);
|
||||
EXPECT_TRUE(Vec[32]);
|
||||
EXPECT_FALSE(Vec[60]);
|
||||
EXPECT_FALSE(Vec[129]);
|
||||
|
||||
Vec.flip(60);
|
||||
EXPECT_TRUE(Vec[60]);
|
||||
EXPECT_EQ(Count + 1, Vec.count());
|
||||
Vec.flip(60);
|
||||
EXPECT_FALSE(Vec[60]);
|
||||
EXPECT_EQ(Count, Vec.count());
|
||||
|
||||
Vec.reset(32);
|
||||
EXPECT_FALSE(Vec[32]);
|
||||
EXPECT_EQ(Count - 1, Vec.count());
|
||||
Vec.set(32);
|
||||
EXPECT_TRUE(Vec[32]);
|
||||
EXPECT_EQ(Count, Vec.count());
|
||||
|
||||
Vec.flip();
|
||||
EXPECT_EQ(Vec.size() - Count, Vec.count());
|
||||
|
||||
Vec.reset();
|
||||
EXPECT_EQ(0U, Vec.count());
|
||||
EXPECT_EQ(130U, Vec.size());
|
||||
EXPECT_FALSE(Vec.any());
|
||||
EXPECT_TRUE(Vec.none());
|
||||
EXPECT_FALSE(Vec.empty());
|
||||
|
||||
Inv = ~BitVector();
|
||||
EXPECT_EQ(0U, Inv.count());
|
||||
EXPECT_EQ(0U, Inv.size());
|
||||
EXPECT_FALSE(Inv.any());
|
||||
EXPECT_TRUE(Inv.none());
|
||||
EXPECT_TRUE(Inv.empty());
|
||||
|
||||
Vec.clear();
|
||||
EXPECT_EQ(0U, Vec.count());
|
||||
EXPECT_EQ(0U, Vec.size());
|
||||
EXPECT_FALSE(Vec.any());
|
||||
EXPECT_TRUE(Vec.none());
|
||||
EXPECT_TRUE(Vec.empty());
|
||||
}
|
||||
|
||||
TEST(BitVectorTest, CompoundAssignment) {
|
||||
BitVector A;
|
||||
A.resize(10);
|
||||
A.set(4);
|
||||
A.set(7);
|
||||
|
||||
BitVector B;
|
||||
B.resize(50);
|
||||
B.set(5);
|
||||
B.set(18);
|
||||
|
||||
A |= B;
|
||||
EXPECT_TRUE(A.test(4));
|
||||
EXPECT_TRUE(A.test(5));
|
||||
EXPECT_TRUE(A.test(7));
|
||||
EXPECT_TRUE(A.test(18));
|
||||
EXPECT_EQ(4U, A.count());
|
||||
EXPECT_EQ(50U, A.size());
|
||||
|
||||
B.resize(10);
|
||||
B.set();
|
||||
B.reset(2);
|
||||
B.reset(7);
|
||||
A &= B;
|
||||
EXPECT_FALSE(A.test(2));
|
||||
EXPECT_FALSE(A.test(7));
|
||||
EXPECT_EQ(2U, A.count());
|
||||
EXPECT_EQ(50U, A.size());
|
||||
|
||||
B.resize(100);
|
||||
B.set();
|
||||
|
||||
A ^= B;
|
||||
EXPECT_TRUE(A.test(2));
|
||||
EXPECT_TRUE(A.test(7));
|
||||
EXPECT_EQ(98U, A.count());
|
||||
EXPECT_EQ(100U, A.size());
|
||||
}
|
||||
|
||||
TEST(BitVectorTest, ProxyIndex) {
|
||||
BitVector Vec(3);
|
||||
EXPECT_TRUE(Vec.none());
|
||||
Vec[0] = Vec[1] = Vec[2] = true;
|
||||
EXPECT_EQ(Vec.size(), Vec.count());
|
||||
Vec[2] = Vec[1] = Vec[0] = false;
|
||||
EXPECT_TRUE(Vec.none());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,100 +0,0 @@
|
||||
//===- llvm/unittest/ADT/DeltaAlgorithmTest.cpp ---------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/DeltaAlgorithm.h"
|
||||
#include <algorithm>
|
||||
#include <cstdarg>
|
||||
using namespace llvm;
|
||||
|
||||
namespace std {
|
||||
|
||||
std::ostream &operator<<(std::ostream &OS,
|
||||
const std::set<unsigned> &S) {
|
||||
OS << "{";
|
||||
for (std::set<unsigned>::const_iterator it = S.begin(),
|
||||
ie = S.end(); it != ie; ++it) {
|
||||
if (it != S.begin())
|
||||
OS << ",";
|
||||
OS << *it;
|
||||
}
|
||||
OS << "}";
|
||||
return OS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class FixedDeltaAlgorithm : public DeltaAlgorithm {
|
||||
changeset_ty FailingSet;
|
||||
unsigned NumTests;
|
||||
|
||||
protected:
|
||||
virtual bool ExecuteOneTest(const changeset_ty &Changes) {
|
||||
++NumTests;
|
||||
return std::includes(Changes.begin(), Changes.end(),
|
||||
FailingSet.begin(), FailingSet.end());
|
||||
}
|
||||
|
||||
public:
|
||||
FixedDeltaAlgorithm(const changeset_ty &_FailingSet)
|
||||
: FailingSet(_FailingSet),
|
||||
NumTests(0) {}
|
||||
|
||||
unsigned getNumTests() const { return NumTests; }
|
||||
};
|
||||
|
||||
std::set<unsigned> fixed_set(unsigned N, ...) {
|
||||
std::set<unsigned> S;
|
||||
va_list ap;
|
||||
va_start(ap, N);
|
||||
for (unsigned i = 0; i != N; ++i)
|
||||
S.insert(va_arg(ap, unsigned));
|
||||
va_end(ap);
|
||||
return S;
|
||||
}
|
||||
|
||||
std::set<unsigned> range(unsigned Start, unsigned End) {
|
||||
std::set<unsigned> S;
|
||||
while (Start != End)
|
||||
S.insert(Start++);
|
||||
return S;
|
||||
}
|
||||
|
||||
std::set<unsigned> range(unsigned N) {
|
||||
return range(0, N);
|
||||
}
|
||||
|
||||
TEST(DeltaAlgorithmTest, Basic) {
|
||||
// P = {3,5,7} \in S
|
||||
// [0, 20) should minimize to {3,5,7} in a reasonable number of tests.
|
||||
std::set<unsigned> Fails = fixed_set(3, 3, 5, 7);
|
||||
FixedDeltaAlgorithm FDA(Fails);
|
||||
EXPECT_EQ(fixed_set(3, 3, 5, 7), FDA.Run(range(20)));
|
||||
EXPECT_GE(33U, FDA.getNumTests());
|
||||
|
||||
// P = {3,5,7} \in S
|
||||
// [10, 20) should minimize to [10,20)
|
||||
EXPECT_EQ(range(10,20), FDA.Run(range(10,20)));
|
||||
|
||||
// P = [0,4) \in S
|
||||
// [0, 4) should minimize to [0,4) in 11 tests.
|
||||
//
|
||||
// 11 = |{ {},
|
||||
// {0}, {1}, {2}, {3},
|
||||
// {1, 2, 3}, {0, 2, 3}, {0, 1, 3}, {0, 1, 2},
|
||||
// {0, 1}, {2, 3} }|
|
||||
FDA = FixedDeltaAlgorithm(range(10));
|
||||
EXPECT_EQ(range(4), FDA.Run(range(4)));
|
||||
EXPECT_EQ(11U, FDA.getNumTests());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,179 +0,0 @@
|
||||
//===- llvm/unittest/ADT/DenseMapMap.cpp - DenseMap unit tests --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
// Test fixture
|
||||
class DenseMapTest : public testing::Test {
|
||||
protected:
|
||||
DenseMap<uint32_t, uint32_t> uintMap;
|
||||
DenseMap<uint32_t *, uint32_t *> uintPtrMap;
|
||||
uint32_t dummyInt;
|
||||
};
|
||||
|
||||
// Empty map tests
|
||||
TEST_F(DenseMapTest, EmptyIntMapTest) {
|
||||
// Size tests
|
||||
EXPECT_EQ(0u, uintMap.size());
|
||||
EXPECT_TRUE(uintMap.empty());
|
||||
|
||||
// Iterator tests
|
||||
EXPECT_TRUE(uintMap.begin() == uintMap.end());
|
||||
|
||||
// Lookup tests
|
||||
EXPECT_FALSE(uintMap.count(0u));
|
||||
EXPECT_TRUE(uintMap.find(0u) == uintMap.end());
|
||||
EXPECT_EQ(0u, uintMap.lookup(0u));
|
||||
}
|
||||
|
||||
// Empty map tests for pointer map
|
||||
TEST_F(DenseMapTest, EmptyPtrMapTest) {
|
||||
// Size tests
|
||||
EXPECT_EQ(0u, uintPtrMap.size());
|
||||
EXPECT_TRUE(uintPtrMap.empty());
|
||||
|
||||
// Iterator tests
|
||||
EXPECT_TRUE(uintPtrMap.begin() == uintPtrMap.end());
|
||||
|
||||
// Lookup tests
|
||||
EXPECT_FALSE(uintPtrMap.count(&dummyInt));
|
||||
EXPECT_TRUE(uintPtrMap.find(&dummyInt) == uintPtrMap.begin());
|
||||
EXPECT_EQ(0, uintPtrMap.lookup(&dummyInt));
|
||||
}
|
||||
|
||||
// Constant map tests
|
||||
TEST_F(DenseMapTest, ConstEmptyMapTest) {
|
||||
const DenseMap<uint32_t, uint32_t> & constUintMap = uintMap;
|
||||
const DenseMap<uint32_t *, uint32_t *> & constUintPtrMap = uintPtrMap;
|
||||
EXPECT_EQ(0u, constUintMap.size());
|
||||
EXPECT_EQ(0u, constUintPtrMap.size());
|
||||
EXPECT_TRUE(constUintMap.empty());
|
||||
EXPECT_TRUE(constUintPtrMap.empty());
|
||||
EXPECT_TRUE(constUintMap.begin() == constUintMap.end());
|
||||
EXPECT_TRUE(constUintPtrMap.begin() == constUintPtrMap.end());
|
||||
}
|
||||
|
||||
// A map with a single entry
|
||||
TEST_F(DenseMapTest, SingleEntryMapTest) {
|
||||
uintMap[0] = 1;
|
||||
|
||||
// Size tests
|
||||
EXPECT_EQ(1u, uintMap.size());
|
||||
EXPECT_FALSE(uintMap.begin() == uintMap.end());
|
||||
EXPECT_FALSE(uintMap.empty());
|
||||
|
||||
// Iterator tests
|
||||
DenseMap<uint32_t, uint32_t>::iterator it = uintMap.begin();
|
||||
EXPECT_EQ(0u, it->first);
|
||||
EXPECT_EQ(1u, it->second);
|
||||
++it;
|
||||
EXPECT_TRUE(it == uintMap.end());
|
||||
|
||||
// Lookup tests
|
||||
EXPECT_TRUE(uintMap.count(0u));
|
||||
EXPECT_TRUE(uintMap.find(0u) == uintMap.begin());
|
||||
EXPECT_EQ(1u, uintMap.lookup(0u));
|
||||
EXPECT_EQ(1u, uintMap[0]);
|
||||
}
|
||||
|
||||
// Test clear() method
|
||||
TEST_F(DenseMapTest, ClearTest) {
|
||||
uintMap[0] = 1;
|
||||
uintMap.clear();
|
||||
|
||||
EXPECT_EQ(0u, uintMap.size());
|
||||
EXPECT_TRUE(uintMap.empty());
|
||||
EXPECT_TRUE(uintMap.begin() == uintMap.end());
|
||||
}
|
||||
|
||||
// Test erase(iterator) method
|
||||
TEST_F(DenseMapTest, EraseTest) {
|
||||
uintMap[0] = 1;
|
||||
uintMap.erase(uintMap.begin());
|
||||
|
||||
EXPECT_EQ(0u, uintMap.size());
|
||||
EXPECT_TRUE(uintMap.empty());
|
||||
EXPECT_TRUE(uintMap.begin() == uintMap.end());
|
||||
}
|
||||
|
||||
// Test erase(value) method
|
||||
TEST_F(DenseMapTest, EraseTest2) {
|
||||
uintMap[0] = 1;
|
||||
uintMap.erase(0);
|
||||
|
||||
EXPECT_EQ(0u, uintMap.size());
|
||||
EXPECT_TRUE(uintMap.empty());
|
||||
EXPECT_TRUE(uintMap.begin() == uintMap.end());
|
||||
}
|
||||
|
||||
// Test insert() method
|
||||
TEST_F(DenseMapTest, InsertTest) {
|
||||
uintMap.insert(std::make_pair(0u, 1u));
|
||||
EXPECT_EQ(1u, uintMap.size());
|
||||
EXPECT_EQ(1u, uintMap[0]);
|
||||
}
|
||||
|
||||
// Test copy constructor method
|
||||
TEST_F(DenseMapTest, CopyConstructorTest) {
|
||||
uintMap[0] = 1;
|
||||
DenseMap<uint32_t, uint32_t> copyMap(uintMap);
|
||||
|
||||
EXPECT_EQ(1u, copyMap.size());
|
||||
EXPECT_EQ(1u, copyMap[0]);
|
||||
}
|
||||
|
||||
// Test assignment operator method
|
||||
TEST_F(DenseMapTest, AssignmentTest) {
|
||||
uintMap[0] = 1;
|
||||
DenseMap<uint32_t, uint32_t> copyMap = uintMap;
|
||||
|
||||
EXPECT_EQ(1u, copyMap.size());
|
||||
EXPECT_EQ(1u, copyMap[0]);
|
||||
}
|
||||
|
||||
// A more complex iteration test
|
||||
TEST_F(DenseMapTest, IterationTest) {
|
||||
bool visited[100];
|
||||
|
||||
// Insert 100 numbers into the map
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
visited[i] = false;
|
||||
uintMap[i] = 3;
|
||||
}
|
||||
|
||||
// Iterate over all numbers and mark each one found.
|
||||
for (DenseMap<uint32_t, uint32_t>::iterator it = uintMap.begin();
|
||||
it != uintMap.end(); ++it) {
|
||||
visited[it->first] = true;
|
||||
}
|
||||
|
||||
// Ensure every number was visited.
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
ASSERT_TRUE(visited[i]) << "Entry #" << i << " was never visited";
|
||||
}
|
||||
}
|
||||
|
||||
// const_iterator test
|
||||
TEST_F(DenseMapTest, ConstIteratorTest) {
|
||||
// Check conversion from iterator to const_iterator.
|
||||
DenseMap<uint32_t, uint32_t>::iterator it = uintMap.begin();
|
||||
DenseMap<uint32_t, uint32_t>::const_iterator cit(it);
|
||||
EXPECT_TRUE(it == cit);
|
||||
|
||||
// Check copying of const_iterators.
|
||||
DenseMap<uint32_t, uint32_t>::const_iterator cit2(cit);
|
||||
EXPECT_TRUE(cit == cit2);
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
//===- llvm/unittest/ADT/DenseSetTest.cpp - DenseSet unit tests --*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <llvm/ADT/DenseSet.h>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
// Test fixture
|
||||
class DenseSetTest : public testing::Test {
|
||||
};
|
||||
|
||||
// Test hashing with a set of only two entries.
|
||||
TEST_F(DenseSetTest, DoubleEntrySetTest) {
|
||||
llvm::DenseSet<unsigned> set(2);
|
||||
set.insert(0);
|
||||
set.insert(1);
|
||||
// Original failure was an infinite loop in this call:
|
||||
EXPECT_EQ(0, set.count(2));
|
||||
}
|
||||
|
||||
}
|
@ -1,201 +0,0 @@
|
||||
//===----------- ImmutableSetTest.cpp - ImmutableSet unit tests ------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/ImmutableSet.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
class ImmutableSetTest : public testing::Test {
|
||||
protected:
|
||||
// for callback tests
|
||||
static char buffer[10];
|
||||
|
||||
struct MyIter {
|
||||
int counter;
|
||||
char *ptr;
|
||||
|
||||
MyIter() : counter(0), ptr(buffer) {
|
||||
for (unsigned i=0; i<sizeof(buffer);++i) buffer[i]='\0';
|
||||
}
|
||||
void operator()(char c) {
|
||||
*ptr++ = c;
|
||||
++counter;
|
||||
}
|
||||
};
|
||||
};
|
||||
char ImmutableSetTest::buffer[10];
|
||||
|
||||
|
||||
TEST_F(ImmutableSetTest, EmptyIntSetTest) {
|
||||
ImmutableSet<int>::Factory f;
|
||||
|
||||
EXPECT_TRUE(f.GetEmptySet() == f.GetEmptySet());
|
||||
EXPECT_FALSE(f.GetEmptySet() != f.GetEmptySet());
|
||||
EXPECT_TRUE(f.GetEmptySet().isEmpty());
|
||||
|
||||
ImmutableSet<int> S = f.GetEmptySet();
|
||||
EXPECT_EQ(0u, S.getHeight());
|
||||
EXPECT_TRUE(S.begin() == S.end());
|
||||
EXPECT_FALSE(S.begin() != S.end());
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ImmutableSetTest, OneElemIntSetTest) {
|
||||
ImmutableSet<int>::Factory f;
|
||||
ImmutableSet<int> S = f.GetEmptySet();
|
||||
|
||||
ImmutableSet<int> S2 = f.Add(S, 3);
|
||||
EXPECT_TRUE(S.isEmpty());
|
||||
EXPECT_FALSE(S2.isEmpty());
|
||||
EXPECT_FALSE(S == S2);
|
||||
EXPECT_TRUE(S != S2);
|
||||
EXPECT_FALSE(S.contains(3));
|
||||
EXPECT_TRUE(S2.contains(3));
|
||||
EXPECT_FALSE(S2.begin() == S2.end());
|
||||
EXPECT_TRUE(S2.begin() != S2.end());
|
||||
|
||||
ImmutableSet<int> S3 = f.Add(S, 2);
|
||||
EXPECT_TRUE(S.isEmpty());
|
||||
EXPECT_FALSE(S3.isEmpty());
|
||||
EXPECT_FALSE(S == S3);
|
||||
EXPECT_TRUE(S != S3);
|
||||
EXPECT_FALSE(S.contains(2));
|
||||
EXPECT_TRUE(S3.contains(2));
|
||||
|
||||
EXPECT_FALSE(S2 == S3);
|
||||
EXPECT_TRUE(S2 != S3);
|
||||
EXPECT_FALSE(S2.contains(2));
|
||||
EXPECT_FALSE(S3.contains(3));
|
||||
}
|
||||
|
||||
TEST_F(ImmutableSetTest, MultiElemIntSetTest) {
|
||||
ImmutableSet<int>::Factory f;
|
||||
ImmutableSet<int> S = f.GetEmptySet();
|
||||
|
||||
ImmutableSet<int> S2 = f.Add(f.Add(f.Add(S, 3), 4), 5);
|
||||
ImmutableSet<int> S3 = f.Add(f.Add(f.Add(S2, 9), 20), 43);
|
||||
ImmutableSet<int> S4 = f.Add(S2, 9);
|
||||
|
||||
EXPECT_TRUE(S.isEmpty());
|
||||
EXPECT_FALSE(S2.isEmpty());
|
||||
EXPECT_FALSE(S3.isEmpty());
|
||||
EXPECT_FALSE(S4.isEmpty());
|
||||
|
||||
EXPECT_FALSE(S.contains(3));
|
||||
EXPECT_FALSE(S.contains(9));
|
||||
|
||||
EXPECT_TRUE(S2.contains(3));
|
||||
EXPECT_TRUE(S2.contains(4));
|
||||
EXPECT_TRUE(S2.contains(5));
|
||||
EXPECT_FALSE(S2.contains(9));
|
||||
EXPECT_FALSE(S2.contains(0));
|
||||
|
||||
EXPECT_TRUE(S3.contains(43));
|
||||
EXPECT_TRUE(S3.contains(20));
|
||||
EXPECT_TRUE(S3.contains(9));
|
||||
EXPECT_TRUE(S3.contains(3));
|
||||
EXPECT_TRUE(S3.contains(4));
|
||||
EXPECT_TRUE(S3.contains(5));
|
||||
EXPECT_FALSE(S3.contains(0));
|
||||
|
||||
EXPECT_TRUE(S4.contains(9));
|
||||
EXPECT_TRUE(S4.contains(3));
|
||||
EXPECT_TRUE(S4.contains(4));
|
||||
EXPECT_TRUE(S4.contains(5));
|
||||
EXPECT_FALSE(S4.contains(20));
|
||||
EXPECT_FALSE(S4.contains(43));
|
||||
}
|
||||
|
||||
TEST_F(ImmutableSetTest, RemoveIntSetTest) {
|
||||
ImmutableSet<int>::Factory f;
|
||||
ImmutableSet<int> S = f.GetEmptySet();
|
||||
|
||||
ImmutableSet<int> S2 = f.Add(f.Add(S, 4), 5);
|
||||
ImmutableSet<int> S3 = f.Add(S2, 3);
|
||||
ImmutableSet<int> S4 = f.Remove(S3, 3);
|
||||
|
||||
EXPECT_TRUE(S3.contains(3));
|
||||
EXPECT_FALSE(S2.contains(3));
|
||||
EXPECT_FALSE(S4.contains(3));
|
||||
|
||||
EXPECT_TRUE(S2 == S4);
|
||||
EXPECT_TRUE(S3 != S2);
|
||||
EXPECT_TRUE(S3 != S4);
|
||||
|
||||
EXPECT_TRUE(S3.contains(4));
|
||||
EXPECT_TRUE(S3.contains(5));
|
||||
|
||||
EXPECT_TRUE(S4.contains(4));
|
||||
EXPECT_TRUE(S4.contains(5));
|
||||
}
|
||||
|
||||
TEST_F(ImmutableSetTest, CallbackCharSetTest) {
|
||||
ImmutableSet<char>::Factory f;
|
||||
ImmutableSet<char> S = f.GetEmptySet();
|
||||
|
||||
ImmutableSet<char> S2 = f.Add(f.Add(f.Add(S, 'a'), 'e'), 'i');
|
||||
ImmutableSet<char> S3 = f.Add(f.Add(S2, 'o'), 'u');
|
||||
|
||||
S3.foreach<MyIter>();
|
||||
|
||||
ASSERT_STREQ("aeiou", buffer);
|
||||
}
|
||||
|
||||
TEST_F(ImmutableSetTest, Callback2CharSetTest) {
|
||||
ImmutableSet<char>::Factory f;
|
||||
ImmutableSet<char> S = f.GetEmptySet();
|
||||
|
||||
ImmutableSet<char> S2 = f.Add(f.Add(f.Add(S, 'b'), 'c'), 'd');
|
||||
ImmutableSet<char> S3 = f.Add(f.Add(f.Add(S2, 'f'), 'g'), 'h');
|
||||
|
||||
MyIter obj;
|
||||
S3.foreach<MyIter>(obj);
|
||||
ASSERT_STREQ("bcdfgh", buffer);
|
||||
ASSERT_EQ(6, obj.counter);
|
||||
|
||||
MyIter obj2;
|
||||
S2.foreach<MyIter>(obj2);
|
||||
ASSERT_STREQ("bcd", buffer);
|
||||
ASSERT_EQ(3, obj2.counter);
|
||||
|
||||
MyIter obj3;
|
||||
S.foreach<MyIter>(obj);
|
||||
ASSERT_STREQ("", buffer);
|
||||
ASSERT_EQ(0, obj3.counter);
|
||||
}
|
||||
|
||||
TEST_F(ImmutableSetTest, IterLongSetTest) {
|
||||
ImmutableSet<long>::Factory f;
|
||||
ImmutableSet<long> S = f.GetEmptySet();
|
||||
|
||||
ImmutableSet<long> S2 = f.Add(f.Add(f.Add(S, 0), 1), 2);
|
||||
ImmutableSet<long> S3 = f.Add(f.Add(f.Add(S2, 3), 4), 5);
|
||||
|
||||
int i = 0;
|
||||
for (ImmutableSet<long>::iterator I = S.begin(), E = S.end(); I != E; ++I) {
|
||||
ASSERT_EQ(i++, *I);
|
||||
}
|
||||
ASSERT_EQ(0, i);
|
||||
|
||||
i = 0;
|
||||
for (ImmutableSet<long>::iterator I = S2.begin(), E = S2.end(); I != E; ++I) {
|
||||
ASSERT_EQ(i++, *I);
|
||||
}
|
||||
ASSERT_EQ(3, i);
|
||||
|
||||
i = 0;
|
||||
for (ImmutableSet<long>::iterator I = S3.begin(), E = S3.end(); I != E; I++) {
|
||||
ASSERT_EQ(i++, *I);
|
||||
}
|
||||
ASSERT_EQ(6, i);
|
||||
}
|
||||
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
##===- unittests/ADT/Makefile ------------------------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ../..
|
||||
TESTNAME = ADT
|
||||
LINK_COMPONENTS := core support
|
||||
|
||||
include $(LEVEL)/Makefile.config
|
||||
|
||||
# Xfail BitVectorTest for now on PPC Darwin. 7598360.
|
||||
ifeq ($(ARCH),PowerPC)
|
||||
ifeq ($(TARGET_OS),Darwin)
|
||||
CPP.Flags += -DXFAIL
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest
|
@ -1,189 +0,0 @@
|
||||
//===- llvm/unittest/ADT/SmallBitVectorTest.cpp - SmallBitVector tests ----===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/ADT/SmallBitVector.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(SmallBitVectorTest, TrivialOperation) {
|
||||
SmallBitVector Vec;
|
||||
EXPECT_EQ(0U, Vec.count());
|
||||
EXPECT_EQ(0U, Vec.size());
|
||||
EXPECT_FALSE(Vec.any());
|
||||
EXPECT_TRUE(Vec.none());
|
||||
EXPECT_TRUE(Vec.empty());
|
||||
|
||||
Vec.resize(5, true);
|
||||
EXPECT_EQ(5U, Vec.count());
|
||||
EXPECT_EQ(5U, Vec.size());
|
||||
EXPECT_TRUE(Vec.any());
|
||||
EXPECT_FALSE(Vec.none());
|
||||
EXPECT_FALSE(Vec.empty());
|
||||
|
||||
Vec.resize(11);
|
||||
EXPECT_EQ(5U, Vec.count());
|
||||
EXPECT_EQ(11U, Vec.size());
|
||||
EXPECT_TRUE(Vec.any());
|
||||
EXPECT_FALSE(Vec.none());
|
||||
EXPECT_FALSE(Vec.empty());
|
||||
|
||||
SmallBitVector Inv = ~Vec;
|
||||
EXPECT_EQ(6U, Inv.count());
|
||||
EXPECT_EQ(11U, Inv.size());
|
||||
EXPECT_TRUE(Inv.any());
|
||||
EXPECT_FALSE(Inv.none());
|
||||
EXPECT_FALSE(Inv.empty());
|
||||
|
||||
EXPECT_FALSE(Inv == Vec);
|
||||
EXPECT_TRUE(Inv != Vec);
|
||||
Vec = ~Vec;
|
||||
EXPECT_TRUE(Inv == Vec);
|
||||
EXPECT_FALSE(Inv != Vec);
|
||||
|
||||
// Add some "interesting" data to Vec.
|
||||
Vec.resize(23, true);
|
||||
Vec.resize(25, false);
|
||||
Vec.resize(26, true);
|
||||
Vec.resize(29, false);
|
||||
Vec.resize(33, true);
|
||||
Vec.resize(57, false);
|
||||
unsigned Count = 0;
|
||||
for (unsigned i = Vec.find_first(); i != -1u; i = Vec.find_next(i)) {
|
||||
++Count;
|
||||
EXPECT_TRUE(Vec[i]);
|
||||
EXPECT_TRUE(Vec.test(i));
|
||||
}
|
||||
EXPECT_EQ(Count, Vec.count());
|
||||
EXPECT_EQ(Count, 23u);
|
||||
EXPECT_FALSE(Vec[0]);
|
||||
EXPECT_TRUE(Vec[32]);
|
||||
EXPECT_FALSE(Vec[56]);
|
||||
Vec.resize(61, false);
|
||||
|
||||
SmallBitVector Copy = Vec;
|
||||
SmallBitVector Alt(3, false);
|
||||
Alt.resize(6, true);
|
||||
std::swap(Alt, Vec);
|
||||
EXPECT_TRUE(Copy == Alt);
|
||||
EXPECT_TRUE(Vec.size() == 6);
|
||||
EXPECT_TRUE(Vec.count() == 3);
|
||||
EXPECT_TRUE(Vec.find_first() == 3);
|
||||
std::swap(Copy, Vec);
|
||||
|
||||
// Add some more "interesting" data.
|
||||
Vec.resize(68, true);
|
||||
Vec.resize(78, false);
|
||||
Vec.resize(89, true);
|
||||
Vec.resize(90, false);
|
||||
Vec.resize(91, true);
|
||||
Vec.resize(130, false);
|
||||
Count = 0;
|
||||
for (unsigned i = Vec.find_first(); i != -1u; i = Vec.find_next(i)) {
|
||||
++Count;
|
||||
EXPECT_TRUE(Vec[i]);
|
||||
EXPECT_TRUE(Vec.test(i));
|
||||
}
|
||||
EXPECT_EQ(Count, Vec.count());
|
||||
EXPECT_EQ(Count, 42u);
|
||||
EXPECT_FALSE(Vec[0]);
|
||||
EXPECT_TRUE(Vec[32]);
|
||||
EXPECT_FALSE(Vec[60]);
|
||||
EXPECT_FALSE(Vec[129]);
|
||||
|
||||
Vec.flip(60);
|
||||
EXPECT_TRUE(Vec[60]);
|
||||
EXPECT_EQ(Count + 1, Vec.count());
|
||||
Vec.flip(60);
|
||||
EXPECT_FALSE(Vec[60]);
|
||||
EXPECT_EQ(Count, Vec.count());
|
||||
|
||||
Vec.reset(32);
|
||||
EXPECT_FALSE(Vec[32]);
|
||||
EXPECT_EQ(Count - 1, Vec.count());
|
||||
Vec.set(32);
|
||||
EXPECT_TRUE(Vec[32]);
|
||||
EXPECT_EQ(Count, Vec.count());
|
||||
|
||||
Vec.flip();
|
||||
EXPECT_EQ(Vec.size() - Count, Vec.count());
|
||||
|
||||
Vec.reset();
|
||||
EXPECT_EQ(0U, Vec.count());
|
||||
EXPECT_EQ(130U, Vec.size());
|
||||
EXPECT_FALSE(Vec.any());
|
||||
EXPECT_TRUE(Vec.none());
|
||||
EXPECT_FALSE(Vec.empty());
|
||||
|
||||
Inv = ~SmallBitVector();
|
||||
EXPECT_EQ(0U, Inv.count());
|
||||
EXPECT_EQ(0U, Inv.size());
|
||||
EXPECT_FALSE(Inv.any());
|
||||
EXPECT_TRUE(Inv.none());
|
||||
EXPECT_TRUE(Inv.empty());
|
||||
|
||||
Vec.clear();
|
||||
EXPECT_EQ(0U, Vec.count());
|
||||
EXPECT_EQ(0U, Vec.size());
|
||||
EXPECT_FALSE(Vec.any());
|
||||
EXPECT_TRUE(Vec.none());
|
||||
EXPECT_TRUE(Vec.empty());
|
||||
}
|
||||
|
||||
TEST(SmallBitVectorTest, CompoundAssignment) {
|
||||
SmallBitVector A;
|
||||
A.resize(10);
|
||||
A.set(4);
|
||||
A.set(7);
|
||||
|
||||
SmallBitVector B;
|
||||
B.resize(50);
|
||||
B.set(5);
|
||||
B.set(18);
|
||||
|
||||
A |= B;
|
||||
EXPECT_TRUE(A.test(4));
|
||||
EXPECT_TRUE(A.test(5));
|
||||
EXPECT_TRUE(A.test(7));
|
||||
EXPECT_TRUE(A.test(18));
|
||||
EXPECT_EQ(4U, A.count());
|
||||
EXPECT_EQ(50U, A.size());
|
||||
|
||||
B.resize(10);
|
||||
B.set();
|
||||
B.reset(2);
|
||||
B.reset(7);
|
||||
A &= B;
|
||||
EXPECT_FALSE(A.test(2));
|
||||
EXPECT_FALSE(A.test(7));
|
||||
EXPECT_EQ(2U, A.count());
|
||||
EXPECT_EQ(50U, A.size());
|
||||
|
||||
B.resize(100);
|
||||
B.set();
|
||||
|
||||
A ^= B;
|
||||
EXPECT_TRUE(A.test(2));
|
||||
EXPECT_TRUE(A.test(7));
|
||||
EXPECT_EQ(98U, A.count());
|
||||
EXPECT_EQ(100U, A.size());
|
||||
}
|
||||
|
||||
TEST(SmallBitVectorTest, ProxyIndex) {
|
||||
SmallBitVector Vec(3);
|
||||
EXPECT_TRUE(Vec.none());
|
||||
Vec[0] = Vec[1] = Vec[2] = true;
|
||||
EXPECT_EQ(Vec.size(), Vec.count());
|
||||
Vec[2] = Vec[1] = Vec[0] = false;
|
||||
EXPECT_TRUE(Vec.none());
|
||||
}
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
//===- llvm/unittest/ADT/SmallStringTest.cpp ------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// SmallString unit tests.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include <stdarg.h>
|
||||
#include <climits>
|
||||
#include <cstring>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
// Test fixture class
|
||||
class SmallStringTest : public testing::Test {
|
||||
protected:
|
||||
typedef SmallString<40> StringType;
|
||||
|
||||
StringType theString;
|
||||
|
||||
void assertEmpty(StringType & v) {
|
||||
// Size tests
|
||||
EXPECT_EQ(0u, v.size());
|
||||
EXPECT_TRUE(v.empty());
|
||||
// Iterator tests
|
||||
EXPECT_TRUE(v.begin() == v.end());
|
||||
}
|
||||
};
|
||||
|
||||
// New string test.
|
||||
TEST_F(SmallStringTest, EmptyStringTest) {
|
||||
SCOPED_TRACE("EmptyStringTest");
|
||||
assertEmpty(theString);
|
||||
EXPECT_TRUE(theString.rbegin() == theString.rend());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,408 +0,0 @@
|
||||
//===- llvm/unittest/ADT/SmallVectorTest.cpp ------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// SmallVector unit tests.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include <stdarg.h>
|
||||
#include <list>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
/// A helper class that counts the total number of constructor and
|
||||
/// destructor calls.
|
||||
class Constructable {
|
||||
private:
|
||||
static int numConstructorCalls;
|
||||
static int numDestructorCalls;
|
||||
static int numAssignmentCalls;
|
||||
|
||||
int value;
|
||||
|
||||
public:
|
||||
Constructable() : value(0) {
|
||||
++numConstructorCalls;
|
||||
}
|
||||
|
||||
Constructable(int val) : value(val) {
|
||||
++numConstructorCalls;
|
||||
}
|
||||
|
||||
Constructable(const Constructable & src) {
|
||||
value = src.value;
|
||||
++numConstructorCalls;
|
||||
}
|
||||
|
||||
~Constructable() {
|
||||
++numDestructorCalls;
|
||||
}
|
||||
|
||||
Constructable & operator=(const Constructable & src) {
|
||||
value = src.value;
|
||||
++numAssignmentCalls;
|
||||
return *this;
|
||||
}
|
||||
|
||||
int getValue() const {
|
||||
return abs(value);
|
||||
}
|
||||
|
||||
static void reset() {
|
||||
numConstructorCalls = 0;
|
||||
numDestructorCalls = 0;
|
||||
numAssignmentCalls = 0;
|
||||
}
|
||||
|
||||
static int getNumConstructorCalls() {
|
||||
return numConstructorCalls;
|
||||
}
|
||||
|
||||
static int getNumDestructorCalls() {
|
||||
return numDestructorCalls;
|
||||
}
|
||||
|
||||
friend bool operator==(const Constructable & c0, const Constructable & c1) {
|
||||
return c0.getValue() == c1.getValue();
|
||||
}
|
||||
|
||||
friend bool operator!=(const Constructable & c0, const Constructable & c1) {
|
||||
return c0.getValue() != c1.getValue();
|
||||
}
|
||||
};
|
||||
|
||||
int Constructable::numConstructorCalls;
|
||||
int Constructable::numDestructorCalls;
|
||||
int Constructable::numAssignmentCalls;
|
||||
|
||||
// Test fixture class
|
||||
class SmallVectorTest : public testing::Test {
|
||||
protected:
|
||||
typedef SmallVector<Constructable, 4> VectorType;
|
||||
|
||||
VectorType theVector;
|
||||
VectorType otherVector;
|
||||
|
||||
void SetUp() {
|
||||
Constructable::reset();
|
||||
}
|
||||
|
||||
void assertEmpty(VectorType & v) {
|
||||
// Size tests
|
||||
EXPECT_EQ(0u, v.size());
|
||||
EXPECT_TRUE(v.empty());
|
||||
|
||||
// Iterator tests
|
||||
EXPECT_TRUE(v.begin() == v.end());
|
||||
}
|
||||
|
||||
// Assert that theVector contains the specified values, in order.
|
||||
void assertValuesInOrder(VectorType & v, size_t size, ...) {
|
||||
EXPECT_EQ(size, v.size());
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, size);
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
int value = va_arg(ap, int);
|
||||
EXPECT_EQ(value, v[i].getValue());
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
// Generate a sequence of values to initialize the vector.
|
||||
void makeSequence(VectorType & v, int start, int end) {
|
||||
for (int i = start; i <= end; ++i) {
|
||||
v.push_back(Constructable(i));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// New vector test.
|
||||
TEST_F(SmallVectorTest, EmptyVectorTest) {
|
||||
SCOPED_TRACE("EmptyVectorTest");
|
||||
assertEmpty(theVector);
|
||||
EXPECT_TRUE(theVector.rbegin() == theVector.rend());
|
||||
EXPECT_EQ(0, Constructable::getNumConstructorCalls());
|
||||
EXPECT_EQ(0, Constructable::getNumDestructorCalls());
|
||||
}
|
||||
|
||||
// Simple insertions and deletions.
|
||||
TEST_F(SmallVectorTest, PushPopTest) {
|
||||
SCOPED_TRACE("PushPopTest");
|
||||
|
||||
// Push an element
|
||||
theVector.push_back(Constructable(1));
|
||||
|
||||
// Size tests
|
||||
assertValuesInOrder(theVector, 1u, 1);
|
||||
EXPECT_FALSE(theVector.begin() == theVector.end());
|
||||
EXPECT_FALSE(theVector.empty());
|
||||
|
||||
// Push another element
|
||||
theVector.push_back(Constructable(2));
|
||||
assertValuesInOrder(theVector, 2u, 1, 2);
|
||||
|
||||
// Pop one element
|
||||
theVector.pop_back();
|
||||
assertValuesInOrder(theVector, 1u, 1);
|
||||
|
||||
// Pop another element
|
||||
theVector.pop_back();
|
||||
assertEmpty(theVector);
|
||||
|
||||
// Check number of constructor calls. Should be 2 for each list element,
|
||||
// one for the argument to push_back, and one for the list element itself.
|
||||
EXPECT_EQ(4, Constructable::getNumConstructorCalls());
|
||||
EXPECT_EQ(4, Constructable::getNumDestructorCalls());
|
||||
}
|
||||
|
||||
// Clear test.
|
||||
TEST_F(SmallVectorTest, ClearTest) {
|
||||
SCOPED_TRACE("ClearTest");
|
||||
|
||||
makeSequence(theVector, 1, 2);
|
||||
theVector.clear();
|
||||
|
||||
assertEmpty(theVector);
|
||||
EXPECT_EQ(4, Constructable::getNumConstructorCalls());
|
||||
EXPECT_EQ(4, Constructable::getNumDestructorCalls());
|
||||
}
|
||||
|
||||
// Resize smaller test.
|
||||
TEST_F(SmallVectorTest, ResizeShrinkTest) {
|
||||
SCOPED_TRACE("ResizeShrinkTest");
|
||||
|
||||
makeSequence(theVector, 1, 3);
|
||||
theVector.resize(1);
|
||||
|
||||
assertValuesInOrder(theVector, 1u, 1);
|
||||
EXPECT_EQ(6, Constructable::getNumConstructorCalls());
|
||||
EXPECT_EQ(5, Constructable::getNumDestructorCalls());
|
||||
}
|
||||
|
||||
// Resize bigger test.
|
||||
TEST_F(SmallVectorTest, ResizeGrowTest) {
|
||||
SCOPED_TRACE("ResizeGrowTest");
|
||||
|
||||
theVector.resize(2);
|
||||
|
||||
// The extra constructor/destructor calls come from the temporary object used
|
||||
// to initialize the contents of the resized array (via copy construction).
|
||||
EXPECT_EQ(3, Constructable::getNumConstructorCalls());
|
||||
EXPECT_EQ(1, Constructable::getNumDestructorCalls());
|
||||
EXPECT_EQ(2u, theVector.size());
|
||||
}
|
||||
|
||||
// Resize with fill value.
|
||||
TEST_F(SmallVectorTest, ResizeFillTest) {
|
||||
SCOPED_TRACE("ResizeFillTest");
|
||||
|
||||
theVector.resize(3, Constructable(77));
|
||||
assertValuesInOrder(theVector, 3u, 77, 77, 77);
|
||||
}
|
||||
|
||||
// Overflow past fixed size.
|
||||
TEST_F(SmallVectorTest, OverflowTest) {
|
||||
SCOPED_TRACE("OverflowTest");
|
||||
|
||||
// Push more elements than the fixed size.
|
||||
makeSequence(theVector, 1, 10);
|
||||
|
||||
// Test size and values.
|
||||
EXPECT_EQ(10u, theVector.size());
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
EXPECT_EQ(i+1, theVector[i].getValue());
|
||||
}
|
||||
|
||||
// Now resize back to fixed size.
|
||||
theVector.resize(1);
|
||||
|
||||
assertValuesInOrder(theVector, 1u, 1);
|
||||
}
|
||||
|
||||
// Iteration tests.
|
||||
TEST_F(SmallVectorTest, IterationTest) {
|
||||
makeSequence(theVector, 1, 2);
|
||||
|
||||
// Forward Iteration
|
||||
VectorType::iterator it = theVector.begin();
|
||||
EXPECT_TRUE(*it == theVector.front());
|
||||
EXPECT_TRUE(*it == theVector[0]);
|
||||
EXPECT_EQ(1, it->getValue());
|
||||
++it;
|
||||
EXPECT_TRUE(*it == theVector[1]);
|
||||
EXPECT_TRUE(*it == theVector.back());
|
||||
EXPECT_EQ(2, it->getValue());
|
||||
++it;
|
||||
EXPECT_TRUE(it == theVector.end());
|
||||
--it;
|
||||
EXPECT_TRUE(*it == theVector[1]);
|
||||
EXPECT_EQ(2, it->getValue());
|
||||
--it;
|
||||
EXPECT_TRUE(*it == theVector[0]);
|
||||
EXPECT_EQ(1, it->getValue());
|
||||
|
||||
// Reverse Iteration
|
||||
VectorType::reverse_iterator rit = theVector.rbegin();
|
||||
EXPECT_TRUE(*rit == theVector[1]);
|
||||
EXPECT_EQ(2, rit->getValue());
|
||||
++rit;
|
||||
EXPECT_TRUE(*rit == theVector[0]);
|
||||
EXPECT_EQ(1, rit->getValue());
|
||||
++rit;
|
||||
EXPECT_TRUE(rit == theVector.rend());
|
||||
--rit;
|
||||
EXPECT_TRUE(*rit == theVector[0]);
|
||||
EXPECT_EQ(1, rit->getValue());
|
||||
--rit;
|
||||
EXPECT_TRUE(*rit == theVector[1]);
|
||||
EXPECT_EQ(2, rit->getValue());
|
||||
}
|
||||
|
||||
// Swap test.
|
||||
TEST_F(SmallVectorTest, SwapTest) {
|
||||
SCOPED_TRACE("SwapTest");
|
||||
|
||||
makeSequence(theVector, 1, 2);
|
||||
std::swap(theVector, otherVector);
|
||||
|
||||
assertEmpty(theVector);
|
||||
assertValuesInOrder(otherVector, 2u, 1, 2);
|
||||
}
|
||||
|
||||
// Append test
|
||||
TEST_F(SmallVectorTest, AppendTest) {
|
||||
SCOPED_TRACE("AppendTest");
|
||||
|
||||
makeSequence(otherVector, 2, 3);
|
||||
|
||||
theVector.push_back(Constructable(1));
|
||||
theVector.append(otherVector.begin(), otherVector.end());
|
||||
|
||||
assertValuesInOrder(theVector, 3u, 1, 2, 3);
|
||||
}
|
||||
|
||||
// Append repeated test
|
||||
TEST_F(SmallVectorTest, AppendRepeatedTest) {
|
||||
SCOPED_TRACE("AppendRepeatedTest");
|
||||
|
||||
theVector.push_back(Constructable(1));
|
||||
theVector.append(2, Constructable(77));
|
||||
assertValuesInOrder(theVector, 3u, 1, 77, 77);
|
||||
}
|
||||
|
||||
// Assign test
|
||||
TEST_F(SmallVectorTest, AssignTest) {
|
||||
SCOPED_TRACE("AssignTest");
|
||||
|
||||
theVector.push_back(Constructable(1));
|
||||
theVector.assign(2, Constructable(77));
|
||||
assertValuesInOrder(theVector, 2u, 77, 77);
|
||||
}
|
||||
|
||||
// Erase a single element
|
||||
TEST_F(SmallVectorTest, EraseTest) {
|
||||
SCOPED_TRACE("EraseTest");
|
||||
|
||||
makeSequence(theVector, 1, 3);
|
||||
theVector.erase(theVector.begin());
|
||||
assertValuesInOrder(theVector, 2u, 2, 3);
|
||||
}
|
||||
|
||||
// Erase a range of elements
|
||||
TEST_F(SmallVectorTest, EraseRangeTest) {
|
||||
SCOPED_TRACE("EraseRangeTest");
|
||||
|
||||
makeSequence(theVector, 1, 3);
|
||||
theVector.erase(theVector.begin(), theVector.begin() + 2);
|
||||
assertValuesInOrder(theVector, 1u, 3);
|
||||
}
|
||||
|
||||
// Insert a single element.
|
||||
TEST_F(SmallVectorTest, InsertTest) {
|
||||
SCOPED_TRACE("InsertTest");
|
||||
|
||||
makeSequence(theVector, 1, 3);
|
||||
theVector.insert(theVector.begin() + 1, Constructable(77));
|
||||
assertValuesInOrder(theVector, 4u, 1, 77, 2, 3);
|
||||
}
|
||||
|
||||
// Insert repeated elements.
|
||||
TEST_F(SmallVectorTest, InsertRepeatedTest) {
|
||||
SCOPED_TRACE("InsertRepeatedTest");
|
||||
|
||||
makeSequence(theVector, 10, 15);
|
||||
theVector.insert(theVector.begin() + 1, 2, Constructable(16));
|
||||
assertValuesInOrder(theVector, 8u, 10, 16, 16, 11, 12, 13, 14, 15);
|
||||
}
|
||||
|
||||
// Insert range.
|
||||
TEST_F(SmallVectorTest, InsertRangeTest) {
|
||||
SCOPED_TRACE("InsertRepeatedTest");
|
||||
|
||||
makeSequence(theVector, 1, 3);
|
||||
theVector.insert(theVector.begin() + 1, 3, Constructable(77));
|
||||
assertValuesInOrder(theVector, 6u, 1, 77, 77, 77, 2, 3);
|
||||
}
|
||||
|
||||
// Comparison tests.
|
||||
TEST_F(SmallVectorTest, ComparisonTest) {
|
||||
SCOPED_TRACE("ComparisonTest");
|
||||
|
||||
makeSequence(theVector, 1, 3);
|
||||
makeSequence(otherVector, 1, 3);
|
||||
|
||||
EXPECT_TRUE(theVector == otherVector);
|
||||
EXPECT_FALSE(theVector != otherVector);
|
||||
|
||||
otherVector.clear();
|
||||
makeSequence(otherVector, 2, 4);
|
||||
|
||||
EXPECT_FALSE(theVector == otherVector);
|
||||
EXPECT_TRUE(theVector != otherVector);
|
||||
}
|
||||
|
||||
// Constant vector tests.
|
||||
TEST_F(SmallVectorTest, ConstVectorTest) {
|
||||
const VectorType constVector;
|
||||
|
||||
EXPECT_EQ(0u, constVector.size());
|
||||
EXPECT_TRUE(constVector.empty());
|
||||
EXPECT_TRUE(constVector.begin() == constVector.end());
|
||||
}
|
||||
|
||||
// Direct array access.
|
||||
TEST_F(SmallVectorTest, DirectVectorTest) {
|
||||
EXPECT_EQ(0u, theVector.size());
|
||||
EXPECT_LE(4u, theVector.capacity());
|
||||
EXPECT_EQ(0, Constructable::getNumConstructorCalls());
|
||||
theVector.end()[0] = 1;
|
||||
theVector.end()[1] = 2;
|
||||
theVector.end()[2] = 3;
|
||||
theVector.end()[3] = 4;
|
||||
theVector.set_size(4);
|
||||
EXPECT_EQ(4u, theVector.size());
|
||||
EXPECT_EQ(4, Constructable::getNumConstructorCalls());
|
||||
EXPECT_EQ(1, theVector[0].getValue());
|
||||
EXPECT_EQ(2, theVector[1].getValue());
|
||||
EXPECT_EQ(3, theVector[2].getValue());
|
||||
EXPECT_EQ(4, theVector[3].getValue());
|
||||
}
|
||||
|
||||
TEST_F(SmallVectorTest, IteratorTest) {
|
||||
std::list<int> L;
|
||||
theVector.insert(theVector.end(), L.begin(), L.end());
|
||||
}
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
//===- llvm/unittest/ADT/SparseBitVectorTest.cpp - SparseBitVector tests --===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/ADT/SparseBitVector.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(SparseBitVectorTest, TrivialOperation) {
|
||||
SparseBitVector<> Vec;
|
||||
EXPECT_EQ(0U, Vec.count());
|
||||
EXPECT_FALSE(Vec.test(17));
|
||||
Vec.set(5);
|
||||
EXPECT_TRUE(Vec.test(5));
|
||||
EXPECT_FALSE(Vec.test(17));
|
||||
Vec.reset(6);
|
||||
EXPECT_TRUE(Vec.test(5));
|
||||
EXPECT_FALSE(Vec.test(6));
|
||||
Vec.reset(5);
|
||||
EXPECT_FALSE(Vec.test(5));
|
||||
EXPECT_TRUE(Vec.test_and_set(17));
|
||||
EXPECT_FALSE(Vec.test_and_set(17));
|
||||
EXPECT_TRUE(Vec.test(17));
|
||||
Vec.clear();
|
||||
EXPECT_FALSE(Vec.test(17));
|
||||
}
|
||||
|
||||
}
|
@ -1,207 +0,0 @@
|
||||
//===- llvm/unittest/ADT/StringMapMap.cpp - StringMap unit tests ----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/System/DataTypes.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
// Test fixture
|
||||
class StringMapTest : public testing::Test {
|
||||
protected:
|
||||
StringMap<uint32_t> testMap;
|
||||
|
||||
static const char testKey[];
|
||||
static const uint32_t testValue;
|
||||
static const char* testKeyFirst;
|
||||
static size_t testKeyLength;
|
||||
static const std::string testKeyStr;
|
||||
|
||||
void assertEmptyMap() {
|
||||
// Size tests
|
||||
EXPECT_EQ(0u, testMap.size());
|
||||
EXPECT_TRUE(testMap.empty());
|
||||
|
||||
// Iterator tests
|
||||
EXPECT_TRUE(testMap.begin() == testMap.end());
|
||||
|
||||
// Lookup tests
|
||||
EXPECT_EQ(0u, testMap.count(testKey));
|
||||
EXPECT_EQ(0u, testMap.count(StringRef(testKeyFirst, testKeyLength)));
|
||||
EXPECT_EQ(0u, testMap.count(testKeyStr));
|
||||
EXPECT_TRUE(testMap.find(testKey) == testMap.end());
|
||||
EXPECT_TRUE(testMap.find(StringRef(testKeyFirst, testKeyLength)) ==
|
||||
testMap.end());
|
||||
EXPECT_TRUE(testMap.find(testKeyStr) == testMap.end());
|
||||
}
|
||||
|
||||
void assertSingleItemMap() {
|
||||
// Size tests
|
||||
EXPECT_EQ(1u, testMap.size());
|
||||
EXPECT_FALSE(testMap.begin() == testMap.end());
|
||||
EXPECT_FALSE(testMap.empty());
|
||||
|
||||
// Iterator tests
|
||||
StringMap<uint32_t>::iterator it = testMap.begin();
|
||||
EXPECT_STREQ(testKey, it->first());
|
||||
EXPECT_EQ(testValue, it->second);
|
||||
++it;
|
||||
EXPECT_TRUE(it == testMap.end());
|
||||
|
||||
// Lookup tests
|
||||
EXPECT_EQ(1u, testMap.count(testKey));
|
||||
EXPECT_EQ(1u, testMap.count(StringRef(testKeyFirst, testKeyLength)));
|
||||
EXPECT_EQ(1u, testMap.count(testKeyStr));
|
||||
EXPECT_TRUE(testMap.find(testKey) == testMap.begin());
|
||||
EXPECT_TRUE(testMap.find(StringRef(testKeyFirst, testKeyLength)) ==
|
||||
testMap.begin());
|
||||
EXPECT_TRUE(testMap.find(testKeyStr) == testMap.begin());
|
||||
}
|
||||
};
|
||||
|
||||
const char StringMapTest::testKey[] = "key";
|
||||
const uint32_t StringMapTest::testValue = 1u;
|
||||
const char* StringMapTest::testKeyFirst = testKey;
|
||||
size_t StringMapTest::testKeyLength = sizeof(testKey) - 1;
|
||||
const std::string StringMapTest::testKeyStr(testKey);
|
||||
|
||||
// Empty map tests.
|
||||
TEST_F(StringMapTest, EmptyMapTest) {
|
||||
SCOPED_TRACE("EmptyMapTest");
|
||||
assertEmptyMap();
|
||||
}
|
||||
|
||||
// Constant map tests.
|
||||
TEST_F(StringMapTest, ConstEmptyMapTest) {
|
||||
const StringMap<uint32_t>& constTestMap = testMap;
|
||||
|
||||
// Size tests
|
||||
EXPECT_EQ(0u, constTestMap.size());
|
||||
EXPECT_TRUE(constTestMap.empty());
|
||||
|
||||
// Iterator tests
|
||||
EXPECT_TRUE(constTestMap.begin() == constTestMap.end());
|
||||
|
||||
// Lookup tests
|
||||
EXPECT_EQ(0u, constTestMap.count(testKey));
|
||||
EXPECT_EQ(0u, constTestMap.count(StringRef(testKeyFirst, testKeyLength)));
|
||||
EXPECT_EQ(0u, constTestMap.count(testKeyStr));
|
||||
EXPECT_TRUE(constTestMap.find(testKey) == constTestMap.end());
|
||||
EXPECT_TRUE(constTestMap.find(StringRef(testKeyFirst, testKeyLength)) ==
|
||||
constTestMap.end());
|
||||
EXPECT_TRUE(constTestMap.find(testKeyStr) == constTestMap.end());
|
||||
}
|
||||
|
||||
// A map with a single entry.
|
||||
TEST_F(StringMapTest, SingleEntryMapTest) {
|
||||
SCOPED_TRACE("SingleEntryMapTest");
|
||||
testMap[testKey] = testValue;
|
||||
assertSingleItemMap();
|
||||
}
|
||||
|
||||
// Test clear() method.
|
||||
TEST_F(StringMapTest, ClearTest) {
|
||||
SCOPED_TRACE("ClearTest");
|
||||
testMap[testKey] = testValue;
|
||||
testMap.clear();
|
||||
assertEmptyMap();
|
||||
}
|
||||
|
||||
// Test erase(iterator) method.
|
||||
TEST_F(StringMapTest, EraseIteratorTest) {
|
||||
SCOPED_TRACE("EraseIteratorTest");
|
||||
testMap[testKey] = testValue;
|
||||
testMap.erase(testMap.begin());
|
||||
assertEmptyMap();
|
||||
}
|
||||
|
||||
// Test erase(value) method.
|
||||
TEST_F(StringMapTest, EraseValueTest) {
|
||||
SCOPED_TRACE("EraseValueTest");
|
||||
testMap[testKey] = testValue;
|
||||
testMap.erase(testKey);
|
||||
assertEmptyMap();
|
||||
}
|
||||
|
||||
// Test inserting two values and erasing one.
|
||||
TEST_F(StringMapTest, InsertAndEraseTest) {
|
||||
SCOPED_TRACE("InsertAndEraseTest");
|
||||
testMap[testKey] = testValue;
|
||||
testMap["otherKey"] = 2;
|
||||
testMap.erase("otherKey");
|
||||
assertSingleItemMap();
|
||||
}
|
||||
|
||||
// A more complex iteration test.
|
||||
TEST_F(StringMapTest, IterationTest) {
|
||||
bool visited[100];
|
||||
|
||||
// Insert 100 numbers into the map
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
std::stringstream ss;
|
||||
ss << "key_" << i;
|
||||
testMap[ss.str()] = i;
|
||||
visited[i] = false;
|
||||
}
|
||||
|
||||
// Iterate over all numbers and mark each one found.
|
||||
for (StringMap<uint32_t>::iterator it = testMap.begin();
|
||||
it != testMap.end(); ++it) {
|
||||
std::stringstream ss;
|
||||
ss << "key_" << it->second;
|
||||
ASSERT_STREQ(ss.str().c_str(), it->first());
|
||||
visited[it->second] = true;
|
||||
}
|
||||
|
||||
// Ensure every number was visited.
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
ASSERT_TRUE(visited[i]) << "Entry #" << i << " was never visited";
|
||||
}
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
namespace llvm {
|
||||
|
||||
template <>
|
||||
class StringMapEntryInitializer<uint32_t> {
|
||||
public:
|
||||
template <typename InitTy>
|
||||
static void Initialize(StringMapEntry<uint32_t> &T, InitTy InitVal) {
|
||||
T.second = InitVal;
|
||||
}
|
||||
};
|
||||
|
||||
} // end llvm namespace
|
||||
|
||||
namespace {
|
||||
|
||||
// Test StringMapEntry::Create() method.
|
||||
TEST_F(StringMapTest, StringMapEntryTest) {
|
||||
StringMap<uint32_t>::value_type* entry =
|
||||
StringMap<uint32_t>::value_type::Create(
|
||||
testKeyFirst, testKeyFirst + testKeyLength, 1u);
|
||||
EXPECT_STREQ(testKey, entry->first());
|
||||
EXPECT_EQ(1u, entry->second);
|
||||
free(entry);
|
||||
}
|
||||
|
||||
// Test insert() method.
|
||||
TEST_F(StringMapTest, InsertTest) {
|
||||
SCOPED_TRACE("InsertTest");
|
||||
testMap.insert(
|
||||
StringMap<uint32_t>::value_type::Create(
|
||||
testKeyFirst, testKeyFirst + testKeyLength,
|
||||
testMap.getAllocator(), 1u));
|
||||
assertSingleItemMap();
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
@ -1,273 +0,0 @@
|
||||
//===- llvm/unittest/ADT/StringRefTest.cpp - StringRef unit tests ---------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace llvm {
|
||||
|
||||
std::ostream &operator<<(std::ostream &OS, const StringRef &S) {
|
||||
OS << S;
|
||||
return OS;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &OS,
|
||||
const std::pair<StringRef, StringRef> &P) {
|
||||
OS << "(" << P.first << ", " << P.second << ")";
|
||||
return OS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace {
|
||||
TEST(StringRefTest, Construction) {
|
||||
EXPECT_EQ("", StringRef());
|
||||
EXPECT_EQ("hello", StringRef("hello"));
|
||||
EXPECT_EQ("hello", StringRef("hello world", 5));
|
||||
EXPECT_EQ("hello", StringRef(std::string("hello")));
|
||||
}
|
||||
|
||||
TEST(StringRefTest, Iteration) {
|
||||
StringRef S("hello");
|
||||
const char *p = "hello";
|
||||
for (const char *it = S.begin(), *ie = S.end(); it != ie; ++it, ++p)
|
||||
EXPECT_EQ(*it, *p);
|
||||
}
|
||||
|
||||
TEST(StringRefTest, StringOps) {
|
||||
const char *p = "hello";
|
||||
EXPECT_EQ(p, StringRef(p, 0).data());
|
||||
EXPECT_TRUE(StringRef().empty());
|
||||
EXPECT_EQ((size_t) 5, StringRef("hello").size());
|
||||
EXPECT_EQ(-1, StringRef("aab").compare("aad"));
|
||||
EXPECT_EQ( 0, StringRef("aab").compare("aab"));
|
||||
EXPECT_EQ( 1, StringRef("aab").compare("aaa"));
|
||||
EXPECT_EQ(-1, StringRef("aab").compare("aabb"));
|
||||
EXPECT_EQ( 1, StringRef("aab").compare("aa"));
|
||||
|
||||
EXPECT_EQ(-1, StringRef("aab").compare_numeric("aad"));
|
||||
EXPECT_EQ( 0, StringRef("aab").compare_numeric("aab"));
|
||||
EXPECT_EQ( 1, StringRef("aab").compare_numeric("aaa"));
|
||||
EXPECT_EQ(-1, StringRef("aab").compare_numeric("aabb"));
|
||||
EXPECT_EQ( 1, StringRef("aab").compare_numeric("aa"));
|
||||
EXPECT_EQ(-1, StringRef("1").compare_numeric("10"));
|
||||
EXPECT_EQ( 0, StringRef("10").compare_numeric("10"));
|
||||
EXPECT_EQ( 0, StringRef("10a").compare_numeric("10a"));
|
||||
EXPECT_EQ( 1, StringRef("2").compare_numeric("1"));
|
||||
EXPECT_EQ( 0, StringRef("llvm_v1i64_ty").compare_numeric("llvm_v1i64_ty"));
|
||||
}
|
||||
|
||||
TEST(StringRefTest, Operators) {
|
||||
EXPECT_EQ("", StringRef());
|
||||
EXPECT_TRUE(StringRef("aab") < StringRef("aad"));
|
||||
EXPECT_FALSE(StringRef("aab") < StringRef("aab"));
|
||||
EXPECT_TRUE(StringRef("aab") <= StringRef("aab"));
|
||||
EXPECT_FALSE(StringRef("aab") <= StringRef("aaa"));
|
||||
EXPECT_TRUE(StringRef("aad") > StringRef("aab"));
|
||||
EXPECT_FALSE(StringRef("aab") > StringRef("aab"));
|
||||
EXPECT_TRUE(StringRef("aab") >= StringRef("aab"));
|
||||
EXPECT_FALSE(StringRef("aaa") >= StringRef("aab"));
|
||||
EXPECT_EQ(StringRef("aab"), StringRef("aab"));
|
||||
EXPECT_FALSE(StringRef("aab") == StringRef("aac"));
|
||||
EXPECT_FALSE(StringRef("aab") != StringRef("aab"));
|
||||
EXPECT_TRUE(StringRef("aab") != StringRef("aac"));
|
||||
EXPECT_EQ('a', StringRef("aab")[1]);
|
||||
}
|
||||
|
||||
TEST(StringRefTest, Substr) {
|
||||
StringRef Str("hello");
|
||||
EXPECT_EQ("lo", Str.substr(3));
|
||||
EXPECT_EQ("", Str.substr(100));
|
||||
EXPECT_EQ("hello", Str.substr(0, 100));
|
||||
EXPECT_EQ("o", Str.substr(4, 10));
|
||||
}
|
||||
|
||||
TEST(StringRefTest, Slice) {
|
||||
StringRef Str("hello");
|
||||
EXPECT_EQ("l", Str.slice(2, 3));
|
||||
EXPECT_EQ("ell", Str.slice(1, 4));
|
||||
EXPECT_EQ("llo", Str.slice(2, 100));
|
||||
EXPECT_EQ("", Str.slice(2, 1));
|
||||
EXPECT_EQ("", Str.slice(10, 20));
|
||||
}
|
||||
|
||||
TEST(StringRefTest, Split) {
|
||||
StringRef Str("hello");
|
||||
EXPECT_EQ(std::make_pair(StringRef("hello"), StringRef("")),
|
||||
Str.split('X'));
|
||||
EXPECT_EQ(std::make_pair(StringRef("h"), StringRef("llo")),
|
||||
Str.split('e'));
|
||||
EXPECT_EQ(std::make_pair(StringRef(""), StringRef("ello")),
|
||||
Str.split('h'));
|
||||
EXPECT_EQ(std::make_pair(StringRef("he"), StringRef("lo")),
|
||||
Str.split('l'));
|
||||
EXPECT_EQ(std::make_pair(StringRef("hell"), StringRef("")),
|
||||
Str.split('o'));
|
||||
|
||||
EXPECT_EQ(std::make_pair(StringRef("hello"), StringRef("")),
|
||||
Str.rsplit('X'));
|
||||
EXPECT_EQ(std::make_pair(StringRef("h"), StringRef("llo")),
|
||||
Str.rsplit('e'));
|
||||
EXPECT_EQ(std::make_pair(StringRef(""), StringRef("ello")),
|
||||
Str.rsplit('h'));
|
||||
EXPECT_EQ(std::make_pair(StringRef("hel"), StringRef("o")),
|
||||
Str.rsplit('l'));
|
||||
EXPECT_EQ(std::make_pair(StringRef("hell"), StringRef("")),
|
||||
Str.rsplit('o'));
|
||||
}
|
||||
|
||||
TEST(StringRefTest, Split2) {
|
||||
SmallVector<StringRef, 5> parts;
|
||||
SmallVector<StringRef, 5> expected;
|
||||
|
||||
expected.push_back("ab"); expected.push_back("c");
|
||||
StringRef(",ab,,c,").split(parts, ",", -1, false);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
expected.clear(); parts.clear();
|
||||
expected.push_back(""); expected.push_back("ab"); expected.push_back("");
|
||||
expected.push_back("c"); expected.push_back("");
|
||||
StringRef(",ab,,c,").split(parts, ",", -1, true);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
expected.clear(); parts.clear();
|
||||
expected.push_back("");
|
||||
StringRef("").split(parts, ",", -1, true);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
expected.clear(); parts.clear();
|
||||
StringRef("").split(parts, ",", -1, false);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
expected.clear(); parts.clear();
|
||||
StringRef(",").split(parts, ",", -1, false);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
expected.clear(); parts.clear();
|
||||
expected.push_back(""); expected.push_back("");
|
||||
StringRef(",").split(parts, ",", -1, true);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
expected.clear(); parts.clear();
|
||||
expected.push_back("a"); expected.push_back("b");
|
||||
StringRef("a,b").split(parts, ",", -1, true);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
// Test MaxSplit
|
||||
expected.clear(); parts.clear();
|
||||
expected.push_back("a,,b,c");
|
||||
StringRef("a,,b,c").split(parts, ",", 0, true);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
expected.clear(); parts.clear();
|
||||
expected.push_back("a,,b,c");
|
||||
StringRef("a,,b,c").split(parts, ",", 0, false);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
expected.clear(); parts.clear();
|
||||
expected.push_back("a"); expected.push_back(",b,c");
|
||||
StringRef("a,,b,c").split(parts, ",", 1, true);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
expected.clear(); parts.clear();
|
||||
expected.push_back("a"); expected.push_back(",b,c");
|
||||
StringRef("a,,b,c").split(parts, ",", 1, false);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
expected.clear(); parts.clear();
|
||||
expected.push_back("a"); expected.push_back(""); expected.push_back("b,c");
|
||||
StringRef("a,,b,c").split(parts, ",", 2, true);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
expected.clear(); parts.clear();
|
||||
expected.push_back("a"); expected.push_back("b,c");
|
||||
StringRef("a,,b,c").split(parts, ",", 2, false);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
expected.clear(); parts.clear();
|
||||
expected.push_back("a"); expected.push_back(""); expected.push_back("b");
|
||||
expected.push_back("c");
|
||||
StringRef("a,,b,c").split(parts, ",", 3, true);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
|
||||
expected.clear(); parts.clear();
|
||||
expected.push_back("a"); expected.push_back("b"); expected.push_back("c");
|
||||
StringRef("a,,b,c").split(parts, ",", 3, false);
|
||||
EXPECT_TRUE(parts == expected);
|
||||
}
|
||||
|
||||
TEST(StringRefTest, StartsWith) {
|
||||
StringRef Str("hello");
|
||||
EXPECT_TRUE(Str.startswith("he"));
|
||||
EXPECT_FALSE(Str.startswith("helloworld"));
|
||||
EXPECT_FALSE(Str.startswith("hi"));
|
||||
}
|
||||
|
||||
TEST(StringRefTest, EndsWith) {
|
||||
StringRef Str("hello");
|
||||
EXPECT_TRUE(Str.endswith("lo"));
|
||||
EXPECT_FALSE(Str.endswith("helloworld"));
|
||||
EXPECT_FALSE(Str.endswith("worldhello"));
|
||||
EXPECT_FALSE(Str.endswith("so"));
|
||||
}
|
||||
|
||||
TEST(StringRefTest, Find) {
|
||||
StringRef Str("hello");
|
||||
EXPECT_EQ(2U, Str.find('l'));
|
||||
EXPECT_EQ(StringRef::npos, Str.find('z'));
|
||||
EXPECT_EQ(StringRef::npos, Str.find("helloworld"));
|
||||
EXPECT_EQ(0U, Str.find("hello"));
|
||||
EXPECT_EQ(1U, Str.find("ello"));
|
||||
EXPECT_EQ(StringRef::npos, Str.find("zz"));
|
||||
EXPECT_EQ(2U, Str.find("ll", 2));
|
||||
EXPECT_EQ(StringRef::npos, Str.find("ll", 3));
|
||||
|
||||
EXPECT_EQ(3U, Str.rfind('l'));
|
||||
EXPECT_EQ(StringRef::npos, Str.rfind('z'));
|
||||
EXPECT_EQ(StringRef::npos, Str.rfind("helloworld"));
|
||||
EXPECT_EQ(0U, Str.rfind("hello"));
|
||||
EXPECT_EQ(1U, Str.rfind("ello"));
|
||||
EXPECT_EQ(StringRef::npos, Str.rfind("zz"));
|
||||
|
||||
EXPECT_EQ(2U, Str.find_first_of('l'));
|
||||
EXPECT_EQ(1U, Str.find_first_of("el"));
|
||||
EXPECT_EQ(StringRef::npos, Str.find_first_of("xyz"));
|
||||
|
||||
EXPECT_EQ(1U, Str.find_first_not_of('h'));
|
||||
EXPECT_EQ(4U, Str.find_first_not_of("hel"));
|
||||
EXPECT_EQ(StringRef::npos, Str.find_first_not_of("hello"));
|
||||
}
|
||||
|
||||
TEST(StringRefTest, Count) {
|
||||
StringRef Str("hello");
|
||||
EXPECT_EQ(2U, Str.count('l'));
|
||||
EXPECT_EQ(1U, Str.count('o'));
|
||||
EXPECT_EQ(0U, Str.count('z'));
|
||||
EXPECT_EQ(0U, Str.count("helloworld"));
|
||||
EXPECT_EQ(1U, Str.count("hello"));
|
||||
EXPECT_EQ(1U, Str.count("ello"));
|
||||
EXPECT_EQ(0U, Str.count("zz"));
|
||||
}
|
||||
|
||||
TEST(StringRefTest, EditDistance) {
|
||||
StringRef Str("hello");
|
||||
EXPECT_EQ(2U, Str.edit_distance("hill"));
|
||||
}
|
||||
|
||||
TEST(StringRefTest, Misc) {
|
||||
std::string Storage;
|
||||
raw_string_ostream OS(Storage);
|
||||
OS << StringRef("hello");
|
||||
EXPECT_EQ("hello", OS.str());
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
@ -1,149 +0,0 @@
|
||||
//===----------- Triple.cpp - Triple unit tests ---------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(TripleTest, BasicParsing) {
|
||||
Triple T;
|
||||
|
||||
T = Triple("");
|
||||
EXPECT_EQ("", T.getArchName().str());
|
||||
EXPECT_EQ("", T.getVendorName().str());
|
||||
EXPECT_EQ("", T.getOSName().str());
|
||||
EXPECT_EQ("", T.getEnvironmentName().str());
|
||||
|
||||
T = Triple("-");
|
||||
EXPECT_EQ("", T.getArchName().str());
|
||||
EXPECT_EQ("", T.getVendorName().str());
|
||||
EXPECT_EQ("", T.getOSName().str());
|
||||
EXPECT_EQ("", T.getEnvironmentName().str());
|
||||
|
||||
T = Triple("--");
|
||||
EXPECT_EQ("", T.getArchName().str());
|
||||
EXPECT_EQ("", T.getVendorName().str());
|
||||
EXPECT_EQ("", T.getOSName().str());
|
||||
EXPECT_EQ("", T.getEnvironmentName().str());
|
||||
|
||||
T = Triple("---");
|
||||
EXPECT_EQ("", T.getArchName().str());
|
||||
EXPECT_EQ("", T.getVendorName().str());
|
||||
EXPECT_EQ("", T.getOSName().str());
|
||||
EXPECT_EQ("", T.getEnvironmentName().str());
|
||||
|
||||
T = Triple("----");
|
||||
EXPECT_EQ("", T.getArchName().str());
|
||||
EXPECT_EQ("", T.getVendorName().str());
|
||||
EXPECT_EQ("", T.getOSName().str());
|
||||
EXPECT_EQ("-", T.getEnvironmentName().str());
|
||||
|
||||
T = Triple("a");
|
||||
EXPECT_EQ("a", T.getArchName().str());
|
||||
EXPECT_EQ("", T.getVendorName().str());
|
||||
EXPECT_EQ("", T.getOSName().str());
|
||||
EXPECT_EQ("", T.getEnvironmentName().str());
|
||||
|
||||
T = Triple("a-b");
|
||||
EXPECT_EQ("a", T.getArchName().str());
|
||||
EXPECT_EQ("b", T.getVendorName().str());
|
||||
EXPECT_EQ("", T.getOSName().str());
|
||||
EXPECT_EQ("", T.getEnvironmentName().str());
|
||||
|
||||
T = Triple("a-b-c");
|
||||
EXPECT_EQ("a", T.getArchName().str());
|
||||
EXPECT_EQ("b", T.getVendorName().str());
|
||||
EXPECT_EQ("c", T.getOSName().str());
|
||||
EXPECT_EQ("", T.getEnvironmentName().str());
|
||||
|
||||
T = Triple("a-b-c-d");
|
||||
EXPECT_EQ("a", T.getArchName().str());
|
||||
EXPECT_EQ("b", T.getVendorName().str());
|
||||
EXPECT_EQ("c", T.getOSName().str());
|
||||
EXPECT_EQ("d", T.getEnvironmentName().str());
|
||||
}
|
||||
|
||||
TEST(TripleTest, ParsedIDs) {
|
||||
Triple T;
|
||||
|
||||
T = Triple("i386-apple-darwin");
|
||||
EXPECT_EQ(Triple::x86, T.getArch());
|
||||
EXPECT_EQ(Triple::Apple, T.getVendor());
|
||||
EXPECT_EQ(Triple::Darwin, T.getOS());
|
||||
|
||||
T = Triple("x86_64-pc-linux-gnu");
|
||||
EXPECT_EQ(Triple::x86_64, T.getArch());
|
||||
EXPECT_EQ(Triple::PC, T.getVendor());
|
||||
EXPECT_EQ(Triple::Linux, T.getOS());
|
||||
|
||||
T = Triple("powerpc-dunno-notsure");
|
||||
EXPECT_EQ(Triple::ppc, T.getArch());
|
||||
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
|
||||
EXPECT_EQ(Triple::UnknownOS, T.getOS());
|
||||
|
||||
T = Triple("huh");
|
||||
EXPECT_EQ(Triple::UnknownArch, T.getArch());
|
||||
|
||||
// Two exceptional cases.
|
||||
|
||||
T = Triple("i386-mingw32");
|
||||
EXPECT_EQ(Triple::x86, T.getArch());
|
||||
EXPECT_EQ(Triple::PC, T.getVendor());
|
||||
EXPECT_EQ(Triple::MinGW32, T.getOS());
|
||||
|
||||
T = Triple("arm-elf");
|
||||
EXPECT_EQ(Triple::arm, T.getArch());
|
||||
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
|
||||
EXPECT_EQ(Triple::UnknownOS, T.getOS());
|
||||
}
|
||||
|
||||
TEST(TripleTest, MutateName) {
|
||||
Triple T;
|
||||
EXPECT_EQ(Triple::UnknownArch, T.getArch());
|
||||
EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
|
||||
EXPECT_EQ(Triple::UnknownOS, T.getOS());
|
||||
|
||||
T.setArchName("i386");
|
||||
EXPECT_EQ(Triple::x86, T.getArch());
|
||||
EXPECT_EQ("i386--", T.getTriple());
|
||||
|
||||
T.setVendorName("pc");
|
||||
EXPECT_EQ(Triple::x86, T.getArch());
|
||||
EXPECT_EQ(Triple::PC, T.getVendor());
|
||||
EXPECT_EQ("i386-pc-", T.getTriple());
|
||||
|
||||
T.setOSName("linux");
|
||||
EXPECT_EQ(Triple::x86, T.getArch());
|
||||
EXPECT_EQ(Triple::PC, T.getVendor());
|
||||
EXPECT_EQ(Triple::Linux, T.getOS());
|
||||
EXPECT_EQ("i386-pc-linux", T.getTriple());
|
||||
|
||||
T.setEnvironmentName("gnu");
|
||||
EXPECT_EQ(Triple::x86, T.getArch());
|
||||
EXPECT_EQ(Triple::PC, T.getVendor());
|
||||
EXPECT_EQ(Triple::Linux, T.getOS());
|
||||
EXPECT_EQ("i386-pc-linux-gnu", T.getTriple());
|
||||
|
||||
T.setOSName("freebsd");
|
||||
EXPECT_EQ(Triple::x86, T.getArch());
|
||||
EXPECT_EQ(Triple::PC, T.getVendor());
|
||||
EXPECT_EQ(Triple::FreeBSD, T.getOS());
|
||||
EXPECT_EQ("i386-pc-freebsd-gnu", T.getTriple());
|
||||
|
||||
T.setOSAndEnvironmentName("darwin");
|
||||
EXPECT_EQ(Triple::x86, T.getArch());
|
||||
EXPECT_EQ(Triple::PC, T.getVendor());
|
||||
EXPECT_EQ(Triple::Darwin, T.getOS());
|
||||
EXPECT_EQ("i386-pc-darwin", T.getTriple());
|
||||
}
|
||||
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
//===- TwineTest.cpp - Twine unit tests -----------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
std::string repr(const Twine &Value) {
|
||||
std::string res;
|
||||
llvm::raw_string_ostream OS(res);
|
||||
Value.printRepr(OS);
|
||||
return OS.str();
|
||||
}
|
||||
|
||||
TEST(TwineTest, Construction) {
|
||||
EXPECT_EQ("", Twine().str());
|
||||
EXPECT_EQ("hi", Twine("hi").str());
|
||||
EXPECT_EQ("hi", Twine(std::string("hi")).str());
|
||||
EXPECT_EQ("hi", Twine(StringRef("hi")).str());
|
||||
EXPECT_EQ("hi", Twine(StringRef(std::string("hi"))).str());
|
||||
EXPECT_EQ("hi", Twine(StringRef("hithere", 2)).str());
|
||||
}
|
||||
|
||||
TEST(TwineTest, Numbers) {
|
||||
EXPECT_EQ("123", Twine(123U).str());
|
||||
EXPECT_EQ("123", Twine(123).str());
|
||||
EXPECT_EQ("-123", Twine(-123).str());
|
||||
EXPECT_EQ("123", Twine(123).str());
|
||||
EXPECT_EQ("-123", Twine(-123).str());
|
||||
EXPECT_EQ("123", Twine((char) 123).str());
|
||||
EXPECT_EQ("-123", Twine((signed char) -123).str());
|
||||
|
||||
EXPECT_EQ("7b", Twine::utohexstr(123).str());
|
||||
}
|
||||
|
||||
TEST(TwineTest, Concat) {
|
||||
// Check verse repr, since we care about the actual representation not just
|
||||
// the result.
|
||||
|
||||
// Concat with null.
|
||||
EXPECT_EQ("(Twine null empty)",
|
||||
repr(Twine("hi").concat(Twine::createNull())));
|
||||
EXPECT_EQ("(Twine null empty)",
|
||||
repr(Twine::createNull().concat(Twine("hi"))));
|
||||
|
||||
// Concat with empty.
|
||||
EXPECT_EQ("(Twine cstring:\"hi\" empty)",
|
||||
repr(Twine("hi").concat(Twine())));
|
||||
EXPECT_EQ("(Twine cstring:\"hi\" empty)",
|
||||
repr(Twine().concat(Twine("hi"))));
|
||||
|
||||
// Concatenation of unary ropes.
|
||||
EXPECT_EQ("(Twine cstring:\"a\" cstring:\"b\")",
|
||||
repr(Twine("a").concat(Twine("b"))));
|
||||
|
||||
// Concatenation of other ropes.
|
||||
EXPECT_EQ("(Twine rope:(Twine cstring:\"a\" cstring:\"b\") cstring:\"c\")",
|
||||
repr(Twine("a").concat(Twine("b")).concat(Twine("c"))));
|
||||
EXPECT_EQ("(Twine cstring:\"a\" rope:(Twine cstring:\"b\" cstring:\"c\"))",
|
||||
repr(Twine("a").concat(Twine("b").concat(Twine("c")))));
|
||||
}
|
||||
|
||||
// I suppose linking in the entire code generator to add a unit test to check
|
||||
// the code size of the concat operation is overkill... :)
|
||||
|
||||
} // end anonymous namespace
|
@ -1,294 +0,0 @@
|
||||
//===- llvm/unittest/ADT/ValueMapTest.cpp - ValueMap unit tests -*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/ADT/ValueMap.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/Config/config.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
// Test fixture
|
||||
template<typename T>
|
||||
class ValueMapTest : public testing::Test {
|
||||
protected:
|
||||
Constant *ConstantV;
|
||||
OwningPtr<BitCastInst> BitcastV;
|
||||
OwningPtr<BinaryOperator> AddV;
|
||||
|
||||
ValueMapTest() :
|
||||
ConstantV(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 0)),
|
||||
BitcastV(new BitCastInst(ConstantV, Type::getInt32Ty(getGlobalContext()))),
|
||||
AddV(BinaryOperator::CreateAdd(ConstantV, ConstantV)) {
|
||||
}
|
||||
};
|
||||
|
||||
// Run everything on Value*, a subtype to make sure that casting works as
|
||||
// expected, and a const subtype to make sure we cast const correctly.
|
||||
typedef ::testing::Types<Value, Instruction, const Instruction> KeyTypes;
|
||||
TYPED_TEST_CASE(ValueMapTest, KeyTypes);
|
||||
|
||||
TYPED_TEST(ValueMapTest, Null) {
|
||||
ValueMap<TypeParam*, int> VM1;
|
||||
VM1[NULL] = 7;
|
||||
EXPECT_EQ(7, VM1.lookup(NULL));
|
||||
}
|
||||
|
||||
TYPED_TEST(ValueMapTest, FollowsValue) {
|
||||
ValueMap<TypeParam*, int> VM;
|
||||
VM[this->BitcastV.get()] = 7;
|
||||
EXPECT_EQ(7, VM.lookup(this->BitcastV.get()));
|
||||
EXPECT_EQ(0, VM.count(this->AddV.get()));
|
||||
this->BitcastV->replaceAllUsesWith(this->AddV.get());
|
||||
EXPECT_EQ(7, VM.lookup(this->AddV.get()));
|
||||
EXPECT_EQ(0, VM.count(this->BitcastV.get()));
|
||||
this->AddV.reset();
|
||||
EXPECT_EQ(0, VM.count(this->AddV.get()));
|
||||
EXPECT_EQ(0, VM.count(this->BitcastV.get()));
|
||||
EXPECT_EQ(0U, VM.size());
|
||||
}
|
||||
|
||||
TYPED_TEST(ValueMapTest, OperationsWork) {
|
||||
ValueMap<TypeParam*, int> VM;
|
||||
ValueMap<TypeParam*, int> VM2(16); (void)VM2;
|
||||
typename ValueMapConfig<TypeParam*>::ExtraData Data;
|
||||
ValueMap<TypeParam*, int> VM3(Data, 16); (void)VM3;
|
||||
EXPECT_TRUE(VM.empty());
|
||||
|
||||
VM[this->BitcastV.get()] = 7;
|
||||
|
||||
// Find:
|
||||
typename ValueMap<TypeParam*, int>::iterator I =
|
||||
VM.find(this->BitcastV.get());
|
||||
ASSERT_TRUE(I != VM.end());
|
||||
EXPECT_EQ(this->BitcastV.get(), I->first);
|
||||
EXPECT_EQ(7, I->second);
|
||||
EXPECT_TRUE(VM.find(this->AddV.get()) == VM.end());
|
||||
|
||||
// Const find:
|
||||
const ValueMap<TypeParam*, int> &CVM = VM;
|
||||
typename ValueMap<TypeParam*, int>::const_iterator CI =
|
||||
CVM.find(this->BitcastV.get());
|
||||
ASSERT_TRUE(CI != CVM.end());
|
||||
EXPECT_EQ(this->BitcastV.get(), CI->first);
|
||||
EXPECT_EQ(7, CI->second);
|
||||
EXPECT_TRUE(CVM.find(this->AddV.get()) == CVM.end());
|
||||
|
||||
// Insert:
|
||||
std::pair<typename ValueMap<TypeParam*, int>::iterator, bool> InsertResult1 =
|
||||
VM.insert(std::make_pair(this->AddV.get(), 3));
|
||||
EXPECT_EQ(this->AddV.get(), InsertResult1.first->first);
|
||||
EXPECT_EQ(3, InsertResult1.first->second);
|
||||
EXPECT_TRUE(InsertResult1.second);
|
||||
EXPECT_EQ(true, VM.count(this->AddV.get()));
|
||||
std::pair<typename ValueMap<TypeParam*, int>::iterator, bool> InsertResult2 =
|
||||
VM.insert(std::make_pair(this->AddV.get(), 5));
|
||||
EXPECT_EQ(this->AddV.get(), InsertResult2.first->first);
|
||||
EXPECT_EQ(3, InsertResult2.first->second);
|
||||
EXPECT_FALSE(InsertResult2.second);
|
||||
|
||||
// Erase:
|
||||
VM.erase(InsertResult2.first);
|
||||
EXPECT_EQ(false, VM.count(this->AddV.get()));
|
||||
EXPECT_EQ(true, VM.count(this->BitcastV.get()));
|
||||
VM.erase(this->BitcastV.get());
|
||||
EXPECT_EQ(false, VM.count(this->BitcastV.get()));
|
||||
EXPECT_EQ(0U, VM.size());
|
||||
|
||||
// Range insert:
|
||||
SmallVector<std::pair<Instruction*, int>, 2> Elems;
|
||||
Elems.push_back(std::make_pair(this->AddV.get(), 1));
|
||||
Elems.push_back(std::make_pair(this->BitcastV.get(), 2));
|
||||
VM.insert(Elems.begin(), Elems.end());
|
||||
EXPECT_EQ(1, VM.lookup(this->AddV.get()));
|
||||
EXPECT_EQ(2, VM.lookup(this->BitcastV.get()));
|
||||
}
|
||||
|
||||
template<typename ExpectedType, typename VarType>
|
||||
void CompileAssertHasType(VarType) {
|
||||
typedef char assert[is_same<ExpectedType, VarType>::value ? 1 : -1];
|
||||
}
|
||||
|
||||
TYPED_TEST(ValueMapTest, Iteration) {
|
||||
ValueMap<TypeParam*, int> VM;
|
||||
VM[this->BitcastV.get()] = 2;
|
||||
VM[this->AddV.get()] = 3;
|
||||
size_t size = 0;
|
||||
for (typename ValueMap<TypeParam*, int>::iterator I = VM.begin(), E = VM.end();
|
||||
I != E; ++I) {
|
||||
++size;
|
||||
std::pair<TypeParam*, int> value = *I; (void)value;
|
||||
CompileAssertHasType<TypeParam*>(I->first);
|
||||
if (I->second == 2) {
|
||||
EXPECT_EQ(this->BitcastV.get(), I->first);
|
||||
I->second = 5;
|
||||
} else if (I->second == 3) {
|
||||
EXPECT_EQ(this->AddV.get(), I->first);
|
||||
I->second = 6;
|
||||
} else {
|
||||
ADD_FAILURE() << "Iterated through an extra value.";
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(2U, size);
|
||||
EXPECT_EQ(5, VM[this->BitcastV.get()]);
|
||||
EXPECT_EQ(6, VM[this->AddV.get()]);
|
||||
|
||||
size = 0;
|
||||
// Cast to const ValueMap to avoid a bug in DenseMap's iterators.
|
||||
const ValueMap<TypeParam*, int>& CVM = VM;
|
||||
for (typename ValueMap<TypeParam*, int>::const_iterator I = CVM.begin(),
|
||||
E = CVM.end(); I != E; ++I) {
|
||||
++size;
|
||||
std::pair<TypeParam*, int> value = *I; (void)value;
|
||||
CompileAssertHasType<TypeParam*>(I->first);
|
||||
if (I->second == 5) {
|
||||
EXPECT_EQ(this->BitcastV.get(), I->first);
|
||||
} else if (I->second == 6) {
|
||||
EXPECT_EQ(this->AddV.get(), I->first);
|
||||
} else {
|
||||
ADD_FAILURE() << "Iterated through an extra value.";
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(2U, size);
|
||||
}
|
||||
|
||||
TYPED_TEST(ValueMapTest, DefaultCollisionBehavior) {
|
||||
// By default, we overwrite the old value with the replaced value.
|
||||
ValueMap<TypeParam*, int> VM;
|
||||
VM[this->BitcastV.get()] = 7;
|
||||
VM[this->AddV.get()] = 9;
|
||||
this->BitcastV->replaceAllUsesWith(this->AddV.get());
|
||||
EXPECT_EQ(0, VM.count(this->BitcastV.get()));
|
||||
EXPECT_EQ(9, VM.lookup(this->AddV.get()));
|
||||
}
|
||||
|
||||
TYPED_TEST(ValueMapTest, ConfiguredCollisionBehavior) {
|
||||
// TODO: Implement this when someone needs it.
|
||||
}
|
||||
|
||||
template<typename KeyT>
|
||||
struct LockMutex : ValueMapConfig<KeyT> {
|
||||
struct ExtraData {
|
||||
sys::Mutex *M;
|
||||
bool *CalledRAUW;
|
||||
bool *CalledDeleted;
|
||||
};
|
||||
static void onRAUW(const ExtraData &Data, KeyT Old, KeyT New) {
|
||||
*Data.CalledRAUW = true;
|
||||
EXPECT_FALSE(Data.M->tryacquire()) << "Mutex should already be locked.";
|
||||
}
|
||||
static void onDelete(const ExtraData &Data, KeyT Old) {
|
||||
*Data.CalledDeleted = true;
|
||||
EXPECT_FALSE(Data.M->tryacquire()) << "Mutex should already be locked.";
|
||||
}
|
||||
static sys::Mutex *getMutex(const ExtraData &Data) { return Data.M; }
|
||||
};
|
||||
#if ENABLE_THREADS
|
||||
TYPED_TEST(ValueMapTest, LocksMutex) {
|
||||
sys::Mutex M(false); // Not recursive.
|
||||
bool CalledRAUW = false, CalledDeleted = false;
|
||||
typename LockMutex<TypeParam*>::ExtraData Data =
|
||||
{&M, &CalledRAUW, &CalledDeleted};
|
||||
ValueMap<TypeParam*, int, LockMutex<TypeParam*> > VM(Data);
|
||||
VM[this->BitcastV.get()] = 7;
|
||||
this->BitcastV->replaceAllUsesWith(this->AddV.get());
|
||||
this->AddV.reset();
|
||||
EXPECT_TRUE(CalledRAUW);
|
||||
EXPECT_TRUE(CalledDeleted);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename KeyT>
|
||||
struct NoFollow : ValueMapConfig<KeyT> {
|
||||
enum { FollowRAUW = false };
|
||||
};
|
||||
|
||||
TYPED_TEST(ValueMapTest, NoFollowRAUW) {
|
||||
ValueMap<TypeParam*, int, NoFollow<TypeParam*> > VM;
|
||||
VM[this->BitcastV.get()] = 7;
|
||||
EXPECT_EQ(7, VM.lookup(this->BitcastV.get()));
|
||||
EXPECT_EQ(0, VM.count(this->AddV.get()));
|
||||
this->BitcastV->replaceAllUsesWith(this->AddV.get());
|
||||
EXPECT_EQ(7, VM.lookup(this->BitcastV.get()));
|
||||
EXPECT_EQ(0, VM.lookup(this->AddV.get()));
|
||||
this->AddV.reset();
|
||||
EXPECT_EQ(7, VM.lookup(this->BitcastV.get()));
|
||||
EXPECT_EQ(0, VM.lookup(this->AddV.get()));
|
||||
this->BitcastV.reset();
|
||||
EXPECT_EQ(0, VM.lookup(this->BitcastV.get()));
|
||||
EXPECT_EQ(0, VM.lookup(this->AddV.get()));
|
||||
EXPECT_EQ(0U, VM.size());
|
||||
}
|
||||
|
||||
template<typename KeyT>
|
||||
struct CountOps : ValueMapConfig<KeyT> {
|
||||
struct ExtraData {
|
||||
int *Deletions;
|
||||
int *RAUWs;
|
||||
};
|
||||
|
||||
static void onRAUW(const ExtraData &Data, KeyT Old, KeyT New) {
|
||||
++*Data.RAUWs;
|
||||
}
|
||||
static void onDelete(const ExtraData &Data, KeyT Old) {
|
||||
++*Data.Deletions;
|
||||
}
|
||||
};
|
||||
|
||||
TYPED_TEST(ValueMapTest, CallsConfig) {
|
||||
int Deletions = 0, RAUWs = 0;
|
||||
typename CountOps<TypeParam*>::ExtraData Data = {&Deletions, &RAUWs};
|
||||
ValueMap<TypeParam*, int, CountOps<TypeParam*> > VM(Data);
|
||||
VM[this->BitcastV.get()] = 7;
|
||||
this->BitcastV->replaceAllUsesWith(this->AddV.get());
|
||||
EXPECT_EQ(0, Deletions);
|
||||
EXPECT_EQ(1, RAUWs);
|
||||
this->AddV.reset();
|
||||
EXPECT_EQ(1, Deletions);
|
||||
EXPECT_EQ(1, RAUWs);
|
||||
this->BitcastV.reset();
|
||||
EXPECT_EQ(1, Deletions);
|
||||
EXPECT_EQ(1, RAUWs);
|
||||
}
|
||||
|
||||
template<typename KeyT>
|
||||
struct ModifyingConfig : ValueMapConfig<KeyT> {
|
||||
// We'll put a pointer here back to the ValueMap this key is in, so
|
||||
// that we can modify it (and clobber *this) before the ValueMap
|
||||
// tries to do the same modification. In previous versions of
|
||||
// ValueMap, that exploded.
|
||||
typedef ValueMap<KeyT, int, ModifyingConfig<KeyT> > **ExtraData;
|
||||
|
||||
static void onRAUW(ExtraData Map, KeyT Old, KeyT New) {
|
||||
(*Map)->erase(Old);
|
||||
}
|
||||
static void onDelete(ExtraData Map, KeyT Old) {
|
||||
(*Map)->erase(Old);
|
||||
}
|
||||
};
|
||||
TYPED_TEST(ValueMapTest, SurvivesModificationByConfig) {
|
||||
ValueMap<TypeParam*, int, ModifyingConfig<TypeParam*> > *MapAddress;
|
||||
ValueMap<TypeParam*, int, ModifyingConfig<TypeParam*> > VM(&MapAddress);
|
||||
MapAddress = &VM;
|
||||
// Now the ModifyingConfig can modify the Map inside a callback.
|
||||
VM[this->BitcastV.get()] = 7;
|
||||
this->BitcastV->replaceAllUsesWith(this->AddV.get());
|
||||
EXPECT_FALSE(VM.count(this->BitcastV.get()));
|
||||
EXPECT_FALSE(VM.count(this->AddV.get()));
|
||||
VM[this->AddV.get()] = 7;
|
||||
this->AddV.reset();
|
||||
EXPECT_FALSE(VM.count(this->AddV.get()));
|
||||
}
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
//===- llvm/unittest/ADT/APInt.cpp - APInt unit tests ---------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include <ostream>
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/ilist.h"
|
||||
#include "llvm/ADT/ilist_node.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
struct Node : ilist_node<Node> {
|
||||
int Value;
|
||||
|
||||
Node() {}
|
||||
Node(int _Value) : Value(_Value) {}
|
||||
};
|
||||
|
||||
TEST(ilistTest, Basic) {
|
||||
ilist<Node> List;
|
||||
List.push_back(Node(1));
|
||||
EXPECT_EQ(1, List.back().Value);
|
||||
EXPECT_EQ(0, List.back().getPrevNode());
|
||||
EXPECT_EQ(0, List.back().getNextNode());
|
||||
|
||||
List.push_back(Node(2));
|
||||
EXPECT_EQ(2, List.back().Value);
|
||||
EXPECT_EQ(2, List.front().getNextNode()->Value);
|
||||
EXPECT_EQ(1, List.back().getPrevNode()->Value);
|
||||
|
||||
const ilist<Node> &ConstList = List;
|
||||
EXPECT_EQ(2, ConstList.back().Value);
|
||||
EXPECT_EQ(2, ConstList.front().getNextNode()->Value);
|
||||
EXPECT_EQ(1, ConstList.back().getPrevNode()->Value);
|
||||
}
|
||||
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
//===- ExecutionEngineTest.cpp - Unit tests for ExecutionEngine -----------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/GlobalVariable.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/ExecutionEngine/Interpreter.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
class ExecutionEngineTest : public testing::Test {
|
||||
protected:
|
||||
ExecutionEngineTest()
|
||||
: M(new Module("<main>", getGlobalContext())),
|
||||
Engine(EngineBuilder(M).create()) {
|
||||
}
|
||||
|
||||
virtual void SetUp() {
|
||||
ASSERT_TRUE(Engine.get() != NULL);
|
||||
}
|
||||
|
||||
GlobalVariable *NewExtGlobal(const Type *T, const Twine &Name) {
|
||||
return new GlobalVariable(*M, T, false, // Not constant.
|
||||
GlobalValue::ExternalLinkage, NULL, Name);
|
||||
}
|
||||
|
||||
Module *const M;
|
||||
const OwningPtr<ExecutionEngine> Engine;
|
||||
};
|
||||
|
||||
TEST_F(ExecutionEngineTest, ForwardGlobalMapping) {
|
||||
GlobalVariable *G1 =
|
||||
NewExtGlobal(Type::getInt32Ty(getGlobalContext()), "Global1");
|
||||
int32_t Mem1 = 3;
|
||||
Engine->addGlobalMapping(G1, &Mem1);
|
||||
EXPECT_EQ(&Mem1, Engine->getPointerToGlobalIfAvailable(G1));
|
||||
int32_t Mem2 = 4;
|
||||
Engine->updateGlobalMapping(G1, &Mem2);
|
||||
EXPECT_EQ(&Mem2, Engine->getPointerToGlobalIfAvailable(G1));
|
||||
Engine->updateGlobalMapping(G1, NULL);
|
||||
EXPECT_EQ(NULL, Engine->getPointerToGlobalIfAvailable(G1));
|
||||
Engine->updateGlobalMapping(G1, &Mem2);
|
||||
EXPECT_EQ(&Mem2, Engine->getPointerToGlobalIfAvailable(G1));
|
||||
|
||||
GlobalVariable *G2 =
|
||||
NewExtGlobal(Type::getInt32Ty(getGlobalContext()), "Global1");
|
||||
EXPECT_EQ(NULL, Engine->getPointerToGlobalIfAvailable(G2))
|
||||
<< "The NULL return shouldn't depend on having called"
|
||||
<< " updateGlobalMapping(..., NULL)";
|
||||
// Check that update...() can be called before add...().
|
||||
Engine->updateGlobalMapping(G2, &Mem1);
|
||||
EXPECT_EQ(&Mem1, Engine->getPointerToGlobalIfAvailable(G2));
|
||||
EXPECT_EQ(&Mem2, Engine->getPointerToGlobalIfAvailable(G1))
|
||||
<< "A second mapping shouldn't affect the first.";
|
||||
}
|
||||
|
||||
TEST_F(ExecutionEngineTest, ReverseGlobalMapping) {
|
||||
GlobalVariable *G1 =
|
||||
NewExtGlobal(Type::getInt32Ty(getGlobalContext()), "Global1");
|
||||
|
||||
int32_t Mem1 = 3;
|
||||
Engine->addGlobalMapping(G1, &Mem1);
|
||||
EXPECT_EQ(G1, Engine->getGlobalValueAtAddress(&Mem1));
|
||||
int32_t Mem2 = 4;
|
||||
Engine->updateGlobalMapping(G1, &Mem2);
|
||||
EXPECT_EQ(NULL, Engine->getGlobalValueAtAddress(&Mem1));
|
||||
EXPECT_EQ(G1, Engine->getGlobalValueAtAddress(&Mem2));
|
||||
|
||||
GlobalVariable *G2 =
|
||||
NewExtGlobal(Type::getInt32Ty(getGlobalContext()), "Global2");
|
||||
Engine->updateGlobalMapping(G2, &Mem1);
|
||||
EXPECT_EQ(G2, Engine->getGlobalValueAtAddress(&Mem1));
|
||||
EXPECT_EQ(G1, Engine->getGlobalValueAtAddress(&Mem2));
|
||||
Engine->updateGlobalMapping(G1, NULL);
|
||||
EXPECT_EQ(G2, Engine->getGlobalValueAtAddress(&Mem1))
|
||||
<< "Removing one mapping doesn't affect a different one.";
|
||||
EXPECT_EQ(NULL, Engine->getGlobalValueAtAddress(&Mem2));
|
||||
Engine->updateGlobalMapping(G2, &Mem2);
|
||||
EXPECT_EQ(NULL, Engine->getGlobalValueAtAddress(&Mem1));
|
||||
EXPECT_EQ(G2, Engine->getGlobalValueAtAddress(&Mem2))
|
||||
<< "Once a mapping is removed, we can point another GV at the"
|
||||
<< " now-free address.";
|
||||
}
|
||||
|
||||
TEST_F(ExecutionEngineTest, ClearModuleMappings) {
|
||||
GlobalVariable *G1 =
|
||||
NewExtGlobal(Type::getInt32Ty(getGlobalContext()), "Global1");
|
||||
|
||||
int32_t Mem1 = 3;
|
||||
Engine->addGlobalMapping(G1, &Mem1);
|
||||
EXPECT_EQ(G1, Engine->getGlobalValueAtAddress(&Mem1));
|
||||
|
||||
Engine->clearGlobalMappingsFromModule(M);
|
||||
|
||||
EXPECT_EQ(NULL, Engine->getGlobalValueAtAddress(&Mem1));
|
||||
|
||||
GlobalVariable *G2 =
|
||||
NewExtGlobal(Type::getInt32Ty(getGlobalContext()), "Global2");
|
||||
// After clearing the module mappings, we can assign a new GV to the
|
||||
// same address.
|
||||
Engine->addGlobalMapping(G2, &Mem1);
|
||||
EXPECT_EQ(G2, Engine->getGlobalValueAtAddress(&Mem1));
|
||||
}
|
||||
|
||||
TEST_F(ExecutionEngineTest, DestructionRemovesGlobalMapping) {
|
||||
GlobalVariable *G1 =
|
||||
NewExtGlobal(Type::getInt32Ty(getGlobalContext()), "Global1");
|
||||
int32_t Mem1 = 3;
|
||||
Engine->addGlobalMapping(G1, &Mem1);
|
||||
// Make sure the reverse mapping is enabled.
|
||||
EXPECT_EQ(G1, Engine->getGlobalValueAtAddress(&Mem1));
|
||||
// When the GV goes away, the ExecutionEngine should remove any
|
||||
// mappings that refer to it.
|
||||
G1->eraseFromParent();
|
||||
EXPECT_EQ(NULL, Engine->getGlobalValueAtAddress(&Mem1));
|
||||
}
|
||||
|
||||
}
|
@ -1,238 +0,0 @@
|
||||
//===- JITEventListenerTest.cpp - Unit tests for JITEventListeners --------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/ExecutionEngine/JITEventListener.h"
|
||||
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/CodeGen/MachineCodeInfo.h"
|
||||
#include "llvm/ExecutionEngine/JIT.h"
|
||||
#include "llvm/Support/TypeBuilder.h"
|
||||
#include "llvm/Target/TargetSelect.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
int dummy;
|
||||
|
||||
namespace {
|
||||
|
||||
struct FunctionEmittedEvent {
|
||||
// Indices are local to the RecordingJITEventListener, since the
|
||||
// JITEventListener interface makes no guarantees about the order of
|
||||
// calls between Listeners.
|
||||
unsigned Index;
|
||||
const Function *F;
|
||||
void *Code;
|
||||
size_t Size;
|
||||
JITEvent_EmittedFunctionDetails Details;
|
||||
};
|
||||
struct FunctionFreedEvent {
|
||||
unsigned Index;
|
||||
void *Code;
|
||||
};
|
||||
|
||||
struct RecordingJITEventListener : public JITEventListener {
|
||||
std::vector<FunctionEmittedEvent> EmittedEvents;
|
||||
std::vector<FunctionFreedEvent> FreedEvents;
|
||||
|
||||
int NextIndex;
|
||||
|
||||
RecordingJITEventListener() : NextIndex(0) {}
|
||||
|
||||
virtual void NotifyFunctionEmitted(const Function &F,
|
||||
void *Code, size_t Size,
|
||||
const EmittedFunctionDetails &Details) {
|
||||
FunctionEmittedEvent Event = {NextIndex++, &F, Code, Size, Details};
|
||||
EmittedEvents.push_back(Event);
|
||||
}
|
||||
|
||||
virtual void NotifyFreeingMachineCode(void *OldPtr) {
|
||||
FunctionFreedEvent Event = {NextIndex++, OldPtr};
|
||||
FreedEvents.push_back(Event);
|
||||
}
|
||||
};
|
||||
|
||||
class JITEventListenerTest : public testing::Test {
|
||||
protected:
|
||||
JITEventListenerTest()
|
||||
: M(new Module("module", getGlobalContext())),
|
||||
EE(EngineBuilder(M)
|
||||
.setEngineKind(EngineKind::JIT)
|
||||
.create()) {
|
||||
}
|
||||
|
||||
Module *M;
|
||||
const OwningPtr<ExecutionEngine> EE;
|
||||
};
|
||||
|
||||
Function *buildFunction(Module *M) {
|
||||
Function *Result = Function::Create(
|
||||
TypeBuilder<int32_t(int32_t), false>::get(getGlobalContext()),
|
||||
GlobalValue::ExternalLinkage, "id", M);
|
||||
Value *Arg = Result->arg_begin();
|
||||
BasicBlock *BB = BasicBlock::Create(M->getContext(), "entry", Result);
|
||||
ReturnInst::Create(M->getContext(), Arg, BB);
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Tests that a single JITEventListener follows JIT events accurately.
|
||||
TEST_F(JITEventListenerTest, Simple) {
|
||||
RecordingJITEventListener Listener;
|
||||
EE->RegisterJITEventListener(&Listener);
|
||||
Function *F1 = buildFunction(M);
|
||||
Function *F2 = buildFunction(M);
|
||||
|
||||
void *F1_addr = EE->getPointerToFunction(F1);
|
||||
void *F2_addr = EE->getPointerToFunction(F2);
|
||||
EE->getPointerToFunction(F1); // Should do nothing.
|
||||
EE->freeMachineCodeForFunction(F1);
|
||||
EE->freeMachineCodeForFunction(F2);
|
||||
|
||||
ASSERT_EQ(2U, Listener.EmittedEvents.size());
|
||||
ASSERT_EQ(2U, Listener.FreedEvents.size());
|
||||
|
||||
EXPECT_EQ(0U, Listener.EmittedEvents[0].Index);
|
||||
EXPECT_EQ(F1, Listener.EmittedEvents[0].F);
|
||||
EXPECT_EQ(F1_addr, Listener.EmittedEvents[0].Code);
|
||||
EXPECT_LT(0U, Listener.EmittedEvents[0].Size)
|
||||
<< "We don't know how big the function will be, but it had better"
|
||||
<< " contain some bytes.";
|
||||
|
||||
EXPECT_EQ(1U, Listener.EmittedEvents[1].Index);
|
||||
EXPECT_EQ(F2, Listener.EmittedEvents[1].F);
|
||||
EXPECT_EQ(F2_addr, Listener.EmittedEvents[1].Code);
|
||||
EXPECT_LT(0U, Listener.EmittedEvents[1].Size)
|
||||
<< "We don't know how big the function will be, but it had better"
|
||||
<< " contain some bytes.";
|
||||
|
||||
EXPECT_EQ(2U, Listener.FreedEvents[0].Index);
|
||||
EXPECT_EQ(F1_addr, Listener.FreedEvents[0].Code);
|
||||
|
||||
EXPECT_EQ(3U, Listener.FreedEvents[1].Index);
|
||||
EXPECT_EQ(F2_addr, Listener.FreedEvents[1].Code);
|
||||
|
||||
F1->eraseFromParent();
|
||||
F2->eraseFromParent();
|
||||
}
|
||||
|
||||
// Tests that a single JITEventListener follows JIT events accurately.
|
||||
TEST_F(JITEventListenerTest, MultipleListenersDontInterfere) {
|
||||
RecordingJITEventListener Listener1;
|
||||
RecordingJITEventListener Listener2;
|
||||
RecordingJITEventListener Listener3;
|
||||
Function *F1 = buildFunction(M);
|
||||
Function *F2 = buildFunction(M);
|
||||
|
||||
EE->RegisterJITEventListener(&Listener1);
|
||||
EE->RegisterJITEventListener(&Listener2);
|
||||
void *F1_addr = EE->getPointerToFunction(F1);
|
||||
EE->RegisterJITEventListener(&Listener3);
|
||||
EE->UnregisterJITEventListener(&Listener1);
|
||||
void *F2_addr = EE->getPointerToFunction(F2);
|
||||
EE->UnregisterJITEventListener(&Listener2);
|
||||
EE->UnregisterJITEventListener(&Listener3);
|
||||
EE->freeMachineCodeForFunction(F1);
|
||||
EE->RegisterJITEventListener(&Listener2);
|
||||
EE->RegisterJITEventListener(&Listener3);
|
||||
EE->RegisterJITEventListener(&Listener1);
|
||||
EE->freeMachineCodeForFunction(F2);
|
||||
EE->UnregisterJITEventListener(&Listener1);
|
||||
EE->UnregisterJITEventListener(&Listener2);
|
||||
EE->UnregisterJITEventListener(&Listener3);
|
||||
|
||||
// Listener 1.
|
||||
ASSERT_EQ(1U, Listener1.EmittedEvents.size());
|
||||
ASSERT_EQ(1U, Listener1.FreedEvents.size());
|
||||
|
||||
EXPECT_EQ(0U, Listener1.EmittedEvents[0].Index);
|
||||
EXPECT_EQ(F1, Listener1.EmittedEvents[0].F);
|
||||
EXPECT_EQ(F1_addr, Listener1.EmittedEvents[0].Code);
|
||||
EXPECT_LT(0U, Listener1.EmittedEvents[0].Size)
|
||||
<< "We don't know how big the function will be, but it had better"
|
||||
<< " contain some bytes.";
|
||||
|
||||
EXPECT_EQ(1U, Listener1.FreedEvents[0].Index);
|
||||
EXPECT_EQ(F2_addr, Listener1.FreedEvents[0].Code);
|
||||
|
||||
// Listener 2.
|
||||
ASSERT_EQ(2U, Listener2.EmittedEvents.size());
|
||||
ASSERT_EQ(1U, Listener2.FreedEvents.size());
|
||||
|
||||
EXPECT_EQ(0U, Listener2.EmittedEvents[0].Index);
|
||||
EXPECT_EQ(F1, Listener2.EmittedEvents[0].F);
|
||||
EXPECT_EQ(F1_addr, Listener2.EmittedEvents[0].Code);
|
||||
EXPECT_LT(0U, Listener2.EmittedEvents[0].Size)
|
||||
<< "We don't know how big the function will be, but it had better"
|
||||
<< " contain some bytes.";
|
||||
|
||||
EXPECT_EQ(1U, Listener2.EmittedEvents[1].Index);
|
||||
EXPECT_EQ(F2, Listener2.EmittedEvents[1].F);
|
||||
EXPECT_EQ(F2_addr, Listener2.EmittedEvents[1].Code);
|
||||
EXPECT_LT(0U, Listener2.EmittedEvents[1].Size)
|
||||
<< "We don't know how big the function will be, but it had better"
|
||||
<< " contain some bytes.";
|
||||
|
||||
EXPECT_EQ(2U, Listener2.FreedEvents[0].Index);
|
||||
EXPECT_EQ(F2_addr, Listener2.FreedEvents[0].Code);
|
||||
|
||||
// Listener 3.
|
||||
ASSERT_EQ(1U, Listener3.EmittedEvents.size());
|
||||
ASSERT_EQ(1U, Listener3.FreedEvents.size());
|
||||
|
||||
EXPECT_EQ(0U, Listener3.EmittedEvents[0].Index);
|
||||
EXPECT_EQ(F2, Listener3.EmittedEvents[0].F);
|
||||
EXPECT_EQ(F2_addr, Listener3.EmittedEvents[0].Code);
|
||||
EXPECT_LT(0U, Listener3.EmittedEvents[0].Size)
|
||||
<< "We don't know how big the function will be, but it had better"
|
||||
<< " contain some bytes.";
|
||||
|
||||
EXPECT_EQ(1U, Listener3.FreedEvents[0].Index);
|
||||
EXPECT_EQ(F2_addr, Listener3.FreedEvents[0].Code);
|
||||
|
||||
F1->eraseFromParent();
|
||||
F2->eraseFromParent();
|
||||
}
|
||||
|
||||
TEST_F(JITEventListenerTest, MatchesMachineCodeInfo) {
|
||||
RecordingJITEventListener Listener;
|
||||
MachineCodeInfo MCI;
|
||||
Function *F = buildFunction(M);
|
||||
|
||||
EE->RegisterJITEventListener(&Listener);
|
||||
EE->runJITOnFunction(F, &MCI);
|
||||
void *F_addr = EE->getPointerToFunction(F);
|
||||
EE->freeMachineCodeForFunction(F);
|
||||
|
||||
ASSERT_EQ(1U, Listener.EmittedEvents.size());
|
||||
ASSERT_EQ(1U, Listener.FreedEvents.size());
|
||||
|
||||
EXPECT_EQ(0U, Listener.EmittedEvents[0].Index);
|
||||
EXPECT_EQ(F, Listener.EmittedEvents[0].F);
|
||||
EXPECT_EQ(F_addr, Listener.EmittedEvents[0].Code);
|
||||
EXPECT_EQ(MCI.address(), Listener.EmittedEvents[0].Code);
|
||||
EXPECT_EQ(MCI.size(), Listener.EmittedEvents[0].Size);
|
||||
|
||||
EXPECT_EQ(1U, Listener.FreedEvents[0].Index);
|
||||
EXPECT_EQ(F_addr, Listener.FreedEvents[0].Code);
|
||||
}
|
||||
|
||||
class JITEnvironment : public testing::Environment {
|
||||
virtual void SetUp() {
|
||||
// Required to create a JIT.
|
||||
InitializeNativeTarget();
|
||||
}
|
||||
};
|
||||
testing::Environment* const jit_env =
|
||||
testing::AddGlobalTestEnvironment(new JITEnvironment);
|
||||
|
||||
} // anonymous namespace
|
@ -1,279 +0,0 @@
|
||||
//===- JITMemoryManagerTest.cpp - Unit tests for the JIT memory manager ---===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/ExecutionEngine/JITMemoryManager.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/GlobalValue.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
Function *makeFakeFunction() {
|
||||
std::vector<const Type*> params;
|
||||
const FunctionType *FTy =
|
||||
FunctionType::get(Type::getVoidTy(getGlobalContext()), params, false);
|
||||
return Function::Create(FTy, GlobalValue::ExternalLinkage);
|
||||
}
|
||||
|
||||
// Allocate three simple functions that fit in the initial slab. This exercises
|
||||
// the code in the case that we don't have to allocate more memory to store the
|
||||
// function bodies.
|
||||
TEST(JITMemoryManagerTest, NoAllocations) {
|
||||
OwningPtr<JITMemoryManager> MemMgr(
|
||||
JITMemoryManager::CreateDefaultMemManager());
|
||||
uintptr_t size;
|
||||
std::string Error;
|
||||
|
||||
// Allocate the functions.
|
||||
OwningPtr<Function> F1(makeFakeFunction());
|
||||
size = 1024;
|
||||
uint8_t *FunctionBody1 = MemMgr->startFunctionBody(F1.get(), size);
|
||||
memset(FunctionBody1, 0xFF, 1024);
|
||||
MemMgr->endFunctionBody(F1.get(), FunctionBody1, FunctionBody1 + 1024);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
|
||||
OwningPtr<Function> F2(makeFakeFunction());
|
||||
size = 1024;
|
||||
uint8_t *FunctionBody2 = MemMgr->startFunctionBody(F2.get(), size);
|
||||
memset(FunctionBody2, 0xFF, 1024);
|
||||
MemMgr->endFunctionBody(F2.get(), FunctionBody2, FunctionBody2 + 1024);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
|
||||
OwningPtr<Function> F3(makeFakeFunction());
|
||||
size = 1024;
|
||||
uint8_t *FunctionBody3 = MemMgr->startFunctionBody(F3.get(), size);
|
||||
memset(FunctionBody3, 0xFF, 1024);
|
||||
MemMgr->endFunctionBody(F3.get(), FunctionBody3, FunctionBody3 + 1024);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
|
||||
// Deallocate them out of order, in case that matters.
|
||||
MemMgr->deallocateFunctionBody(FunctionBody2);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
MemMgr->deallocateFunctionBody(FunctionBody1);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
MemMgr->deallocateFunctionBody(FunctionBody3);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
}
|
||||
|
||||
// Make three large functions that take up most of the space in the slab. Then
|
||||
// try allocating three smaller functions that don't require additional slabs.
|
||||
TEST(JITMemoryManagerTest, TestCodeAllocation) {
|
||||
OwningPtr<JITMemoryManager> MemMgr(
|
||||
JITMemoryManager::CreateDefaultMemManager());
|
||||
uintptr_t size;
|
||||
std::string Error;
|
||||
|
||||
// Big functions are a little less than the largest block size.
|
||||
const uintptr_t smallFuncSize = 1024;
|
||||
const uintptr_t bigFuncSize = (MemMgr->GetDefaultCodeSlabSize() -
|
||||
smallFuncSize * 2);
|
||||
|
||||
// Allocate big functions
|
||||
OwningPtr<Function> F1(makeFakeFunction());
|
||||
size = bigFuncSize;
|
||||
uint8_t *FunctionBody1 = MemMgr->startFunctionBody(F1.get(), size);
|
||||
ASSERT_LE(bigFuncSize, size);
|
||||
memset(FunctionBody1, 0xFF, bigFuncSize);
|
||||
MemMgr->endFunctionBody(F1.get(), FunctionBody1, FunctionBody1 + bigFuncSize);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
|
||||
OwningPtr<Function> F2(makeFakeFunction());
|
||||
size = bigFuncSize;
|
||||
uint8_t *FunctionBody2 = MemMgr->startFunctionBody(F2.get(), size);
|
||||
ASSERT_LE(bigFuncSize, size);
|
||||
memset(FunctionBody2, 0xFF, bigFuncSize);
|
||||
MemMgr->endFunctionBody(F2.get(), FunctionBody2, FunctionBody2 + bigFuncSize);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
|
||||
OwningPtr<Function> F3(makeFakeFunction());
|
||||
size = bigFuncSize;
|
||||
uint8_t *FunctionBody3 = MemMgr->startFunctionBody(F3.get(), size);
|
||||
ASSERT_LE(bigFuncSize, size);
|
||||
memset(FunctionBody3, 0xFF, bigFuncSize);
|
||||
MemMgr->endFunctionBody(F3.get(), FunctionBody3, FunctionBody3 + bigFuncSize);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
|
||||
// Check that each large function took it's own slab.
|
||||
EXPECT_EQ(3U, MemMgr->GetNumCodeSlabs());
|
||||
|
||||
// Allocate small functions
|
||||
OwningPtr<Function> F4(makeFakeFunction());
|
||||
size = smallFuncSize;
|
||||
uint8_t *FunctionBody4 = MemMgr->startFunctionBody(F4.get(), size);
|
||||
ASSERT_LE(smallFuncSize, size);
|
||||
memset(FunctionBody4, 0xFF, smallFuncSize);
|
||||
MemMgr->endFunctionBody(F4.get(), FunctionBody4,
|
||||
FunctionBody4 + smallFuncSize);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
|
||||
OwningPtr<Function> F5(makeFakeFunction());
|
||||
size = smallFuncSize;
|
||||
uint8_t *FunctionBody5 = MemMgr->startFunctionBody(F5.get(), size);
|
||||
ASSERT_LE(smallFuncSize, size);
|
||||
memset(FunctionBody5, 0xFF, smallFuncSize);
|
||||
MemMgr->endFunctionBody(F5.get(), FunctionBody5,
|
||||
FunctionBody5 + smallFuncSize);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
|
||||
OwningPtr<Function> F6(makeFakeFunction());
|
||||
size = smallFuncSize;
|
||||
uint8_t *FunctionBody6 = MemMgr->startFunctionBody(F6.get(), size);
|
||||
ASSERT_LE(smallFuncSize, size);
|
||||
memset(FunctionBody6, 0xFF, smallFuncSize);
|
||||
MemMgr->endFunctionBody(F6.get(), FunctionBody6,
|
||||
FunctionBody6 + smallFuncSize);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
|
||||
// Check that the small functions didn't allocate any new slabs.
|
||||
EXPECT_EQ(3U, MemMgr->GetNumCodeSlabs());
|
||||
|
||||
// Deallocate them out of order, in case that matters.
|
||||
MemMgr->deallocateFunctionBody(FunctionBody2);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
MemMgr->deallocateFunctionBody(FunctionBody1);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
MemMgr->deallocateFunctionBody(FunctionBody4);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
MemMgr->deallocateFunctionBody(FunctionBody3);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
MemMgr->deallocateFunctionBody(FunctionBody5);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
MemMgr->deallocateFunctionBody(FunctionBody6);
|
||||
EXPECT_TRUE(MemMgr->CheckInvariants(Error)) << Error;
|
||||
}
|
||||
|
||||
// Allocate five global ints of varying widths and alignment, and check their
|
||||
// alignment and overlap.
|
||||
TEST(JITMemoryManagerTest, TestSmallGlobalInts) {
|
||||
OwningPtr<JITMemoryManager> MemMgr(
|
||||
JITMemoryManager::CreateDefaultMemManager());
|
||||
uint8_t *a = (uint8_t *)MemMgr->allocateGlobal(8, 0);
|
||||
uint16_t *b = (uint16_t*)MemMgr->allocateGlobal(16, 2);
|
||||
uint32_t *c = (uint32_t*)MemMgr->allocateGlobal(32, 4);
|
||||
uint64_t *d = (uint64_t*)MemMgr->allocateGlobal(64, 8);
|
||||
|
||||
// Check the alignment.
|
||||
EXPECT_EQ(0U, ((uintptr_t)b) & 0x1);
|
||||
EXPECT_EQ(0U, ((uintptr_t)c) & 0x3);
|
||||
EXPECT_EQ(0U, ((uintptr_t)d) & 0x7);
|
||||
|
||||
// Initialize them each one at a time and make sure they don't overlap.
|
||||
*a = 0xff;
|
||||
*b = 0U;
|
||||
*c = 0U;
|
||||
*d = 0U;
|
||||
EXPECT_EQ(0xffU, *a);
|
||||
EXPECT_EQ(0U, *b);
|
||||
EXPECT_EQ(0U, *c);
|
||||
EXPECT_EQ(0U, *d);
|
||||
*a = 0U;
|
||||
*b = 0xffffU;
|
||||
EXPECT_EQ(0U, *a);
|
||||
EXPECT_EQ(0xffffU, *b);
|
||||
EXPECT_EQ(0U, *c);
|
||||
EXPECT_EQ(0U, *d);
|
||||
*b = 0U;
|
||||
*c = 0xffffffffU;
|
||||
EXPECT_EQ(0U, *a);
|
||||
EXPECT_EQ(0U, *b);
|
||||
EXPECT_EQ(0xffffffffU, *c);
|
||||
EXPECT_EQ(0U, *d);
|
||||
*c = 0U;
|
||||
*d = 0xffffffffffffffffULL;
|
||||
EXPECT_EQ(0U, *a);
|
||||
EXPECT_EQ(0U, *b);
|
||||
EXPECT_EQ(0U, *c);
|
||||
EXPECT_EQ(0xffffffffffffffffULL, *d);
|
||||
|
||||
// Make sure we didn't allocate any extra slabs for this tiny amount of data.
|
||||
EXPECT_EQ(1U, MemMgr->GetNumDataSlabs());
|
||||
}
|
||||
|
||||
// Allocate a small global, a big global, and a third global, and make sure we
|
||||
// only use two slabs for that.
|
||||
TEST(JITMemoryManagerTest, TestLargeGlobalArray) {
|
||||
OwningPtr<JITMemoryManager> MemMgr(
|
||||
JITMemoryManager::CreateDefaultMemManager());
|
||||
size_t Size = 4 * MemMgr->GetDefaultDataSlabSize();
|
||||
uint64_t *a = (uint64_t*)MemMgr->allocateGlobal(64, 8);
|
||||
uint8_t *g = MemMgr->allocateGlobal(Size, 8);
|
||||
uint64_t *b = (uint64_t*)MemMgr->allocateGlobal(64, 8);
|
||||
|
||||
// Check the alignment.
|
||||
EXPECT_EQ(0U, ((uintptr_t)a) & 0x7);
|
||||
EXPECT_EQ(0U, ((uintptr_t)g) & 0x7);
|
||||
EXPECT_EQ(0U, ((uintptr_t)b) & 0x7);
|
||||
|
||||
// Initialize them to make sure we don't segfault and make sure they don't
|
||||
// overlap.
|
||||
memset(a, 0x1, 8);
|
||||
memset(g, 0x2, Size);
|
||||
memset(b, 0x3, 8);
|
||||
EXPECT_EQ(0x0101010101010101ULL, *a);
|
||||
// Just check the edges.
|
||||
EXPECT_EQ(0x02U, g[0]);
|
||||
EXPECT_EQ(0x02U, g[Size - 1]);
|
||||
EXPECT_EQ(0x0303030303030303ULL, *b);
|
||||
|
||||
// Check the number of slabs.
|
||||
EXPECT_EQ(2U, MemMgr->GetNumDataSlabs());
|
||||
}
|
||||
|
||||
// Allocate lots of medium globals so that we can test moving the bump allocator
|
||||
// to a new slab.
|
||||
TEST(JITMemoryManagerTest, TestManyGlobals) {
|
||||
OwningPtr<JITMemoryManager> MemMgr(
|
||||
JITMemoryManager::CreateDefaultMemManager());
|
||||
size_t SlabSize = MemMgr->GetDefaultDataSlabSize();
|
||||
size_t Size = 128;
|
||||
int Iters = (SlabSize / Size) + 1;
|
||||
|
||||
// We should start with no slabs.
|
||||
EXPECT_EQ(0U, MemMgr->GetNumDataSlabs());
|
||||
|
||||
// After allocating a bunch of globals, we should have two.
|
||||
for (int I = 0; I < Iters; ++I)
|
||||
MemMgr->allocateGlobal(Size, 8);
|
||||
EXPECT_EQ(2U, MemMgr->GetNumDataSlabs());
|
||||
|
||||
// And after much more, we should have three.
|
||||
for (int I = 0; I < Iters; ++I)
|
||||
MemMgr->allocateGlobal(Size, 8);
|
||||
EXPECT_EQ(3U, MemMgr->GetNumDataSlabs());
|
||||
}
|
||||
|
||||
// Allocate lots of function stubs so that we can test moving the stub bump
|
||||
// allocator to a new slab.
|
||||
TEST(JITMemoryManagerTest, TestManyStubs) {
|
||||
OwningPtr<JITMemoryManager> MemMgr(
|
||||
JITMemoryManager::CreateDefaultMemManager());
|
||||
size_t SlabSize = MemMgr->GetDefaultStubSlabSize();
|
||||
size_t Size = 128;
|
||||
int Iters = (SlabSize / Size) + 1;
|
||||
|
||||
// We should start with no slabs.
|
||||
EXPECT_EQ(0U, MemMgr->GetNumDataSlabs());
|
||||
|
||||
// After allocating a bunch of stubs, we should have two.
|
||||
for (int I = 0; I < Iters; ++I)
|
||||
MemMgr->allocateStub(NULL, Size, 8);
|
||||
EXPECT_EQ(2U, MemMgr->GetNumStubSlabs());
|
||||
|
||||
// And after much more, we should have three.
|
||||
for (int I = 0; I < Iters; ++I)
|
||||
MemMgr->allocateStub(NULL, Size, 8);
|
||||
EXPECT_EQ(3U, MemMgr->GetNumStubSlabs());
|
||||
}
|
||||
|
||||
}
|
@ -1,806 +0,0 @@
|
||||
//===- JITTest.cpp - Unit tests for the JIT -------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/Assembly/Parser.h"
|
||||
#include "llvm/BasicBlock.h"
|
||||
#include "llvm/Bitcode/ReaderWriter.h"
|
||||
#include "llvm/Constant.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/ExecutionEngine/JIT.h"
|
||||
#include "llvm/ExecutionEngine/JITMemoryManager.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/GlobalValue.h"
|
||||
#include "llvm/GlobalVariable.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/Support/IRBuilder.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include "llvm/Support/TypeBuilder.h"
|
||||
#include "llvm/Target/TargetSelect.h"
|
||||
#include "llvm/Type.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
Function *makeReturnGlobal(std::string Name, GlobalVariable *G, Module *M) {
|
||||
std::vector<const Type*> params;
|
||||
const FunctionType *FTy = FunctionType::get(G->getType()->getElementType(),
|
||||
params, false);
|
||||
Function *F = Function::Create(FTy, GlobalValue::ExternalLinkage, Name, M);
|
||||
BasicBlock *Entry = BasicBlock::Create(M->getContext(), "entry", F);
|
||||
IRBuilder<> builder(Entry);
|
||||
Value *Load = builder.CreateLoad(G);
|
||||
const Type *GTy = G->getType()->getElementType();
|
||||
Value *Add = builder.CreateAdd(Load, ConstantInt::get(GTy, 1LL));
|
||||
builder.CreateStore(Add, G);
|
||||
builder.CreateRet(Add);
|
||||
return F;
|
||||
}
|
||||
|
||||
std::string DumpFunction(const Function *F) {
|
||||
std::string Result;
|
||||
raw_string_ostream(Result) << "" << *F;
|
||||
return Result;
|
||||
}
|
||||
|
||||
class RecordingJITMemoryManager : public JITMemoryManager {
|
||||
const OwningPtr<JITMemoryManager> Base;
|
||||
public:
|
||||
RecordingJITMemoryManager()
|
||||
: Base(JITMemoryManager::CreateDefaultMemManager()) {
|
||||
stubsAllocated = 0;
|
||||
}
|
||||
|
||||
void setSizeRequired(bool Required) { SizeRequired = Required; }
|
||||
|
||||
virtual void setMemoryWritable() { Base->setMemoryWritable(); }
|
||||
virtual void setMemoryExecutable() { Base->setMemoryExecutable(); }
|
||||
virtual void setPoisonMemory(bool poison) { Base->setPoisonMemory(poison); }
|
||||
virtual void AllocateGOT() { Base->AllocateGOT(); }
|
||||
virtual uint8_t *getGOTBase() const { return Base->getGOTBase(); }
|
||||
struct StartFunctionBodyCall {
|
||||
StartFunctionBodyCall(uint8_t *Result, const Function *F,
|
||||
uintptr_t ActualSize, uintptr_t ActualSizeResult)
|
||||
: Result(Result), F(F), F_dump(DumpFunction(F)),
|
||||
ActualSize(ActualSize), ActualSizeResult(ActualSizeResult) {}
|
||||
uint8_t *Result;
|
||||
const Function *F;
|
||||
std::string F_dump;
|
||||
uintptr_t ActualSize;
|
||||
uintptr_t ActualSizeResult;
|
||||
};
|
||||
std::vector<StartFunctionBodyCall> startFunctionBodyCalls;
|
||||
virtual uint8_t *startFunctionBody(const Function *F,
|
||||
uintptr_t &ActualSize) {
|
||||
uintptr_t InitialActualSize = ActualSize;
|
||||
uint8_t *Result = Base->startFunctionBody(F, ActualSize);
|
||||
startFunctionBodyCalls.push_back(
|
||||
StartFunctionBodyCall(Result, F, InitialActualSize, ActualSize));
|
||||
return Result;
|
||||
}
|
||||
int stubsAllocated;
|
||||
virtual uint8_t *allocateStub(const GlobalValue* F, unsigned StubSize,
|
||||
unsigned Alignment) {
|
||||
stubsAllocated++;
|
||||
return Base->allocateStub(F, StubSize, Alignment);
|
||||
}
|
||||
struct EndFunctionBodyCall {
|
||||
EndFunctionBodyCall(const Function *F, uint8_t *FunctionStart,
|
||||
uint8_t *FunctionEnd)
|
||||
: F(F), F_dump(DumpFunction(F)),
|
||||
FunctionStart(FunctionStart), FunctionEnd(FunctionEnd) {}
|
||||
const Function *F;
|
||||
std::string F_dump;
|
||||
uint8_t *FunctionStart;
|
||||
uint8_t *FunctionEnd;
|
||||
};
|
||||
std::vector<EndFunctionBodyCall> endFunctionBodyCalls;
|
||||
virtual void endFunctionBody(const Function *F, uint8_t *FunctionStart,
|
||||
uint8_t *FunctionEnd) {
|
||||
endFunctionBodyCalls.push_back(
|
||||
EndFunctionBodyCall(F, FunctionStart, FunctionEnd));
|
||||
Base->endFunctionBody(F, FunctionStart, FunctionEnd);
|
||||
}
|
||||
virtual uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) {
|
||||
return Base->allocateSpace(Size, Alignment);
|
||||
}
|
||||
virtual uint8_t *allocateGlobal(uintptr_t Size, unsigned Alignment) {
|
||||
return Base->allocateGlobal(Size, Alignment);
|
||||
}
|
||||
struct DeallocateFunctionBodyCall {
|
||||
DeallocateFunctionBodyCall(const void *Body) : Body(Body) {}
|
||||
const void *Body;
|
||||
};
|
||||
std::vector<DeallocateFunctionBodyCall> deallocateFunctionBodyCalls;
|
||||
virtual void deallocateFunctionBody(void *Body) {
|
||||
deallocateFunctionBodyCalls.push_back(DeallocateFunctionBodyCall(Body));
|
||||
Base->deallocateFunctionBody(Body);
|
||||
}
|
||||
struct DeallocateExceptionTableCall {
|
||||
DeallocateExceptionTableCall(const void *ET) : ET(ET) {}
|
||||
const void *ET;
|
||||
};
|
||||
std::vector<DeallocateExceptionTableCall> deallocateExceptionTableCalls;
|
||||
virtual void deallocateExceptionTable(void *ET) {
|
||||
deallocateExceptionTableCalls.push_back(DeallocateExceptionTableCall(ET));
|
||||
Base->deallocateExceptionTable(ET);
|
||||
}
|
||||
struct StartExceptionTableCall {
|
||||
StartExceptionTableCall(uint8_t *Result, const Function *F,
|
||||
uintptr_t ActualSize, uintptr_t ActualSizeResult)
|
||||
: Result(Result), F(F), F_dump(DumpFunction(F)),
|
||||
ActualSize(ActualSize), ActualSizeResult(ActualSizeResult) {}
|
||||
uint8_t *Result;
|
||||
const Function *F;
|
||||
std::string F_dump;
|
||||
uintptr_t ActualSize;
|
||||
uintptr_t ActualSizeResult;
|
||||
};
|
||||
std::vector<StartExceptionTableCall> startExceptionTableCalls;
|
||||
virtual uint8_t* startExceptionTable(const Function* F,
|
||||
uintptr_t &ActualSize) {
|
||||
uintptr_t InitialActualSize = ActualSize;
|
||||
uint8_t *Result = Base->startExceptionTable(F, ActualSize);
|
||||
startExceptionTableCalls.push_back(
|
||||
StartExceptionTableCall(Result, F, InitialActualSize, ActualSize));
|
||||
return Result;
|
||||
}
|
||||
struct EndExceptionTableCall {
|
||||
EndExceptionTableCall(const Function *F, uint8_t *TableStart,
|
||||
uint8_t *TableEnd, uint8_t* FrameRegister)
|
||||
: F(F), F_dump(DumpFunction(F)),
|
||||
TableStart(TableStart), TableEnd(TableEnd),
|
||||
FrameRegister(FrameRegister) {}
|
||||
const Function *F;
|
||||
std::string F_dump;
|
||||
uint8_t *TableStart;
|
||||
uint8_t *TableEnd;
|
||||
uint8_t *FrameRegister;
|
||||
};
|
||||
std::vector<EndExceptionTableCall> endExceptionTableCalls;
|
||||
virtual void endExceptionTable(const Function *F, uint8_t *TableStart,
|
||||
uint8_t *TableEnd, uint8_t* FrameRegister) {
|
||||
endExceptionTableCalls.push_back(
|
||||
EndExceptionTableCall(F, TableStart, TableEnd, FrameRegister));
|
||||
return Base->endExceptionTable(F, TableStart, TableEnd, FrameRegister);
|
||||
}
|
||||
};
|
||||
|
||||
bool LoadAssemblyInto(Module *M, const char *assembly) {
|
||||
SMDiagnostic Error;
|
||||
bool success =
|
||||
NULL != ParseAssemblyString(assembly, M, Error, M->getContext());
|
||||
std::string errMsg;
|
||||
raw_string_ostream os(errMsg);
|
||||
Error.Print("", os);
|
||||
EXPECT_TRUE(success) << os.str();
|
||||
return success;
|
||||
}
|
||||
|
||||
class JITTest : public testing::Test {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
M = new Module("<main>", Context);
|
||||
RJMM = new RecordingJITMemoryManager;
|
||||
RJMM->setPoisonMemory(true);
|
||||
std::string Error;
|
||||
TheJIT.reset(EngineBuilder(M).setEngineKind(EngineKind::JIT)
|
||||
.setJITMemoryManager(RJMM)
|
||||
.setErrorStr(&Error).create());
|
||||
ASSERT_TRUE(TheJIT.get() != NULL) << Error;
|
||||
}
|
||||
|
||||
void LoadAssembly(const char *assembly) {
|
||||
LoadAssemblyInto(M, assembly);
|
||||
}
|
||||
|
||||
LLVMContext Context;
|
||||
Module *M; // Owned by ExecutionEngine.
|
||||
RecordingJITMemoryManager *RJMM;
|
||||
OwningPtr<ExecutionEngine> TheJIT;
|
||||
};
|
||||
|
||||
// Regression test for a bug. The JIT used to allocate globals inside the same
|
||||
// memory block used for the function, and when the function code was freed,
|
||||
// the global was left in the same place. This test allocates a function
|
||||
// that uses and global, deallocates it, and then makes sure that the global
|
||||
// stays alive after that.
|
||||
TEST(JIT, GlobalInFunction) {
|
||||
LLVMContext context;
|
||||
Module *M = new Module("<main>", context);
|
||||
|
||||
JITMemoryManager *MemMgr = JITMemoryManager::CreateDefaultMemManager();
|
||||
// Tell the memory manager to poison freed memory so that accessing freed
|
||||
// memory is more easily tested.
|
||||
MemMgr->setPoisonMemory(true);
|
||||
std::string Error;
|
||||
OwningPtr<ExecutionEngine> JIT(EngineBuilder(M)
|
||||
.setEngineKind(EngineKind::JIT)
|
||||
.setErrorStr(&Error)
|
||||
.setJITMemoryManager(MemMgr)
|
||||
// The next line enables the fix:
|
||||
.setAllocateGVsWithCode(false)
|
||||
.create());
|
||||
ASSERT_EQ(Error, "");
|
||||
|
||||
// Create a global variable.
|
||||
const Type *GTy = Type::getInt32Ty(context);
|
||||
GlobalVariable *G = new GlobalVariable(
|
||||
*M,
|
||||
GTy,
|
||||
false, // Not constant.
|
||||
GlobalValue::InternalLinkage,
|
||||
Constant::getNullValue(GTy),
|
||||
"myglobal");
|
||||
|
||||
// Make a function that points to a global.
|
||||
Function *F1 = makeReturnGlobal("F1", G, M);
|
||||
|
||||
// Get the pointer to the native code to force it to JIT the function and
|
||||
// allocate space for the global.
|
||||
void (*F1Ptr)() =
|
||||
reinterpret_cast<void(*)()>((intptr_t)JIT->getPointerToFunction(F1));
|
||||
|
||||
// Since F1 was codegen'd, a pointer to G should be available.
|
||||
int32_t *GPtr = (int32_t*)JIT->getPointerToGlobalIfAvailable(G);
|
||||
ASSERT_NE((int32_t*)NULL, GPtr);
|
||||
EXPECT_EQ(0, *GPtr);
|
||||
|
||||
// F1() should increment G.
|
||||
F1Ptr();
|
||||
EXPECT_EQ(1, *GPtr);
|
||||
|
||||
// Make a second function identical to the first, referring to the same
|
||||
// global.
|
||||
Function *F2 = makeReturnGlobal("F2", G, M);
|
||||
void (*F2Ptr)() =
|
||||
reinterpret_cast<void(*)()>((intptr_t)JIT->getPointerToFunction(F2));
|
||||
|
||||
// F2() should increment G.
|
||||
F2Ptr();
|
||||
EXPECT_EQ(2, *GPtr);
|
||||
|
||||
// Deallocate F1.
|
||||
JIT->freeMachineCodeForFunction(F1);
|
||||
|
||||
// F2() should *still* increment G.
|
||||
F2Ptr();
|
||||
EXPECT_EQ(3, *GPtr);
|
||||
}
|
||||
|
||||
int PlusOne(int arg) {
|
||||
return arg + 1;
|
||||
}
|
||||
|
||||
TEST_F(JITTest, FarCallToKnownFunction) {
|
||||
// x86-64 can only make direct calls to functions within 32 bits of
|
||||
// the current PC. To call anything farther away, we have to load
|
||||
// the address into a register and call through the register. The
|
||||
// current JIT does this by allocating a stub for any far call.
|
||||
// There was a bug in which the JIT tried to emit a direct call when
|
||||
// the target was already in the JIT's global mappings and lazy
|
||||
// compilation was disabled.
|
||||
|
||||
Function *KnownFunction = Function::Create(
|
||||
TypeBuilder<int(int), false>::get(Context),
|
||||
GlobalValue::ExternalLinkage, "known", M);
|
||||
TheJIT->addGlobalMapping(KnownFunction, (void*)(intptr_t)PlusOne);
|
||||
|
||||
// int test() { return known(7); }
|
||||
Function *TestFunction = Function::Create(
|
||||
TypeBuilder<int(), false>::get(Context),
|
||||
GlobalValue::ExternalLinkage, "test", M);
|
||||
BasicBlock *Entry = BasicBlock::Create(Context, "entry", TestFunction);
|
||||
IRBuilder<> Builder(Entry);
|
||||
Value *result = Builder.CreateCall(
|
||||
KnownFunction,
|
||||
ConstantInt::get(TypeBuilder<int, false>::get(Context), 7));
|
||||
Builder.CreateRet(result);
|
||||
|
||||
TheJIT->DisableLazyCompilation(true);
|
||||
int (*TestFunctionPtr)() = reinterpret_cast<int(*)()>(
|
||||
(intptr_t)TheJIT->getPointerToFunction(TestFunction));
|
||||
// This used to crash in trying to call PlusOne().
|
||||
EXPECT_EQ(8, TestFunctionPtr());
|
||||
}
|
||||
|
||||
// Test a function C which calls A and B which call each other.
|
||||
TEST_F(JITTest, NonLazyCompilationStillNeedsStubs) {
|
||||
TheJIT->DisableLazyCompilation(true);
|
||||
|
||||
const FunctionType *Func1Ty =
|
||||
cast<FunctionType>(TypeBuilder<void(void), false>::get(Context));
|
||||
std::vector<const Type*> arg_types;
|
||||
arg_types.push_back(Type::getInt1Ty(Context));
|
||||
const FunctionType *FuncTy = FunctionType::get(
|
||||
Type::getVoidTy(Context), arg_types, false);
|
||||
Function *Func1 = Function::Create(Func1Ty, Function::ExternalLinkage,
|
||||
"func1", M);
|
||||
Function *Func2 = Function::Create(FuncTy, Function::InternalLinkage,
|
||||
"func2", M);
|
||||
Function *Func3 = Function::Create(FuncTy, Function::InternalLinkage,
|
||||
"func3", M);
|
||||
BasicBlock *Block1 = BasicBlock::Create(Context, "block1", Func1);
|
||||
BasicBlock *Block2 = BasicBlock::Create(Context, "block2", Func2);
|
||||
BasicBlock *True2 = BasicBlock::Create(Context, "cond_true", Func2);
|
||||
BasicBlock *False2 = BasicBlock::Create(Context, "cond_false", Func2);
|
||||
BasicBlock *Block3 = BasicBlock::Create(Context, "block3", Func3);
|
||||
BasicBlock *True3 = BasicBlock::Create(Context, "cond_true", Func3);
|
||||
BasicBlock *False3 = BasicBlock::Create(Context, "cond_false", Func3);
|
||||
|
||||
// Make Func1 call Func2(0) and Func3(0).
|
||||
IRBuilder<> Builder(Block1);
|
||||
Builder.CreateCall(Func2, ConstantInt::getTrue(Context));
|
||||
Builder.CreateCall(Func3, ConstantInt::getTrue(Context));
|
||||
Builder.CreateRetVoid();
|
||||
|
||||
// void Func2(bool b) { if (b) { Func3(false); return; } return; }
|
||||
Builder.SetInsertPoint(Block2);
|
||||
Builder.CreateCondBr(Func2->arg_begin(), True2, False2);
|
||||
Builder.SetInsertPoint(True2);
|
||||
Builder.CreateCall(Func3, ConstantInt::getFalse(Context));
|
||||
Builder.CreateRetVoid();
|
||||
Builder.SetInsertPoint(False2);
|
||||
Builder.CreateRetVoid();
|
||||
|
||||
// void Func3(bool b) { if (b) { Func2(false); return; } return; }
|
||||
Builder.SetInsertPoint(Block3);
|
||||
Builder.CreateCondBr(Func3->arg_begin(), True3, False3);
|
||||
Builder.SetInsertPoint(True3);
|
||||
Builder.CreateCall(Func2, ConstantInt::getFalse(Context));
|
||||
Builder.CreateRetVoid();
|
||||
Builder.SetInsertPoint(False3);
|
||||
Builder.CreateRetVoid();
|
||||
|
||||
// Compile the function to native code
|
||||
void (*F1Ptr)() =
|
||||
reinterpret_cast<void(*)()>((intptr_t)TheJIT->getPointerToFunction(Func1));
|
||||
|
||||
F1Ptr();
|
||||
}
|
||||
|
||||
// Regression test for PR5162. This used to trigger an AssertingVH inside the
|
||||
// JIT's Function to stub mapping.
|
||||
TEST_F(JITTest, NonLazyLeaksNoStubs) {
|
||||
TheJIT->DisableLazyCompilation(true);
|
||||
|
||||
// Create two functions with a single basic block each.
|
||||
const FunctionType *FuncTy =
|
||||
cast<FunctionType>(TypeBuilder<int(), false>::get(Context));
|
||||
Function *Func1 = Function::Create(FuncTy, Function::ExternalLinkage,
|
||||
"func1", M);
|
||||
Function *Func2 = Function::Create(FuncTy, Function::InternalLinkage,
|
||||
"func2", M);
|
||||
BasicBlock *Block1 = BasicBlock::Create(Context, "block1", Func1);
|
||||
BasicBlock *Block2 = BasicBlock::Create(Context, "block2", Func2);
|
||||
|
||||
// The first function calls the second and returns the result
|
||||
IRBuilder<> Builder(Block1);
|
||||
Value *Result = Builder.CreateCall(Func2);
|
||||
Builder.CreateRet(Result);
|
||||
|
||||
// The second function just returns a constant
|
||||
Builder.SetInsertPoint(Block2);
|
||||
Builder.CreateRet(ConstantInt::get(TypeBuilder<int, false>::get(Context),42));
|
||||
|
||||
// Compile the function to native code
|
||||
(void)TheJIT->getPointerToFunction(Func1);
|
||||
|
||||
// Free the JIT state for the functions
|
||||
TheJIT->freeMachineCodeForFunction(Func1);
|
||||
TheJIT->freeMachineCodeForFunction(Func2);
|
||||
|
||||
// Delete the first function (and show that is has no users)
|
||||
EXPECT_EQ(Func1->getNumUses(), 0u);
|
||||
Func1->eraseFromParent();
|
||||
|
||||
// Delete the second function (and show that it has no users - it had one,
|
||||
// func1 but that's gone now)
|
||||
EXPECT_EQ(Func2->getNumUses(), 0u);
|
||||
Func2->eraseFromParent();
|
||||
}
|
||||
|
||||
TEST_F(JITTest, ModuleDeletion) {
|
||||
TheJIT->DisableLazyCompilation(false);
|
||||
LoadAssembly("define void @main() { "
|
||||
" call i32 @computeVal() "
|
||||
" ret void "
|
||||
"} "
|
||||
" "
|
||||
"define internal i32 @computeVal() { "
|
||||
" ret i32 0 "
|
||||
"} ");
|
||||
Function *func = M->getFunction("main");
|
||||
TheJIT->getPointerToFunction(func);
|
||||
TheJIT->removeModule(M);
|
||||
delete M;
|
||||
|
||||
SmallPtrSet<const void*, 2> FunctionsDeallocated;
|
||||
for (unsigned i = 0, e = RJMM->deallocateFunctionBodyCalls.size();
|
||||
i != e; ++i) {
|
||||
FunctionsDeallocated.insert(RJMM->deallocateFunctionBodyCalls[i].Body);
|
||||
}
|
||||
for (unsigned i = 0, e = RJMM->startFunctionBodyCalls.size(); i != e; ++i) {
|
||||
EXPECT_TRUE(FunctionsDeallocated.count(
|
||||
RJMM->startFunctionBodyCalls[i].Result))
|
||||
<< "Function leaked: \n" << RJMM->startFunctionBodyCalls[i].F_dump;
|
||||
}
|
||||
EXPECT_EQ(RJMM->startFunctionBodyCalls.size(),
|
||||
RJMM->deallocateFunctionBodyCalls.size());
|
||||
|
||||
SmallPtrSet<const void*, 2> ExceptionTablesDeallocated;
|
||||
unsigned NumTablesDeallocated = 0;
|
||||
for (unsigned i = 0, e = RJMM->deallocateExceptionTableCalls.size();
|
||||
i != e; ++i) {
|
||||
ExceptionTablesDeallocated.insert(
|
||||
RJMM->deallocateExceptionTableCalls[i].ET);
|
||||
if (RJMM->deallocateExceptionTableCalls[i].ET != NULL) {
|
||||
// If JITEmitDebugInfo is off, we'll "deallocate" NULL, which doesn't
|
||||
// appear in startExceptionTableCalls.
|
||||
NumTablesDeallocated++;
|
||||
}
|
||||
}
|
||||
for (unsigned i = 0, e = RJMM->startExceptionTableCalls.size(); i != e; ++i) {
|
||||
EXPECT_TRUE(ExceptionTablesDeallocated.count(
|
||||
RJMM->startExceptionTableCalls[i].Result))
|
||||
<< "Function's exception table leaked: \n"
|
||||
<< RJMM->startExceptionTableCalls[i].F_dump;
|
||||
}
|
||||
EXPECT_EQ(RJMM->startExceptionTableCalls.size(),
|
||||
NumTablesDeallocated);
|
||||
}
|
||||
|
||||
// ARM and PPC still emit stubs for calls since the target may be too far away
|
||||
// to call directly. This #if can probably be removed when
|
||||
// http://llvm.org/PR5201 is fixed.
|
||||
#if !defined(__arm__) && !defined(__powerpc__) && !defined(__ppc__)
|
||||
typedef int (*FooPtr) ();
|
||||
|
||||
TEST_F(JITTest, NoStubs) {
|
||||
LoadAssembly("define void @bar() {"
|
||||
"entry: "
|
||||
"ret void"
|
||||
"}"
|
||||
" "
|
||||
"define i32 @foo() {"
|
||||
"entry:"
|
||||
"call void @bar()"
|
||||
"ret i32 undef"
|
||||
"}"
|
||||
" "
|
||||
"define i32 @main() {"
|
||||
"entry:"
|
||||
"%0 = call i32 @foo()"
|
||||
"call void @bar()"
|
||||
"ret i32 undef"
|
||||
"}");
|
||||
Function *foo = M->getFunction("foo");
|
||||
uintptr_t tmp = (uintptr_t)(TheJIT->getPointerToFunction(foo));
|
||||
FooPtr ptr = (FooPtr)(tmp);
|
||||
|
||||
(ptr)();
|
||||
|
||||
// We should now allocate no more stubs, we have the code to foo
|
||||
// and the existing stub for bar.
|
||||
int stubsBefore = RJMM->stubsAllocated;
|
||||
Function *func = M->getFunction("main");
|
||||
TheJIT->getPointerToFunction(func);
|
||||
|
||||
Function *bar = M->getFunction("bar");
|
||||
TheJIT->getPointerToFunction(bar);
|
||||
|
||||
ASSERT_EQ(stubsBefore, RJMM->stubsAllocated);
|
||||
}
|
||||
#endif // !ARM && !PPC
|
||||
|
||||
TEST_F(JITTest, FunctionPointersOutliveTheirCreator) {
|
||||
TheJIT->DisableLazyCompilation(true);
|
||||
LoadAssembly("define i8()* @get_foo_addr() { "
|
||||
" ret i8()* @foo "
|
||||
"} "
|
||||
" "
|
||||
"define i8 @foo() { "
|
||||
" ret i8 42 "
|
||||
"} ");
|
||||
Function *F_get_foo_addr = M->getFunction("get_foo_addr");
|
||||
|
||||
typedef char(*fooT)();
|
||||
fooT (*get_foo_addr)() = reinterpret_cast<fooT(*)()>(
|
||||
(intptr_t)TheJIT->getPointerToFunction(F_get_foo_addr));
|
||||
fooT foo_addr = get_foo_addr();
|
||||
|
||||
// Now free get_foo_addr. This should not free the machine code for foo or
|
||||
// any call stub returned as foo's canonical address.
|
||||
TheJIT->freeMachineCodeForFunction(F_get_foo_addr);
|
||||
|
||||
// Check by calling the reported address of foo.
|
||||
EXPECT_EQ(42, foo_addr());
|
||||
|
||||
// The reported address should also be the same as the result of a subsequent
|
||||
// getPointerToFunction(foo).
|
||||
#if 0
|
||||
// Fails until PR5126 is fixed:
|
||||
Function *F_foo = M->getFunction("foo");
|
||||
fooT foo = reinterpret_cast<fooT>(
|
||||
(intptr_t)TheJIT->getPointerToFunction(F_foo));
|
||||
EXPECT_EQ((intptr_t)foo, (intptr_t)foo_addr);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ARM doesn't have an implementation of replaceMachineCodeForFunction(), so
|
||||
// recompileAndRelinkFunction doesn't work.
|
||||
#if !defined(__arm__)
|
||||
TEST_F(JITTest, FunctionIsRecompiledAndRelinked) {
|
||||
Function *F = Function::Create(TypeBuilder<int(void), false>::get(Context),
|
||||
GlobalValue::ExternalLinkage, "test", M);
|
||||
BasicBlock *Entry = BasicBlock::Create(Context, "entry", F);
|
||||
IRBuilder<> Builder(Entry);
|
||||
Value *Val = ConstantInt::get(TypeBuilder<int, false>::get(Context), 1);
|
||||
Builder.CreateRet(Val);
|
||||
|
||||
TheJIT->DisableLazyCompilation(true);
|
||||
// Compile the function once, and make sure it works.
|
||||
int (*OrigFPtr)() = reinterpret_cast<int(*)()>(
|
||||
(intptr_t)TheJIT->recompileAndRelinkFunction(F));
|
||||
EXPECT_EQ(1, OrigFPtr());
|
||||
|
||||
// Now change the function to return a different value.
|
||||
Entry->eraseFromParent();
|
||||
BasicBlock *NewEntry = BasicBlock::Create(Context, "new_entry", F);
|
||||
Builder.SetInsertPoint(NewEntry);
|
||||
Val = ConstantInt::get(TypeBuilder<int, false>::get(Context), 2);
|
||||
Builder.CreateRet(Val);
|
||||
// Recompile it, which should produce a new function pointer _and_ update the
|
||||
// old one.
|
||||
int (*NewFPtr)() = reinterpret_cast<int(*)()>(
|
||||
(intptr_t)TheJIT->recompileAndRelinkFunction(F));
|
||||
|
||||
EXPECT_EQ(2, NewFPtr())
|
||||
<< "The new pointer should call the new version of the function";
|
||||
EXPECT_EQ(2, OrigFPtr())
|
||||
<< "The old pointer's target should now jump to the new version";
|
||||
}
|
||||
#endif // !defined(__arm__)
|
||||
|
||||
} // anonymous namespace
|
||||
// This variable is intentionally defined differently in the statically-compiled
|
||||
// program from the IR input to the JIT to assert that the JIT doesn't use its
|
||||
// definition.
|
||||
extern "C" int32_t JITTest_AvailableExternallyGlobal;
|
||||
int32_t JITTest_AvailableExternallyGlobal = 42;
|
||||
namespace {
|
||||
|
||||
TEST_F(JITTest, AvailableExternallyGlobalIsntEmitted) {
|
||||
TheJIT->DisableLazyCompilation(true);
|
||||
LoadAssembly("@JITTest_AvailableExternallyGlobal = "
|
||||
" available_externally global i32 7 "
|
||||
" "
|
||||
"define i32 @loader() { "
|
||||
" %result = load i32* @JITTest_AvailableExternallyGlobal "
|
||||
" ret i32 %result "
|
||||
"} ");
|
||||
Function *loaderIR = M->getFunction("loader");
|
||||
|
||||
int32_t (*loader)() = reinterpret_cast<int32_t(*)()>(
|
||||
(intptr_t)TheJIT->getPointerToFunction(loaderIR));
|
||||
EXPECT_EQ(42, loader()) << "func should return 42 from the external global,"
|
||||
<< " not 7 from the IR version.";
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
// This function is intentionally defined differently in the statically-compiled
|
||||
// program from the IR input to the JIT to assert that the JIT doesn't use its
|
||||
// definition.
|
||||
extern "C" int32_t JITTest_AvailableExternallyFunction() {
|
||||
return 42;
|
||||
}
|
||||
namespace {
|
||||
|
||||
TEST_F(JITTest, AvailableExternallyFunctionIsntCompiled) {
|
||||
TheJIT->DisableLazyCompilation(true);
|
||||
LoadAssembly("define available_externally i32 "
|
||||
" @JITTest_AvailableExternallyFunction() { "
|
||||
" ret i32 7 "
|
||||
"} "
|
||||
" "
|
||||
"define i32 @func() { "
|
||||
" %result = tail call i32 "
|
||||
" @JITTest_AvailableExternallyFunction() "
|
||||
" ret i32 %result "
|
||||
"} ");
|
||||
Function *funcIR = M->getFunction("func");
|
||||
|
||||
int32_t (*func)() = reinterpret_cast<int32_t(*)()>(
|
||||
(intptr_t)TheJIT->getPointerToFunction(funcIR));
|
||||
EXPECT_EQ(42, func()) << "func should return 42 from the static version,"
|
||||
<< " not 7 from the IR version.";
|
||||
}
|
||||
|
||||
TEST_F(JITTest, NeedsExactSizeWithManyGlobals) {
|
||||
// PR5291: When the JMM needed the exact size of function bodies before
|
||||
// starting to emit them, the JITEmitter would modify a set while iterating
|
||||
// over it.
|
||||
TheJIT->DisableLazyCompilation(true);
|
||||
RJMM->setSizeRequired(true);
|
||||
|
||||
LoadAssembly("@A = global i32 42 "
|
||||
"@B = global i32* @A "
|
||||
"@C = global i32** @B "
|
||||
"@D = global i32*** @C "
|
||||
"@E = global i32**** @D "
|
||||
"@F = global i32***** @E "
|
||||
"@G = global i32****** @F "
|
||||
"@H = global i32******* @G "
|
||||
"@I = global i32******** @H "
|
||||
"define i32********* @test() { "
|
||||
" ret i32********* @I "
|
||||
"}");
|
||||
Function *testIR = M->getFunction("test");
|
||||
int32_t********* (*test)() = reinterpret_cast<int32_t*********(*)()>(
|
||||
(intptr_t)TheJIT->getPointerToFunction(testIR));
|
||||
EXPECT_EQ(42, *********test());
|
||||
}
|
||||
|
||||
TEST_F(JITTest, EscapedLazyStubStillCallable) {
|
||||
TheJIT->DisableLazyCompilation(false);
|
||||
LoadAssembly("define internal i32 @stubbed() { "
|
||||
" ret i32 42 "
|
||||
"} "
|
||||
" "
|
||||
"define i32()* @get_stub() { "
|
||||
" ret i32()* @stubbed "
|
||||
"} ");
|
||||
typedef int32_t(*StubTy)();
|
||||
|
||||
// Call get_stub() to get the address of @stubbed without actually JITting it.
|
||||
Function *get_stubIR = M->getFunction("get_stub");
|
||||
StubTy (*get_stub)() = reinterpret_cast<StubTy(*)()>(
|
||||
(intptr_t)TheJIT->getPointerToFunction(get_stubIR));
|
||||
StubTy stubbed = get_stub();
|
||||
// Now get_stubIR is the only reference to stubbed's stub.
|
||||
get_stubIR->eraseFromParent();
|
||||
// Now there are no references inside the JIT, but we've got a pointer outside
|
||||
// it. The stub should be callable and return the right value.
|
||||
EXPECT_EQ(42, stubbed());
|
||||
}
|
||||
|
||||
// Converts the LLVM assembly to bitcode and returns it in a std::string. An
|
||||
// empty string indicates an error.
|
||||
std::string AssembleToBitcode(LLVMContext &Context, const char *Assembly) {
|
||||
Module TempModule("TempModule", Context);
|
||||
if (!LoadAssemblyInto(&TempModule, Assembly)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Result;
|
||||
raw_string_ostream OS(Result);
|
||||
WriteBitcodeToFile(&TempModule, OS);
|
||||
OS.flush();
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Returns a newly-created ExecutionEngine that reads the bitcode in 'Bitcode'
|
||||
// lazily. The associated Module (owned by the ExecutionEngine) is returned in
|
||||
// M. Both will be NULL on an error. Bitcode must live at least as long as the
|
||||
// ExecutionEngine.
|
||||
ExecutionEngine *getJITFromBitcode(
|
||||
LLVMContext &Context, const std::string &Bitcode, Module *&M) {
|
||||
// c_str() is null-terminated like MemoryBuffer::getMemBuffer requires.
|
||||
MemoryBuffer *BitcodeBuffer =
|
||||
MemoryBuffer::getMemBuffer(Bitcode, "Bitcode for test");
|
||||
std::string errMsg;
|
||||
M = getLazyBitcodeModule(BitcodeBuffer, Context, &errMsg);
|
||||
if (M == NULL) {
|
||||
ADD_FAILURE() << errMsg;
|
||||
delete BitcodeBuffer;
|
||||
return NULL;
|
||||
}
|
||||
ExecutionEngine *TheJIT = EngineBuilder(M)
|
||||
.setEngineKind(EngineKind::JIT)
|
||||
.setErrorStr(&errMsg)
|
||||
.create();
|
||||
if (TheJIT == NULL) {
|
||||
ADD_FAILURE() << errMsg;
|
||||
delete M;
|
||||
M = NULL;
|
||||
return NULL;
|
||||
}
|
||||
return TheJIT;
|
||||
}
|
||||
|
||||
TEST(LazyLoadedJITTest, MaterializableAvailableExternallyFunctionIsntCompiled) {
|
||||
LLVMContext Context;
|
||||
const std::string Bitcode =
|
||||
AssembleToBitcode(Context,
|
||||
"define available_externally i32 "
|
||||
" @JITTest_AvailableExternallyFunction() { "
|
||||
" ret i32 7 "
|
||||
"} "
|
||||
" "
|
||||
"define i32 @func() { "
|
||||
" %result = tail call i32 "
|
||||
" @JITTest_AvailableExternallyFunction() "
|
||||
" ret i32 %result "
|
||||
"} ");
|
||||
ASSERT_FALSE(Bitcode.empty()) << "Assembling failed";
|
||||
Module *M;
|
||||
OwningPtr<ExecutionEngine> TheJIT(getJITFromBitcode(Context, Bitcode, M));
|
||||
ASSERT_TRUE(TheJIT.get()) << "Failed to create JIT.";
|
||||
TheJIT->DisableLazyCompilation(true);
|
||||
|
||||
Function *funcIR = M->getFunction("func");
|
||||
Function *availableFunctionIR =
|
||||
M->getFunction("JITTest_AvailableExternallyFunction");
|
||||
|
||||
// Double-check that the available_externally function is still unmaterialized
|
||||
// when getPointerToFunction needs to find out if it's available_externally.
|
||||
EXPECT_TRUE(availableFunctionIR->isMaterializable());
|
||||
|
||||
int32_t (*func)() = reinterpret_cast<int32_t(*)()>(
|
||||
(intptr_t)TheJIT->getPointerToFunction(funcIR));
|
||||
EXPECT_EQ(42, func()) << "func should return 42 from the static version,"
|
||||
<< " not 7 from the IR version.";
|
||||
}
|
||||
|
||||
TEST(LazyLoadedJITTest, EagerCompiledRecursionThroughGhost) {
|
||||
LLVMContext Context;
|
||||
const std::string Bitcode =
|
||||
AssembleToBitcode(Context,
|
||||
"define i32 @recur1(i32 %a) { "
|
||||
" %zero = icmp eq i32 %a, 0 "
|
||||
" br i1 %zero, label %done, label %notdone "
|
||||
"done: "
|
||||
" ret i32 3 "
|
||||
"notdone: "
|
||||
" %am1 = sub i32 %a, 1 "
|
||||
" %result = call i32 @recur2(i32 %am1) "
|
||||
" ret i32 %result "
|
||||
"} "
|
||||
" "
|
||||
"define i32 @recur2(i32 %b) { "
|
||||
" %result = call i32 @recur1(i32 %b) "
|
||||
" ret i32 %result "
|
||||
"} ");
|
||||
ASSERT_FALSE(Bitcode.empty()) << "Assembling failed";
|
||||
Module *M;
|
||||
OwningPtr<ExecutionEngine> TheJIT(getJITFromBitcode(Context, Bitcode, M));
|
||||
ASSERT_TRUE(TheJIT.get()) << "Failed to create JIT.";
|
||||
TheJIT->DisableLazyCompilation(true);
|
||||
|
||||
Function *recur1IR = M->getFunction("recur1");
|
||||
Function *recur2IR = M->getFunction("recur2");
|
||||
EXPECT_TRUE(recur1IR->isMaterializable());
|
||||
EXPECT_TRUE(recur2IR->isMaterializable());
|
||||
|
||||
int32_t (*recur1)(int32_t) = reinterpret_cast<int32_t(*)(int32_t)>(
|
||||
(intptr_t)TheJIT->getPointerToFunction(recur1IR));
|
||||
EXPECT_EQ(3, recur1(4));
|
||||
}
|
||||
|
||||
// This code is copied from JITEventListenerTest, but it only runs once for all
|
||||
// the tests in this directory. Everything seems fine, but that's strange
|
||||
// behavior.
|
||||
class JITEnvironment : public testing::Environment {
|
||||
virtual void SetUp() {
|
||||
// Required to create a JIT.
|
||||
InitializeNativeTarget();
|
||||
}
|
||||
};
|
||||
testing::Environment* const jit_env =
|
||||
testing::AddGlobalTestEnvironment(new JITEnvironment);
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
##===- unittests/ExecutionEngine/JIT/Makefile --------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ../../..
|
||||
TESTNAME = JIT
|
||||
LINK_COMPONENTS := asmparser bitreader bitwriter core jit native support
|
||||
|
||||
include $(LEVEL)/Makefile.config
|
||||
include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest
|
||||
|
||||
# Permit these tests to use the JIT's symbolic lookup.
|
||||
LD.Flags += $(RDYNAMIC)
|
@ -1,164 +0,0 @@
|
||||
//===- MultiJITTest.cpp - Unit tests for instantiating multiple JITs ------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/Assembly/Parser.h"
|
||||
#include "llvm/ExecutionEngine/GenericValue.h"
|
||||
#include "llvm/ExecutionEngine/JIT.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include <vector>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
bool LoadAssemblyInto(Module *M, const char *assembly) {
|
||||
SMDiagnostic Error;
|
||||
bool success =
|
||||
NULL != ParseAssemblyString(assembly, M, Error, M->getContext());
|
||||
std::string errMsg;
|
||||
raw_string_ostream os(errMsg);
|
||||
Error.Print("", os);
|
||||
EXPECT_TRUE(success) << os.str();
|
||||
return success;
|
||||
}
|
||||
|
||||
void createModule1(LLVMContext &Context1, Module *&M1, Function *&FooF1) {
|
||||
M1 = new Module("test1", Context1);
|
||||
LoadAssemblyInto(M1,
|
||||
"define i32 @add1(i32 %ArgX1) { "
|
||||
"entry: "
|
||||
" %addresult = add i32 1, %ArgX1 "
|
||||
" ret i32 %addresult "
|
||||
"} "
|
||||
" "
|
||||
"define i32 @foo1() { "
|
||||
"entry: "
|
||||
" %add1 = call i32 @add1(i32 10) "
|
||||
" ret i32 %add1 "
|
||||
"} ");
|
||||
FooF1 = M1->getFunction("foo1");
|
||||
}
|
||||
|
||||
void createModule2(LLVMContext &Context2, Module *&M2, Function *&FooF2) {
|
||||
M2 = new Module("test2", Context2);
|
||||
LoadAssemblyInto(M2,
|
||||
"define i32 @add2(i32 %ArgX2) { "
|
||||
"entry: "
|
||||
" %addresult = add i32 2, %ArgX2 "
|
||||
" ret i32 %addresult "
|
||||
"} "
|
||||
" "
|
||||
"define i32 @foo2() { "
|
||||
"entry: "
|
||||
" %add2 = call i32 @add2(i32 10) "
|
||||
" ret i32 %add2 "
|
||||
"} ");
|
||||
FooF2 = M2->getFunction("foo2");
|
||||
}
|
||||
|
||||
TEST(MultiJitTest, EagerMode) {
|
||||
LLVMContext Context1;
|
||||
Module *M1 = 0;
|
||||
Function *FooF1 = 0;
|
||||
createModule1(Context1, M1, FooF1);
|
||||
|
||||
LLVMContext Context2;
|
||||
Module *M2 = 0;
|
||||
Function *FooF2 = 0;
|
||||
createModule2(Context2, M2, FooF2);
|
||||
|
||||
// Now we create the JIT in eager mode
|
||||
OwningPtr<ExecutionEngine> EE1(EngineBuilder(M1).create());
|
||||
EE1->DisableLazyCompilation(true);
|
||||
OwningPtr<ExecutionEngine> EE2(EngineBuilder(M2).create());
|
||||
EE2->DisableLazyCompilation(true);
|
||||
|
||||
// Call the `foo' function with no arguments:
|
||||
std::vector<GenericValue> noargs;
|
||||
GenericValue gv1 = EE1->runFunction(FooF1, noargs);
|
||||
GenericValue gv2 = EE2->runFunction(FooF2, noargs);
|
||||
|
||||
// Import result of execution:
|
||||
EXPECT_EQ(gv1.IntVal, 11);
|
||||
EXPECT_EQ(gv2.IntVal, 12);
|
||||
|
||||
EE1->freeMachineCodeForFunction(FooF1);
|
||||
EE2->freeMachineCodeForFunction(FooF2);
|
||||
}
|
||||
|
||||
TEST(MultiJitTest, LazyMode) {
|
||||
LLVMContext Context1;
|
||||
Module *M1 = 0;
|
||||
Function *FooF1 = 0;
|
||||
createModule1(Context1, M1, FooF1);
|
||||
|
||||
LLVMContext Context2;
|
||||
Module *M2 = 0;
|
||||
Function *FooF2 = 0;
|
||||
createModule2(Context2, M2, FooF2);
|
||||
|
||||
// Now we create the JIT in lazy mode
|
||||
OwningPtr<ExecutionEngine> EE1(EngineBuilder(M1).create());
|
||||
EE1->DisableLazyCompilation(false);
|
||||
OwningPtr<ExecutionEngine> EE2(EngineBuilder(M2).create());
|
||||
EE2->DisableLazyCompilation(false);
|
||||
|
||||
// Call the `foo' function with no arguments:
|
||||
std::vector<GenericValue> noargs;
|
||||
GenericValue gv1 = EE1->runFunction(FooF1, noargs);
|
||||
GenericValue gv2 = EE2->runFunction(FooF2, noargs);
|
||||
|
||||
// Import result of execution:
|
||||
EXPECT_EQ(gv1.IntVal, 11);
|
||||
EXPECT_EQ(gv2.IntVal, 12);
|
||||
|
||||
EE1->freeMachineCodeForFunction(FooF1);
|
||||
EE2->freeMachineCodeForFunction(FooF2);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
extern void *getPointerToNamedFunction(const char *Name);
|
||||
}
|
||||
|
||||
TEST(MultiJitTest, JitPool) {
|
||||
LLVMContext Context1;
|
||||
Module *M1 = 0;
|
||||
Function *FooF1 = 0;
|
||||
createModule1(Context1, M1, FooF1);
|
||||
|
||||
LLVMContext Context2;
|
||||
Module *M2 = 0;
|
||||
Function *FooF2 = 0;
|
||||
createModule2(Context2, M2, FooF2);
|
||||
|
||||
// Now we create two JITs
|
||||
OwningPtr<ExecutionEngine> EE1(EngineBuilder(M1).create());
|
||||
OwningPtr<ExecutionEngine> EE2(EngineBuilder(M2).create());
|
||||
|
||||
Function *F1 = EE1->FindFunctionNamed("foo1");
|
||||
void *foo1 = EE1->getPointerToFunction(F1);
|
||||
|
||||
Function *F2 = EE2->FindFunctionNamed("foo2");
|
||||
void *foo2 = EE2->getPointerToFunction(F2);
|
||||
|
||||
// Function in M1
|
||||
EXPECT_EQ(getPointerToNamedFunction("foo1"), foo1);
|
||||
|
||||
// Function in M2
|
||||
EXPECT_EQ(getPointerToNamedFunction("foo2"), foo2);
|
||||
|
||||
// Symbol search
|
||||
EXPECT_EQ((intptr_t)getPointerToNamedFunction("getPointerToNamedFunction"),
|
||||
(intptr_t)&getPointerToNamedFunction);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
@ -1,18 +0,0 @@
|
||||
##===- unittests/ExecutionEngine/Makefile ------------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ../..
|
||||
TESTNAME = ExecutionEngine
|
||||
LINK_COMPONENTS := engine interpreter
|
||||
|
||||
include $(LEVEL)/Makefile.config
|
||||
|
||||
PARALLEL_DIRS = JIT
|
||||
|
||||
include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest
|
@ -1,17 +0,0 @@
|
||||
##===- unittests/Makefile ----------------------------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ..
|
||||
|
||||
PARALLEL_DIRS = ADT ExecutionEngine Support Transforms VMCore
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
clean::
|
||||
$(Verb) $(RM) -f *Tests
|
@ -1,54 +0,0 @@
|
||||
##===- unittests/Makefile.unittest -------------------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
#
|
||||
# This file is included by all of the unit test makefiles.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
# Set up variables for building a unit test.
|
||||
ifdef TESTNAME
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
LLVMUnitTestExe = $(BuildMode)/$(TESTNAME)Tests$(EXEEXT)
|
||||
|
||||
# Note that these flags are duplicated when building GoogleTest itself in
|
||||
# utils/unittest/googletest/Makefile; ensure that any changes are made to both.
|
||||
CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include
|
||||
CPP.Flags += $(NO_MISSING_FIELD_INITIALIZERS) $(NO_VARIADIC_MACROS)
|
||||
CPP.Flags += -DGTEST_HAS_RTTI=0
|
||||
# libstdc++'s TR1 <tuple> header depends on RTTI and uses C++'0x features not
|
||||
# supported by Clang, so force googletest to use its own tuple implementation.
|
||||
# When we import googletest >=1.4.0, we can drop this line.
|
||||
CPP.Flags += -DGTEST_HAS_TR1_TUPLE=0
|
||||
|
||||
TESTLIBS = -lGoogleTest -lUnitTestMain
|
||||
|
||||
ifeq ($(ENABLE_SHARED), 1)
|
||||
# Add the absolute path to the dynamic library. This is ok because
|
||||
# we'll never install unittests.
|
||||
LD.Flags += $(RPATH) -Wl,$(LibDir)
|
||||
# Also set {DYLD,LD}_LIBRARY_PATH because OSX ignores the rpath most
|
||||
# of the time.
|
||||
Run.Shared := $(SHLIBPATH_VAR)="$(LibDir)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)"
|
||||
endif
|
||||
|
||||
$(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
|
||||
$(Echo) Linking $(BuildMode) unit test $(TESTNAME) $(StripWarnMsg)
|
||||
$(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
|
||||
$(TESTLIBS) $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
|
||||
$(Echo) ======= Finished Linking $(BuildMode) Unit test $(TESTNAME) \
|
||||
$(StripWarnMsg)
|
||||
|
||||
all:: $(LLVMUnitTestExe)
|
||||
|
||||
unitcheck:: $(LLVMUnitTestExe)
|
||||
$(Run.Shared) $(LLVMUnitTestExe)
|
||||
|
||||
endif
|
@ -1,143 +0,0 @@
|
||||
//===- llvm/unittest/Support/AllocatorTest.cpp - BumpPtrAllocator tests ---===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Support/Allocator.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <cstdlib>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(AllocatorTest, Basics) {
|
||||
BumpPtrAllocator Alloc;
|
||||
int *a = (int*)Alloc.Allocate(sizeof(int), 0);
|
||||
int *b = (int*)Alloc.Allocate(sizeof(int) * 10, 0);
|
||||
int *c = (int*)Alloc.Allocate(sizeof(int), 0);
|
||||
*a = 1;
|
||||
b[0] = 2;
|
||||
b[9] = 2;
|
||||
*c = 3;
|
||||
EXPECT_EQ(1, *a);
|
||||
EXPECT_EQ(2, b[0]);
|
||||
EXPECT_EQ(2, b[9]);
|
||||
EXPECT_EQ(3, *c);
|
||||
EXPECT_EQ(1U, Alloc.GetNumSlabs());
|
||||
}
|
||||
|
||||
// Allocate enough bytes to create three slabs.
|
||||
TEST(AllocatorTest, ThreeSlabs) {
|
||||
BumpPtrAllocator Alloc(4096, 4096);
|
||||
Alloc.Allocate(3000, 0);
|
||||
EXPECT_EQ(1U, Alloc.GetNumSlabs());
|
||||
Alloc.Allocate(3000, 0);
|
||||
EXPECT_EQ(2U, Alloc.GetNumSlabs());
|
||||
Alloc.Allocate(3000, 0);
|
||||
EXPECT_EQ(3U, Alloc.GetNumSlabs());
|
||||
}
|
||||
|
||||
// Allocate enough bytes to create two slabs, reset the allocator, and do it
|
||||
// again.
|
||||
TEST(AllocatorTest, TestReset) {
|
||||
BumpPtrAllocator Alloc(4096, 4096);
|
||||
Alloc.Allocate(3000, 0);
|
||||
EXPECT_EQ(1U, Alloc.GetNumSlabs());
|
||||
Alloc.Allocate(3000, 0);
|
||||
EXPECT_EQ(2U, Alloc.GetNumSlabs());
|
||||
Alloc.Reset();
|
||||
EXPECT_EQ(1U, Alloc.GetNumSlabs());
|
||||
Alloc.Allocate(3000, 0);
|
||||
EXPECT_EQ(1U, Alloc.GetNumSlabs());
|
||||
Alloc.Allocate(3000, 0);
|
||||
EXPECT_EQ(2U, Alloc.GetNumSlabs());
|
||||
}
|
||||
|
||||
// Test some allocations at varying alignments.
|
||||
TEST(AllocatorTest, TestAlignment) {
|
||||
BumpPtrAllocator Alloc;
|
||||
uintptr_t a;
|
||||
a = (uintptr_t)Alloc.Allocate(1, 2);
|
||||
EXPECT_EQ(0U, a & 1);
|
||||
a = (uintptr_t)Alloc.Allocate(1, 4);
|
||||
EXPECT_EQ(0U, a & 3);
|
||||
a = (uintptr_t)Alloc.Allocate(1, 8);
|
||||
EXPECT_EQ(0U, a & 7);
|
||||
a = (uintptr_t)Alloc.Allocate(1, 16);
|
||||
EXPECT_EQ(0U, a & 15);
|
||||
a = (uintptr_t)Alloc.Allocate(1, 32);
|
||||
EXPECT_EQ(0U, a & 31);
|
||||
a = (uintptr_t)Alloc.Allocate(1, 64);
|
||||
EXPECT_EQ(0U, a & 63);
|
||||
a = (uintptr_t)Alloc.Allocate(1, 128);
|
||||
EXPECT_EQ(0U, a & 127);
|
||||
}
|
||||
|
||||
// Test allocating just over the slab size. This tests a bug where before the
|
||||
// allocator incorrectly calculated the buffer end pointer.
|
||||
TEST(AllocatorTest, TestOverflow) {
|
||||
BumpPtrAllocator Alloc(4096, 4096);
|
||||
|
||||
// Fill the slab right up until the end pointer.
|
||||
Alloc.Allocate(4096 - sizeof(MemSlab), 0);
|
||||
EXPECT_EQ(1U, Alloc.GetNumSlabs());
|
||||
|
||||
// If we don't allocate a new slab, then we will have overflowed.
|
||||
Alloc.Allocate(1, 0);
|
||||
EXPECT_EQ(2U, Alloc.GetNumSlabs());
|
||||
}
|
||||
|
||||
// Mock slab allocator that returns slabs aligned on 4096 bytes. There is no
|
||||
// easy portable way to do this, so this is kind of a hack.
|
||||
class MockSlabAllocator : public SlabAllocator {
|
||||
MemSlab *LastSlab;
|
||||
|
||||
public:
|
||||
virtual ~MockSlabAllocator() { }
|
||||
|
||||
virtual MemSlab *Allocate(size_t Size) {
|
||||
// Allocate space for the alignment, the slab, and a void* that goes right
|
||||
// before the slab.
|
||||
size_t Alignment = 4096;
|
||||
void *MemBase = malloc(Size + Alignment - 1 + sizeof(void*));
|
||||
|
||||
// Make the slab.
|
||||
MemSlab *Slab = (MemSlab*)(((uintptr_t)MemBase+sizeof(void*)+Alignment-1) &
|
||||
~(uintptr_t)(Alignment - 1));
|
||||
Slab->Size = Size;
|
||||
Slab->NextPtr = 0;
|
||||
|
||||
// Hold a pointer to the base so we can free the whole malloced block.
|
||||
((void**)Slab)[-1] = MemBase;
|
||||
|
||||
LastSlab = Slab;
|
||||
return Slab;
|
||||
}
|
||||
|
||||
virtual void Deallocate(MemSlab *Slab) {
|
||||
free(((void**)Slab)[-1]);
|
||||
}
|
||||
|
||||
MemSlab *GetLastSlab() {
|
||||
return LastSlab;
|
||||
}
|
||||
};
|
||||
|
||||
// Allocate a large-ish block with a really large alignment so that the
|
||||
// allocator will think that it has space, but after it does the alignment it
|
||||
// will not.
|
||||
TEST(AllocatorTest, TestBigAlignment) {
|
||||
MockSlabAllocator SlabAlloc;
|
||||
BumpPtrAllocator Alloc(4096, 4096, SlabAlloc);
|
||||
uintptr_t Ptr = (uintptr_t)Alloc.Allocate(3000, 2048);
|
||||
MemSlab *Slab = SlabAlloc.GetLastSlab();
|
||||
EXPECT_LE(Ptr + 3000, ((uintptr_t)Slab) + Slab->Size);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
@ -1,60 +0,0 @@
|
||||
//===- llvm/unittest/Support/CommandLineTest.cpp - CommandLine tests ------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Config/config.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <string>
|
||||
#include <stdlib.h>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
class TempEnvVar {
|
||||
public:
|
||||
TempEnvVar(const char *name, const char *value)
|
||||
: name(name) {
|
||||
const char *old_value = getenv(name);
|
||||
EXPECT_EQ(NULL, old_value) << old_value;
|
||||
#if HAVE_SETENV
|
||||
setenv(name, value, true);
|
||||
#else
|
||||
# define SKIP_ENVIRONMENT_TESTS
|
||||
#endif
|
||||
}
|
||||
|
||||
~TempEnvVar() {
|
||||
#if HAVE_SETENV
|
||||
// Assume setenv and unsetenv come together.
|
||||
unsetenv(name);
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
const char *const name;
|
||||
};
|
||||
|
||||
#ifndef SKIP_ENVIRONMENT_TESTS
|
||||
|
||||
const char test_env_var[] = "LLVM_TEST_COMMAND_LINE_FLAGS";
|
||||
|
||||
cl::opt<std::string> EnvironmentTestOption("env-test-opt");
|
||||
TEST(CommandLineTest, ParseEnvironment) {
|
||||
TempEnvVar TEV(test_env_var, "-env-test-opt=hello");
|
||||
EXPECT_EQ("", EnvironmentTestOption);
|
||||
cl::ParseEnvironmentOptions("CommandLineTest", test_env_var);
|
||||
EXPECT_EQ("hello", EnvironmentTestOption);
|
||||
}
|
||||
|
||||
#endif // SKIP_ENVIRONMENT_TESTS
|
||||
|
||||
} // anonymous namespace
|
@ -1,351 +0,0 @@
|
||||
//===- llvm/unittest/Support/ConstantRangeTest.cpp - ConstantRange tests --===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Support/ConstantRange.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
class ConstantRangeTest : public ::testing::Test {
|
||||
protected:
|
||||
static ConstantRange Full;
|
||||
static ConstantRange Empty;
|
||||
static ConstantRange One;
|
||||
static ConstantRange Some;
|
||||
static ConstantRange Wrap;
|
||||
};
|
||||
|
||||
ConstantRange ConstantRangeTest::Full(16);
|
||||
ConstantRange ConstantRangeTest::Empty(16, false);
|
||||
ConstantRange ConstantRangeTest::One(APInt(16, 0xa));
|
||||
ConstantRange ConstantRangeTest::Some(APInt(16, 0xa), APInt(16, 0xaaa));
|
||||
ConstantRange ConstantRangeTest::Wrap(APInt(16, 0xaaa), APInt(16, 0xa));
|
||||
|
||||
TEST_F(ConstantRangeTest, Basics) {
|
||||
EXPECT_TRUE(Full.isFullSet());
|
||||
EXPECT_FALSE(Full.isEmptySet());
|
||||
EXPECT_FALSE(Full.isWrappedSet());
|
||||
EXPECT_TRUE(Full.contains(APInt(16, 0x0)));
|
||||
EXPECT_TRUE(Full.contains(APInt(16, 0x9)));
|
||||
EXPECT_TRUE(Full.contains(APInt(16, 0xa)));
|
||||
EXPECT_TRUE(Full.contains(APInt(16, 0xaa9)));
|
||||
EXPECT_TRUE(Full.contains(APInt(16, 0xaaa)));
|
||||
|
||||
EXPECT_FALSE(Empty.isFullSet());
|
||||
EXPECT_TRUE(Empty.isEmptySet());
|
||||
EXPECT_FALSE(Empty.isWrappedSet());
|
||||
EXPECT_FALSE(Empty.contains(APInt(16, 0x0)));
|
||||
EXPECT_FALSE(Empty.contains(APInt(16, 0x9)));
|
||||
EXPECT_FALSE(Empty.contains(APInt(16, 0xa)));
|
||||
EXPECT_FALSE(Empty.contains(APInt(16, 0xaa9)));
|
||||
EXPECT_FALSE(Empty.contains(APInt(16, 0xaaa)));
|
||||
|
||||
EXPECT_FALSE(One.isFullSet());
|
||||
EXPECT_FALSE(One.isEmptySet());
|
||||
EXPECT_FALSE(One.isWrappedSet());
|
||||
EXPECT_FALSE(One.contains(APInt(16, 0x0)));
|
||||
EXPECT_FALSE(One.contains(APInt(16, 0x9)));
|
||||
EXPECT_TRUE(One.contains(APInt(16, 0xa)));
|
||||
EXPECT_FALSE(One.contains(APInt(16, 0xaa9)));
|
||||
EXPECT_FALSE(One.contains(APInt(16, 0xaaa)));
|
||||
|
||||
EXPECT_FALSE(Some.isFullSet());
|
||||
EXPECT_FALSE(Some.isEmptySet());
|
||||
EXPECT_FALSE(Some.isWrappedSet());
|
||||
EXPECT_FALSE(Some.contains(APInt(16, 0x0)));
|
||||
EXPECT_FALSE(Some.contains(APInt(16, 0x9)));
|
||||
EXPECT_TRUE(Some.contains(APInt(16, 0xa)));
|
||||
EXPECT_TRUE(Some.contains(APInt(16, 0xaa9)));
|
||||
EXPECT_FALSE(Some.contains(APInt(16, 0xaaa)));
|
||||
|
||||
EXPECT_FALSE(Wrap.isFullSet());
|
||||
EXPECT_FALSE(Wrap.isEmptySet());
|
||||
EXPECT_TRUE(Wrap.isWrappedSet());
|
||||
EXPECT_TRUE(Wrap.contains(APInt(16, 0x0)));
|
||||
EXPECT_TRUE(Wrap.contains(APInt(16, 0x9)));
|
||||
EXPECT_FALSE(Wrap.contains(APInt(16, 0xa)));
|
||||
EXPECT_FALSE(Wrap.contains(APInt(16, 0xaa9)));
|
||||
EXPECT_TRUE(Wrap.contains(APInt(16, 0xaaa)));
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, Equality) {
|
||||
EXPECT_EQ(Full, Full);
|
||||
EXPECT_EQ(Empty, Empty);
|
||||
EXPECT_EQ(One, One);
|
||||
EXPECT_EQ(Some, Some);
|
||||
EXPECT_EQ(Wrap, Wrap);
|
||||
EXPECT_NE(Full, Empty);
|
||||
EXPECT_NE(Full, One);
|
||||
EXPECT_NE(Full, Some);
|
||||
EXPECT_NE(Full, Wrap);
|
||||
EXPECT_NE(Empty, One);
|
||||
EXPECT_NE(Empty, Some);
|
||||
EXPECT_NE(Empty, Wrap);
|
||||
EXPECT_NE(One, Some);
|
||||
EXPECT_NE(One, Wrap);
|
||||
EXPECT_NE(Some, Wrap);
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, SingleElement) {
|
||||
EXPECT_EQ(Full.getSingleElement(), static_cast<APInt *>(NULL));
|
||||
EXPECT_EQ(Empty.getSingleElement(), static_cast<APInt *>(NULL));
|
||||
EXPECT_EQ(*One.getSingleElement(), APInt(16, 0xa));
|
||||
EXPECT_EQ(Some.getSingleElement(), static_cast<APInt *>(NULL));
|
||||
EXPECT_EQ(Wrap.getSingleElement(), static_cast<APInt *>(NULL));
|
||||
|
||||
EXPECT_FALSE(Full.isSingleElement());
|
||||
EXPECT_FALSE(Empty.isSingleElement());
|
||||
EXPECT_TRUE(One.isSingleElement());
|
||||
EXPECT_FALSE(Some.isSingleElement());
|
||||
EXPECT_FALSE(Wrap.isSingleElement());
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, GetSetSize) {
|
||||
EXPECT_EQ(Full.getSetSize(), APInt(16, 0));
|
||||
EXPECT_EQ(Empty.getSetSize(), APInt(16, 0));
|
||||
EXPECT_EQ(One.getSetSize(), APInt(16, 1));
|
||||
EXPECT_EQ(Some.getSetSize(), APInt(16, 0xaa0));
|
||||
EXPECT_EQ(Wrap.getSetSize(), APInt(16, 0x10000 - 0xaa0));
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, GetMinsAndMaxes) {
|
||||
EXPECT_EQ(Full.getUnsignedMax(), APInt(16, UINT16_MAX));
|
||||
EXPECT_EQ(One.getUnsignedMax(), APInt(16, 0xa));
|
||||
EXPECT_EQ(Some.getUnsignedMax(), APInt(16, 0xaa9));
|
||||
EXPECT_EQ(Wrap.getUnsignedMax(), APInt(16, UINT16_MAX));
|
||||
|
||||
EXPECT_EQ(Full.getUnsignedMin(), APInt(16, 0));
|
||||
EXPECT_EQ(One.getUnsignedMin(), APInt(16, 0xa));
|
||||
EXPECT_EQ(Some.getUnsignedMin(), APInt(16, 0xa));
|
||||
EXPECT_EQ(Wrap.getUnsignedMin(), APInt(16, 0));
|
||||
|
||||
EXPECT_EQ(Full.getSignedMax(), APInt(16, INT16_MAX));
|
||||
EXPECT_EQ(One.getSignedMax(), APInt(16, 0xa));
|
||||
EXPECT_EQ(Some.getSignedMax(), APInt(16, 0xaa9));
|
||||
EXPECT_EQ(Wrap.getSignedMax(), APInt(16, INT16_MAX));
|
||||
|
||||
EXPECT_EQ(Full.getSignedMin(), APInt(16, (uint64_t)INT16_MIN));
|
||||
EXPECT_EQ(One.getSignedMin(), APInt(16, 0xa));
|
||||
EXPECT_EQ(Some.getSignedMin(), APInt(16, 0xa));
|
||||
EXPECT_EQ(Wrap.getSignedMin(), APInt(16, (uint64_t)INT16_MIN));
|
||||
|
||||
// Found by Klee
|
||||
EXPECT_EQ(ConstantRange(APInt(4, 7), APInt(4, 0)).getSignedMax(),
|
||||
APInt(4, 7));
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, Trunc) {
|
||||
ConstantRange TFull = Full.truncate(10);
|
||||
ConstantRange TEmpty = Empty.truncate(10);
|
||||
ConstantRange TOne = One.truncate(10);
|
||||
ConstantRange TSome = Some.truncate(10);
|
||||
ConstantRange TWrap = Wrap.truncate(10);
|
||||
EXPECT_TRUE(TFull.isFullSet());
|
||||
EXPECT_TRUE(TEmpty.isEmptySet());
|
||||
EXPECT_EQ(TOne, ConstantRange(APInt(One.getLower()).trunc(10),
|
||||
APInt(One.getUpper()).trunc(10)));
|
||||
EXPECT_TRUE(TSome.isFullSet());
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, ZExt) {
|
||||
ConstantRange ZFull = Full.zeroExtend(20);
|
||||
ConstantRange ZEmpty = Empty.zeroExtend(20);
|
||||
ConstantRange ZOne = One.zeroExtend(20);
|
||||
ConstantRange ZSome = Some.zeroExtend(20);
|
||||
ConstantRange ZWrap = Wrap.zeroExtend(20);
|
||||
EXPECT_EQ(ZFull, ConstantRange(APInt(20, 0), APInt(20, 0x10000)));
|
||||
EXPECT_TRUE(ZEmpty.isEmptySet());
|
||||
EXPECT_EQ(ZOne, ConstantRange(APInt(One.getLower()).zext(20),
|
||||
APInt(One.getUpper()).zext(20)));
|
||||
EXPECT_EQ(ZSome, ConstantRange(APInt(Some.getLower()).zext(20),
|
||||
APInt(Some.getUpper()).zext(20)));
|
||||
EXPECT_EQ(ZWrap, ConstantRange(APInt(Wrap.getLower()).zext(20),
|
||||
APInt(Wrap.getUpper()).zext(20)));
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, SExt) {
|
||||
ConstantRange SFull = Full.signExtend(20);
|
||||
ConstantRange SEmpty = Empty.signExtend(20);
|
||||
ConstantRange SOne = One.signExtend(20);
|
||||
ConstantRange SSome = Some.signExtend(20);
|
||||
ConstantRange SWrap = Wrap.signExtend(20);
|
||||
EXPECT_EQ(SFull, ConstantRange(APInt(20, (uint64_t)INT16_MIN, true),
|
||||
APInt(20, INT16_MAX + 1, true)));
|
||||
EXPECT_TRUE(SEmpty.isEmptySet());
|
||||
EXPECT_EQ(SOne, ConstantRange(APInt(One.getLower()).sext(20),
|
||||
APInt(One.getUpper()).sext(20)));
|
||||
EXPECT_EQ(SSome, ConstantRange(APInt(Some.getLower()).sext(20),
|
||||
APInt(Some.getUpper()).sext(20)));
|
||||
EXPECT_EQ(SWrap, ConstantRange(APInt(Wrap.getLower()).sext(20),
|
||||
APInt(Wrap.getUpper()).sext(20)));
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, IntersectWith) {
|
||||
EXPECT_EQ(Empty.intersectWith(Full), Empty);
|
||||
EXPECT_EQ(Empty.intersectWith(Empty), Empty);
|
||||
EXPECT_EQ(Empty.intersectWith(One), Empty);
|
||||
EXPECT_EQ(Empty.intersectWith(Some), Empty);
|
||||
EXPECT_EQ(Empty.intersectWith(Wrap), Empty);
|
||||
EXPECT_EQ(Full.intersectWith(Full), Full);
|
||||
EXPECT_EQ(Some.intersectWith(Some), Some);
|
||||
EXPECT_EQ(Some.intersectWith(One), One);
|
||||
EXPECT_EQ(Full.intersectWith(One), One);
|
||||
EXPECT_EQ(Full.intersectWith(Some), Some);
|
||||
EXPECT_EQ(Some.intersectWith(Wrap), Empty);
|
||||
EXPECT_EQ(One.intersectWith(Wrap), Empty);
|
||||
EXPECT_EQ(One.intersectWith(Wrap), Wrap.intersectWith(One));
|
||||
|
||||
// Klee generated testcase from PR4545.
|
||||
// The intersection of i16 [4, 2) and [6, 5) is disjoint, looking like
|
||||
// 01..4.6789ABCDEF where the dots represent values not in the intersection.
|
||||
ConstantRange LHS(APInt(16, 4), APInt(16, 2));
|
||||
ConstantRange RHS(APInt(16, 6), APInt(16, 5));
|
||||
EXPECT_TRUE(LHS.intersectWith(RHS) == LHS);
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, UnionWith) {
|
||||
EXPECT_EQ(Wrap.unionWith(One),
|
||||
ConstantRange(APInt(16, 0xaaa), APInt(16, 0xb)));
|
||||
EXPECT_EQ(One.unionWith(Wrap), Wrap.unionWith(One));
|
||||
EXPECT_EQ(Empty.unionWith(Empty), Empty);
|
||||
EXPECT_EQ(Full.unionWith(Full), Full);
|
||||
EXPECT_EQ(Some.unionWith(Wrap), Full);
|
||||
|
||||
// PR4545
|
||||
EXPECT_EQ(ConstantRange(APInt(16, 14), APInt(16, 1)).unionWith(
|
||||
ConstantRange(APInt(16, 0), APInt(16, 8))),
|
||||
ConstantRange(APInt(16, 14), APInt(16, 8)));
|
||||
EXPECT_EQ(ConstantRange(APInt(16, 6), APInt(16, 4)).unionWith(
|
||||
ConstantRange(APInt(16, 4), APInt(16, 0))),
|
||||
ConstantRange(16));
|
||||
EXPECT_EQ(ConstantRange(APInt(16, 1), APInt(16, 0)).unionWith(
|
||||
ConstantRange(APInt(16, 2), APInt(16, 1))),
|
||||
ConstantRange(16));
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, SubtractAPInt) {
|
||||
EXPECT_EQ(Full.subtract(APInt(16, 4)), Full);
|
||||
EXPECT_EQ(Empty.subtract(APInt(16, 4)), Empty);
|
||||
EXPECT_EQ(Some.subtract(APInt(16, 4)),
|
||||
ConstantRange(APInt(16, 0x6), APInt(16, 0xaa6)));
|
||||
EXPECT_EQ(Wrap.subtract(APInt(16, 4)),
|
||||
ConstantRange(APInt(16, 0xaa6), APInt(16, 0x6)));
|
||||
EXPECT_EQ(One.subtract(APInt(16, 4)),
|
||||
ConstantRange(APInt(16, 0x6)));
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, Add) {
|
||||
EXPECT_EQ(Full.add(APInt(16, 4)), Full);
|
||||
EXPECT_EQ(Full.add(Full), Full);
|
||||
EXPECT_EQ(Full.add(Empty), Empty);
|
||||
EXPECT_EQ(Full.add(One), Full);
|
||||
EXPECT_EQ(Full.add(Some), Full);
|
||||
EXPECT_EQ(Full.add(Wrap), Full);
|
||||
EXPECT_EQ(Empty.add(Empty), Empty);
|
||||
EXPECT_EQ(Empty.add(One), Empty);
|
||||
EXPECT_EQ(Empty.add(Some), Empty);
|
||||
EXPECT_EQ(Empty.add(Wrap), Empty);
|
||||
EXPECT_EQ(Empty.add(APInt(16, 4)), Empty);
|
||||
EXPECT_EQ(Some.add(APInt(16, 4)),
|
||||
ConstantRange(APInt(16, 0xe), APInt(16, 0xaae)));
|
||||
EXPECT_EQ(Wrap.add(APInt(16, 4)),
|
||||
ConstantRange(APInt(16, 0xaae), APInt(16, 0xe)));
|
||||
EXPECT_EQ(One.add(APInt(16, 4)),
|
||||
ConstantRange(APInt(16, 0xe)));
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, Multiply) {
|
||||
EXPECT_EQ(Full.multiply(Full), Full);
|
||||
EXPECT_EQ(Full.multiply(Empty), Empty);
|
||||
EXPECT_EQ(Full.multiply(One), Full);
|
||||
EXPECT_EQ(Full.multiply(Some), Full);
|
||||
EXPECT_EQ(Full.multiply(Wrap), Full);
|
||||
EXPECT_EQ(Empty.multiply(Empty), Empty);
|
||||
EXPECT_EQ(Empty.multiply(One), Empty);
|
||||
EXPECT_EQ(Empty.multiply(Some), Empty);
|
||||
EXPECT_EQ(Empty.multiply(Wrap), Empty);
|
||||
EXPECT_EQ(One.multiply(One), ConstantRange(APInt(16, 0xa*0xa),
|
||||
APInt(16, 0xa*0xa + 1)));
|
||||
EXPECT_EQ(One.multiply(Some), ConstantRange(APInt(16, 0xa*0xa),
|
||||
APInt(16, 0xa*0xaa9 + 1)));
|
||||
EXPECT_EQ(One.multiply(Wrap), Full);
|
||||
EXPECT_EQ(Some.multiply(Some), Full);
|
||||
EXPECT_EQ(Some.multiply(Wrap), Full);
|
||||
EXPECT_EQ(Wrap.multiply(Wrap), Full);
|
||||
|
||||
// http://llvm.org/PR4545
|
||||
EXPECT_EQ(ConstantRange(APInt(4, 1), APInt(4, 6)).multiply(
|
||||
ConstantRange(APInt(4, 6), APInt(4, 2))),
|
||||
ConstantRange(4, /*isFullSet=*/true));
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, UMax) {
|
||||
EXPECT_EQ(Full.umax(Full), Full);
|
||||
EXPECT_EQ(Full.umax(Empty), Empty);
|
||||
EXPECT_EQ(Full.umax(Some), ConstantRange(APInt(16, 0xa), APInt(16, 0)));
|
||||
EXPECT_EQ(Full.umax(Wrap), Full);
|
||||
EXPECT_EQ(Full.umax(Some), ConstantRange(APInt(16, 0xa), APInt(16, 0)));
|
||||
EXPECT_EQ(Empty.umax(Empty), Empty);
|
||||
EXPECT_EQ(Empty.umax(Some), Empty);
|
||||
EXPECT_EQ(Empty.umax(Wrap), Empty);
|
||||
EXPECT_EQ(Empty.umax(One), Empty);
|
||||
EXPECT_EQ(Some.umax(Some), Some);
|
||||
EXPECT_EQ(Some.umax(Wrap), ConstantRange(APInt(16, 0xa), APInt(16, 0)));
|
||||
EXPECT_EQ(Some.umax(One), Some);
|
||||
// TODO: ConstantRange is currently over-conservative here.
|
||||
EXPECT_EQ(Wrap.umax(Wrap), Full);
|
||||
EXPECT_EQ(Wrap.umax(One), ConstantRange(APInt(16, 0xa), APInt(16, 0)));
|
||||
EXPECT_EQ(One.umax(One), One);
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, SMax) {
|
||||
EXPECT_EQ(Full.smax(Full), Full);
|
||||
EXPECT_EQ(Full.smax(Empty), Empty);
|
||||
EXPECT_EQ(Full.smax(Some), ConstantRange(APInt(16, 0xa),
|
||||
APInt::getSignedMinValue(16)));
|
||||
EXPECT_EQ(Full.smax(Wrap), Full);
|
||||
EXPECT_EQ(Full.smax(One), ConstantRange(APInt(16, 0xa),
|
||||
APInt::getSignedMinValue(16)));
|
||||
EXPECT_EQ(Empty.smax(Empty), Empty);
|
||||
EXPECT_EQ(Empty.smax(Some), Empty);
|
||||
EXPECT_EQ(Empty.smax(Wrap), Empty);
|
||||
EXPECT_EQ(Empty.smax(One), Empty);
|
||||
EXPECT_EQ(Some.smax(Some), Some);
|
||||
EXPECT_EQ(Some.smax(Wrap), ConstantRange(APInt(16, 0xa),
|
||||
APInt(16, (uint64_t)INT16_MIN)));
|
||||
EXPECT_EQ(Some.smax(One), Some);
|
||||
EXPECT_EQ(Wrap.smax(One), ConstantRange(APInt(16, 0xa),
|
||||
APInt(16, (uint64_t)INT16_MIN)));
|
||||
EXPECT_EQ(One.smax(One), One);
|
||||
}
|
||||
|
||||
TEST_F(ConstantRangeTest, UDiv) {
|
||||
EXPECT_EQ(Full.udiv(Full), Full);
|
||||
EXPECT_EQ(Full.udiv(Empty), Empty);
|
||||
EXPECT_EQ(Full.udiv(One), ConstantRange(APInt(16, 0),
|
||||
APInt(16, 0xffff / 0xa + 1)));
|
||||
EXPECT_EQ(Full.udiv(Some), ConstantRange(APInt(16, 0),
|
||||
APInt(16, 0xffff / 0xa + 1)));
|
||||
EXPECT_EQ(Full.udiv(Wrap), Full);
|
||||
EXPECT_EQ(Empty.udiv(Empty), Empty);
|
||||
EXPECT_EQ(Empty.udiv(One), Empty);
|
||||
EXPECT_EQ(Empty.udiv(Some), Empty);
|
||||
EXPECT_EQ(Empty.udiv(Wrap), Empty);
|
||||
EXPECT_EQ(One.udiv(One), ConstantRange(APInt(16, 1)));
|
||||
EXPECT_EQ(One.udiv(Some), ConstantRange(APInt(16, 0), APInt(16, 2)));
|
||||
EXPECT_EQ(One.udiv(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xb)));
|
||||
EXPECT_EQ(Some.udiv(Some), ConstantRange(APInt(16, 0), APInt(16, 0x111)));
|
||||
EXPECT_EQ(Some.udiv(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xaaa)));
|
||||
EXPECT_EQ(Wrap.udiv(Wrap), Full);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
@ -1,31 +0,0 @@
|
||||
//===- llvm/unittest/LeakDetector/LeakDetector.cpp - LeakDetector tests ---===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/Support/LeakDetector.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#ifndef NDEBUG
|
||||
TEST(LeakDetector, Death1) {
|
||||
LeakDetector::addGarbageObject((void*) 1);
|
||||
LeakDetector::addGarbageObject((void*) 2);
|
||||
|
||||
EXPECT_DEATH(LeakDetector::addGarbageObject((void*) 1),
|
||||
".*Ts.count\\(o\\) == 0 && \"Object already in set!\"");
|
||||
EXPECT_DEATH(LeakDetector::addGarbageObject((void*) 2),
|
||||
"Cache != o && \"Object already in set!\"");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
##===- unittests/ADT/Makefile ------------------------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ../..
|
||||
TESTNAME = Support
|
||||
LINK_COMPONENTS := core support
|
||||
|
||||
include $(LEVEL)/Makefile.config
|
||||
include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest
|
@ -1,104 +0,0 @@
|
||||
//===- unittests/Support/MathExtrasTest.cpp - math utils tests ------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(MathExtras, isPowerOf2_32) {
|
||||
EXPECT_TRUE(isPowerOf2_32(1 << 6));
|
||||
EXPECT_TRUE(isPowerOf2_32(1 << 12));
|
||||
EXPECT_FALSE(isPowerOf2_32((1 << 19) + 3));
|
||||
EXPECT_FALSE(isPowerOf2_32(0xABCDEF0));
|
||||
}
|
||||
|
||||
TEST(MathExtras, isPowerOf2_64) {
|
||||
EXPECT_TRUE(isPowerOf2_64(1LL << 46));
|
||||
EXPECT_TRUE(isPowerOf2_64(1LL << 12));
|
||||
EXPECT_FALSE(isPowerOf2_64((1LL << 53) + 3));
|
||||
EXPECT_FALSE(isPowerOf2_64(0xABCDEF0ABCDEF0LL));
|
||||
}
|
||||
|
||||
TEST(MathExtras, ByteSwap_32) {
|
||||
EXPECT_EQ(0x44332211u, ByteSwap_32(0x11223344));
|
||||
EXPECT_EQ(0xDDCCBBAAu, ByteSwap_32(0xAABBCCDD));
|
||||
}
|
||||
|
||||
TEST(MathExtras, ByteSwap_64) {
|
||||
EXPECT_EQ(0x8877665544332211ULL, ByteSwap_64(0x1122334455667788LL));
|
||||
EXPECT_EQ(0x1100FFEEDDCCBBAAULL, ByteSwap_64(0xAABBCCDDEEFF0011LL));
|
||||
}
|
||||
|
||||
TEST(MathExtras, CountLeadingZeros_32) {
|
||||
EXPECT_EQ(8u, CountLeadingZeros_32(0x00F000FF));
|
||||
EXPECT_EQ(8u, CountLeadingZeros_32(0x00F12345));
|
||||
for (unsigned i = 0; i <= 30; ++i) {
|
||||
EXPECT_EQ(31 - i, CountLeadingZeros_32(1 << i));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(MathExtras, CountLeadingZeros_64) {
|
||||
EXPECT_EQ(8u, CountLeadingZeros_64(0x00F1234500F12345LL));
|
||||
EXPECT_EQ(1u, CountLeadingZeros_64(1LL << 62));
|
||||
for (unsigned i = 0; i <= 62; ++i) {
|
||||
EXPECT_EQ(63 - i, CountLeadingZeros_64(1LL << i));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(MathExtras, CountLeadingOnes_32) {
|
||||
for (int i = 30; i >= 0; --i) {
|
||||
// Start with all ones and unset some bit.
|
||||
EXPECT_EQ(31u - i, CountLeadingOnes_32(0xFFFFFFFF ^ (1 << i)));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(MathExtras, CountLeadingOnes_64) {
|
||||
for (int i = 62; i >= 0; --i) {
|
||||
// Start with all ones and unset some bit.
|
||||
EXPECT_EQ(63u - i, CountLeadingOnes_64(0xFFFFFFFFFFFFFFFFLL ^ (1LL << i)));
|
||||
}
|
||||
for (int i = 30; i >= 0; --i) {
|
||||
// Start with all ones and unset some bit.
|
||||
EXPECT_EQ(31u - i, CountLeadingOnes_32(0xFFFFFFFF ^ (1 << i)));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(MathExtras, FloatBits) {
|
||||
static const float kValue = 5632.34;
|
||||
EXPECT_FLOAT_EQ(kValue, BitsToFloat(FloatToBits(kValue)));
|
||||
}
|
||||
|
||||
TEST(MathExtras, DoubleBits) {
|
||||
static const double kValue = 87987234.983498;
|
||||
EXPECT_FLOAT_EQ(kValue, BitsToDouble(DoubleToBits(kValue)));
|
||||
}
|
||||
|
||||
TEST(MathExtras, MinAlign) {
|
||||
EXPECT_EQ(1u, MinAlign(2, 3));
|
||||
EXPECT_EQ(2u, MinAlign(2, 4));
|
||||
EXPECT_EQ(1u, MinAlign(17, 64));
|
||||
EXPECT_EQ(256u, MinAlign(256, 512));
|
||||
}
|
||||
|
||||
TEST(MathExtras, NextPowerOf2) {
|
||||
EXPECT_EQ(4u, NextPowerOf2(3));
|
||||
EXPECT_EQ(16u, NextPowerOf2(15));
|
||||
EXPECT_EQ(256u, NextPowerOf2(128));
|
||||
}
|
||||
|
||||
TEST(MathExtras, RoundUpToAlignment) {
|
||||
EXPECT_EQ(8u, RoundUpToAlignment(5, 8));
|
||||
EXPECT_EQ(24u, RoundUpToAlignment(17, 8));
|
||||
EXPECT_EQ(0u, RoundUpToAlignment(~0LL, 8));
|
||||
}
|
||||
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
//===- llvm/unittest/Support/RegexTest.cpp - Regex tests --===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/Support/Regex.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include <cstring>
|
||||
|
||||
using namespace llvm;
|
||||
namespace {
|
||||
|
||||
class RegexTest : public ::testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(RegexTest, Basics) {
|
||||
Regex r1("^[0-9]+$");
|
||||
EXPECT_TRUE(r1.match("916"));
|
||||
EXPECT_TRUE(r1.match("9"));
|
||||
EXPECT_FALSE(r1.match("9a"));
|
||||
|
||||
SmallVector<StringRef, 1> Matches;
|
||||
Regex r2("[0-9]+");
|
||||
EXPECT_TRUE(r2.match("aa216b", &Matches));
|
||||
EXPECT_EQ(1u, Matches.size());
|
||||
EXPECT_EQ("216", Matches[0].str());
|
||||
|
||||
Regex r3("[0-9]+([a-f])?:([0-9]+)");
|
||||
EXPECT_TRUE(r3.match("9a:513b", &Matches));
|
||||
EXPECT_EQ(3u, Matches.size());
|
||||
EXPECT_EQ("9a:513", Matches[0].str());
|
||||
EXPECT_EQ("a", Matches[1].str());
|
||||
EXPECT_EQ("513", Matches[2].str());
|
||||
|
||||
EXPECT_TRUE(r3.match("9:513b", &Matches));
|
||||
EXPECT_EQ(3u, Matches.size());
|
||||
EXPECT_EQ("9:513", Matches[0].str());
|
||||
EXPECT_EQ("", Matches[1].str());
|
||||
EXPECT_EQ("513", Matches[2].str());
|
||||
|
||||
Regex r4("a[^b]+b");
|
||||
std::string String="axxb";
|
||||
String[2] = '\0';
|
||||
EXPECT_FALSE(r4.match("abb"));
|
||||
EXPECT_TRUE(r4.match(String, &Matches));
|
||||
EXPECT_EQ(1u, Matches.size());
|
||||
EXPECT_EQ(String, Matches[0].str());
|
||||
|
||||
|
||||
std::string NulPattern="X[0-9]+X([a-f])?:([0-9]+)";
|
||||
String="YX99a:513b";
|
||||
NulPattern[7] = '\0';
|
||||
Regex r5(NulPattern);
|
||||
EXPECT_FALSE(r5.match(String));
|
||||
EXPECT_FALSE(r5.match("X9"));
|
||||
String[3]='\0';
|
||||
EXPECT_TRUE(r5.match(String));
|
||||
}
|
||||
|
||||
TEST_F(RegexTest, Substitution) {
|
||||
std::string Error;
|
||||
|
||||
EXPECT_EQ("aNUMber", Regex("[0-9]+").sub("NUM", "a1234ber"));
|
||||
|
||||
// Standard Escapes
|
||||
EXPECT_EQ("a\\ber", Regex("[0-9]+").sub("\\\\", "a1234ber", &Error));
|
||||
EXPECT_EQ(Error, "");
|
||||
EXPECT_EQ("a\nber", Regex("[0-9]+").sub("\\n", "a1234ber", &Error));
|
||||
EXPECT_EQ(Error, "");
|
||||
EXPECT_EQ("a\tber", Regex("[0-9]+").sub("\\t", "a1234ber", &Error));
|
||||
EXPECT_EQ(Error, "");
|
||||
EXPECT_EQ("ajber", Regex("[0-9]+").sub("\\j", "a1234ber", &Error));
|
||||
EXPECT_EQ(Error, "");
|
||||
|
||||
EXPECT_EQ("aber", Regex("[0-9]+").sub("\\", "a1234ber", &Error));
|
||||
EXPECT_EQ(Error, "replacement string contained trailing backslash");
|
||||
|
||||
// Backreferences
|
||||
EXPECT_EQ("aa1234bber", Regex("a[0-9]+b").sub("a\\0b", "a1234ber", &Error));
|
||||
EXPECT_EQ(Error, "");
|
||||
|
||||
EXPECT_EQ("a1234ber", Regex("a([0-9]+)b").sub("a\\1b", "a1234ber", &Error));
|
||||
EXPECT_EQ(Error, "");
|
||||
|
||||
EXPECT_EQ("aber", Regex("a[0-9]+b").sub("a\\100b", "a1234ber", &Error));
|
||||
EXPECT_EQ(Error, "invalid backreference string '100'");
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
//===- llvm/unittest/Support/System.cpp - System tests --===//
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/System/TimeValue.h"
|
||||
#include <time.h>
|
||||
|
||||
using namespace llvm;
|
||||
namespace {
|
||||
class SystemTest : public ::testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(SystemTest, TimeValue) {
|
||||
sys::TimeValue now = sys::TimeValue::now();
|
||||
time_t now_t = time(NULL);
|
||||
EXPECT_TRUE(abs(now_t - now.toEpochTime()) < 2);
|
||||
}
|
||||
}
|
@ -1,253 +0,0 @@
|
||||
//===- llvm/unittest/Support/TypeBuilderTest.cpp - TypeBuilder tests -----===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Support/TypeBuilder.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(TypeBuilderTest, Void) {
|
||||
EXPECT_EQ(Type::getVoidTy(getGlobalContext()), (TypeBuilder<void, true>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getVoidTy(getGlobalContext()), (TypeBuilder<void, false>::get(getGlobalContext())));
|
||||
// Special cases for C compatibility:
|
||||
EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()),
|
||||
(TypeBuilder<void*, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()),
|
||||
(TypeBuilder<const void*, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()),
|
||||
(TypeBuilder<volatile void*, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()),
|
||||
(TypeBuilder<const volatile void*, false>::get(
|
||||
getGlobalContext())));
|
||||
}
|
||||
|
||||
TEST(TypeBuilderTest, HostIntegers) {
|
||||
EXPECT_EQ(Type::getInt8Ty(getGlobalContext()), (TypeBuilder<int8_t, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt8Ty(getGlobalContext()), (TypeBuilder<uint8_t, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt16Ty(getGlobalContext()), (TypeBuilder<int16_t, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt16Ty(getGlobalContext()), (TypeBuilder<uint16_t, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt32Ty(getGlobalContext()), (TypeBuilder<int32_t, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt32Ty(getGlobalContext()), (TypeBuilder<uint32_t, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt64Ty(getGlobalContext()), (TypeBuilder<int64_t, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt64Ty(getGlobalContext()), (TypeBuilder<uint64_t, false>::get(getGlobalContext())));
|
||||
|
||||
EXPECT_EQ(IntegerType::get(getGlobalContext(), sizeof(size_t) * CHAR_BIT),
|
||||
(TypeBuilder<size_t, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(IntegerType::get(getGlobalContext(), sizeof(ptrdiff_t) * CHAR_BIT),
|
||||
(TypeBuilder<ptrdiff_t, false>::get(getGlobalContext())));
|
||||
}
|
||||
|
||||
TEST(TypeBuilderTest, CrossCompilableIntegers) {
|
||||
EXPECT_EQ(IntegerType::get(getGlobalContext(), 1), (TypeBuilder<types::i<1>, true>::get(getGlobalContext())));
|
||||
EXPECT_EQ(IntegerType::get(getGlobalContext(), 1), (TypeBuilder<types::i<1>, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(IntegerType::get(getGlobalContext(), 72), (TypeBuilder<types::i<72>, true>::get(getGlobalContext())));
|
||||
EXPECT_EQ(IntegerType::get(getGlobalContext(), 72), (TypeBuilder<types::i<72>, false>::get(getGlobalContext())));
|
||||
}
|
||||
|
||||
TEST(TypeBuilderTest, Float) {
|
||||
EXPECT_EQ(Type::getFloatTy(getGlobalContext()), (TypeBuilder<float, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getDoubleTy(getGlobalContext()), (TypeBuilder<double, false>::get(getGlobalContext())));
|
||||
// long double isn't supported yet.
|
||||
EXPECT_EQ(Type::getFloatTy(getGlobalContext()), (TypeBuilder<types::ieee_float, true>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getFloatTy(getGlobalContext()), (TypeBuilder<types::ieee_float, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getDoubleTy(getGlobalContext()), (TypeBuilder<types::ieee_double, true>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getDoubleTy(getGlobalContext()), (TypeBuilder<types::ieee_double, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getX86_FP80Ty(getGlobalContext()), (TypeBuilder<types::x86_fp80, true>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getX86_FP80Ty(getGlobalContext()), (TypeBuilder<types::x86_fp80, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getFP128Ty(getGlobalContext()), (TypeBuilder<types::fp128, true>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getFP128Ty(getGlobalContext()), (TypeBuilder<types::fp128, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getPPC_FP128Ty(getGlobalContext()), (TypeBuilder<types::ppc_fp128, true>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getPPC_FP128Ty(getGlobalContext()), (TypeBuilder<types::ppc_fp128, false>::get(getGlobalContext())));
|
||||
}
|
||||
|
||||
TEST(TypeBuilderTest, Derived) {
|
||||
EXPECT_EQ(PointerType::getUnqual(Type::getInt8PtrTy(getGlobalContext())),
|
||||
(TypeBuilder<int8_t**, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(ArrayType::get(Type::getInt8Ty(getGlobalContext()), 7),
|
||||
(TypeBuilder<int8_t[7], false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(ArrayType::get(Type::getInt8Ty(getGlobalContext()), 0),
|
||||
(TypeBuilder<int8_t[], false>::get(getGlobalContext())));
|
||||
|
||||
EXPECT_EQ(PointerType::getUnqual(Type::getInt8PtrTy(getGlobalContext())),
|
||||
(TypeBuilder<types::i<8>**, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(ArrayType::get(Type::getInt8Ty(getGlobalContext()), 7),
|
||||
(TypeBuilder<types::i<8>[7], false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(ArrayType::get(Type::getInt8Ty(getGlobalContext()), 0),
|
||||
(TypeBuilder<types::i<8>[], false>::get(getGlobalContext())));
|
||||
|
||||
EXPECT_EQ(PointerType::getUnqual(Type::getInt8PtrTy(getGlobalContext())),
|
||||
(TypeBuilder<types::i<8>**, true>::get(getGlobalContext())));
|
||||
EXPECT_EQ(ArrayType::get(Type::getInt8Ty(getGlobalContext()), 7),
|
||||
(TypeBuilder<types::i<8>[7], true>::get(getGlobalContext())));
|
||||
EXPECT_EQ(ArrayType::get(Type::getInt8Ty(getGlobalContext()), 0),
|
||||
(TypeBuilder<types::i<8>[], true>::get(getGlobalContext())));
|
||||
|
||||
|
||||
EXPECT_EQ(Type::getInt8Ty(getGlobalContext()),
|
||||
(TypeBuilder<const int8_t, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt8Ty(getGlobalContext()),
|
||||
(TypeBuilder<volatile int8_t, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt8Ty(getGlobalContext()),
|
||||
(TypeBuilder<const volatile int8_t, false>::get(getGlobalContext())));
|
||||
|
||||
EXPECT_EQ(Type::getInt8Ty(getGlobalContext()),
|
||||
(TypeBuilder<const types::i<8>, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt8Ty(getGlobalContext()),
|
||||
(TypeBuilder<volatile types::i<8>, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt8Ty(getGlobalContext()),
|
||||
(TypeBuilder<const volatile types::i<8>, false>::get(getGlobalContext())));
|
||||
|
||||
EXPECT_EQ(Type::getInt8Ty(getGlobalContext()),
|
||||
(TypeBuilder<const types::i<8>, true>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt8Ty(getGlobalContext()),
|
||||
(TypeBuilder<volatile types::i<8>, true>::get(getGlobalContext())));
|
||||
EXPECT_EQ(Type::getInt8Ty(getGlobalContext()),
|
||||
(TypeBuilder<const volatile types::i<8>, true>::get(getGlobalContext())));
|
||||
|
||||
EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()),
|
||||
(TypeBuilder<const volatile int8_t*const volatile, false>::get(getGlobalContext())));
|
||||
}
|
||||
|
||||
TEST(TypeBuilderTest, Functions) {
|
||||
std::vector<const Type*> params;
|
||||
EXPECT_EQ(FunctionType::get(Type::getVoidTy(getGlobalContext()), params, false),
|
||||
(TypeBuilder<void(), true>::get(getGlobalContext())));
|
||||
EXPECT_EQ(FunctionType::get(Type::getInt8Ty(getGlobalContext()), params, true),
|
||||
(TypeBuilder<int8_t(...), false>::get(getGlobalContext())));
|
||||
params.push_back(TypeBuilder<int32_t*, false>::get(getGlobalContext()));
|
||||
EXPECT_EQ(FunctionType::get(Type::getInt8Ty(getGlobalContext()), params, false),
|
||||
(TypeBuilder<int8_t(const int32_t*), false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(FunctionType::get(Type::getInt8Ty(getGlobalContext()), params, true),
|
||||
(TypeBuilder<int8_t(const int32_t*, ...), false>::get(getGlobalContext())));
|
||||
params.push_back(TypeBuilder<char*, false>::get(getGlobalContext()));
|
||||
EXPECT_EQ(FunctionType::get(Type::getInt8Ty(getGlobalContext()), params, false),
|
||||
(TypeBuilder<int8_t(int32_t*, void*), false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(FunctionType::get(Type::getInt8Ty(getGlobalContext()), params, true),
|
||||
(TypeBuilder<int8_t(int32_t*, char*, ...), false>::get(getGlobalContext())));
|
||||
params.push_back(TypeBuilder<char, false>::get(getGlobalContext()));
|
||||
EXPECT_EQ(FunctionType::get(Type::getInt8Ty(getGlobalContext()), params, false),
|
||||
(TypeBuilder<int8_t(int32_t*, void*, char), false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(FunctionType::get(Type::getInt8Ty(getGlobalContext()), params, true),
|
||||
(TypeBuilder<int8_t(int32_t*, char*, char, ...), false>::get(getGlobalContext())));
|
||||
params.push_back(TypeBuilder<char, false>::get(getGlobalContext()));
|
||||
EXPECT_EQ(FunctionType::get(Type::getInt8Ty(getGlobalContext()), params, false),
|
||||
(TypeBuilder<int8_t(int32_t*, void*, char, char), false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(FunctionType::get(Type::getInt8Ty(getGlobalContext()), params, true),
|
||||
(TypeBuilder<int8_t(int32_t*, char*, char, char, ...),
|
||||
false>::get(getGlobalContext())));
|
||||
params.push_back(TypeBuilder<char, false>::get(getGlobalContext()));
|
||||
EXPECT_EQ(FunctionType::get(Type::getInt8Ty(getGlobalContext()), params, false),
|
||||
(TypeBuilder<int8_t(int32_t*, void*, char, char, char),
|
||||
false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(FunctionType::get(Type::getInt8Ty(getGlobalContext()), params, true),
|
||||
(TypeBuilder<int8_t(int32_t*, char*, char, char, char, ...),
|
||||
false>::get(getGlobalContext())));
|
||||
}
|
||||
|
||||
TEST(TypeBuilderTest, Context) {
|
||||
// We used to cache TypeBuilder results in static local variables. This
|
||||
// produced the same type for different contexts, which of course broke
|
||||
// things.
|
||||
LLVMContext context1;
|
||||
EXPECT_EQ(&context1,
|
||||
&(TypeBuilder<types::i<1>, true>::get(context1))->getContext());
|
||||
LLVMContext context2;
|
||||
EXPECT_EQ(&context2,
|
||||
&(TypeBuilder<types::i<1>, true>::get(context2))->getContext());
|
||||
}
|
||||
|
||||
class MyType {
|
||||
int a;
|
||||
int *b;
|
||||
void *array[1];
|
||||
};
|
||||
|
||||
class MyPortableType {
|
||||
int32_t a;
|
||||
int32_t *b;
|
||||
void *array[1];
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace llvm {
|
||||
template<bool cross> class TypeBuilder<MyType, cross> {
|
||||
public:
|
||||
static const StructType *get(LLVMContext &Context) {
|
||||
// Using the static result variable ensures that the type is
|
||||
// only looked up once.
|
||||
std::vector<const Type*> st;
|
||||
st.push_back(TypeBuilder<int, cross>::get(Context));
|
||||
st.push_back(TypeBuilder<int*, cross>::get(Context));
|
||||
st.push_back(TypeBuilder<void*[], cross>::get(Context));
|
||||
static const StructType *const result = StructType::get(Context, st);
|
||||
return result;
|
||||
}
|
||||
|
||||
// You may find this a convenient place to put some constants
|
||||
// to help with getelementptr. They don't have any effect on
|
||||
// the operation of TypeBuilder.
|
||||
enum Fields {
|
||||
FIELD_A,
|
||||
FIELD_B,
|
||||
FIELD_ARRAY
|
||||
};
|
||||
};
|
||||
|
||||
template<bool cross> class TypeBuilder<MyPortableType, cross> {
|
||||
public:
|
||||
static const StructType *get(LLVMContext &Context) {
|
||||
// Using the static result variable ensures that the type is
|
||||
// only looked up once.
|
||||
std::vector<const Type*> st;
|
||||
st.push_back(TypeBuilder<types::i<32>, cross>::get(Context));
|
||||
st.push_back(TypeBuilder<types::i<32>*, cross>::get(Context));
|
||||
st.push_back(TypeBuilder<types::i<8>*[], cross>::get(Context));
|
||||
static const StructType *const result = StructType::get(Context, st);
|
||||
return result;
|
||||
}
|
||||
|
||||
// You may find this a convenient place to put some constants
|
||||
// to help with getelementptr. They don't have any effect on
|
||||
// the operation of TypeBuilder.
|
||||
enum Fields {
|
||||
FIELD_A,
|
||||
FIELD_B,
|
||||
FIELD_ARRAY
|
||||
};
|
||||
};
|
||||
} // namespace llvm
|
||||
namespace {
|
||||
|
||||
TEST(TypeBuilderTest, Extensions) {
|
||||
EXPECT_EQ(PointerType::getUnqual(StructType::get(getGlobalContext(),
|
||||
TypeBuilder<int, false>::get(getGlobalContext()),
|
||||
TypeBuilder<int*, false>::get(getGlobalContext()),
|
||||
TypeBuilder<void*[], false>::get(getGlobalContext()),
|
||||
NULL)),
|
||||
(TypeBuilder<MyType*, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(PointerType::getUnqual(StructType::get(getGlobalContext(),
|
||||
TypeBuilder<types::i<32>, false>::get(getGlobalContext()),
|
||||
TypeBuilder<types::i<32>*, false>::get(getGlobalContext()),
|
||||
TypeBuilder<types::i<8>*[], false>::get(getGlobalContext()),
|
||||
NULL)),
|
||||
(TypeBuilder<MyPortableType*, false>::get(getGlobalContext())));
|
||||
EXPECT_EQ(PointerType::getUnqual(StructType::get(getGlobalContext(),
|
||||
TypeBuilder<types::i<32>, false>::get(getGlobalContext()),
|
||||
TypeBuilder<types::i<32>*, false>::get(getGlobalContext()),
|
||||
TypeBuilder<types::i<8>*[], false>::get(getGlobalContext()),
|
||||
NULL)),
|
||||
(TypeBuilder<MyPortableType*, true>::get(getGlobalContext())));
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
@ -1,412 +0,0 @@
|
||||
//===- llvm/unittest/Support/ValueHandleTest.cpp - ValueHandle tests --------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Support/ValueHandle.h"
|
||||
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
class ValueHandle : public testing::Test {
|
||||
protected:
|
||||
Constant *ConstantV;
|
||||
std::auto_ptr<BitCastInst> BitcastV;
|
||||
|
||||
ValueHandle() :
|
||||
ConstantV(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 0)),
|
||||
BitcastV(new BitCastInst(ConstantV, Type::getInt32Ty(getGlobalContext()))) {
|
||||
}
|
||||
};
|
||||
|
||||
class ConcreteCallbackVH : public CallbackVH {
|
||||
public:
|
||||
ConcreteCallbackVH() : CallbackVH() {}
|
||||
ConcreteCallbackVH(Value *V) : CallbackVH(V) {}
|
||||
};
|
||||
|
||||
TEST_F(ValueHandle, WeakVH_BasicOperation) {
|
||||
WeakVH WVH(BitcastV.get());
|
||||
EXPECT_EQ(BitcastV.get(), WVH);
|
||||
WVH = ConstantV;
|
||||
EXPECT_EQ(ConstantV, WVH);
|
||||
|
||||
// Make sure I can call a method on the underlying Value. It
|
||||
// doesn't matter which method.
|
||||
EXPECT_EQ(Type::getInt32Ty(getGlobalContext()), WVH->getType());
|
||||
EXPECT_EQ(Type::getInt32Ty(getGlobalContext()), (*WVH).getType());
|
||||
}
|
||||
|
||||
TEST_F(ValueHandle, WeakVH_Comparisons) {
|
||||
WeakVH BitcastWVH(BitcastV.get());
|
||||
WeakVH ConstantWVH(ConstantV);
|
||||
|
||||
EXPECT_TRUE(BitcastWVH == BitcastWVH);
|
||||
EXPECT_TRUE(BitcastV.get() == BitcastWVH);
|
||||
EXPECT_TRUE(BitcastWVH == BitcastV.get());
|
||||
EXPECT_FALSE(BitcastWVH == ConstantWVH);
|
||||
|
||||
EXPECT_TRUE(BitcastWVH != ConstantWVH);
|
||||
EXPECT_TRUE(BitcastV.get() != ConstantWVH);
|
||||
EXPECT_TRUE(BitcastWVH != ConstantV);
|
||||
EXPECT_FALSE(BitcastWVH != BitcastWVH);
|
||||
|
||||
// Cast to Value* so comparisons work.
|
||||
Value *BV = BitcastV.get();
|
||||
Value *CV = ConstantV;
|
||||
EXPECT_EQ(BV < CV, BitcastWVH < ConstantWVH);
|
||||
EXPECT_EQ(BV <= CV, BitcastWVH <= ConstantWVH);
|
||||
EXPECT_EQ(BV > CV, BitcastWVH > ConstantWVH);
|
||||
EXPECT_EQ(BV >= CV, BitcastWVH >= ConstantWVH);
|
||||
|
||||
EXPECT_EQ(BV < CV, BitcastV.get() < ConstantWVH);
|
||||
EXPECT_EQ(BV <= CV, BitcastV.get() <= ConstantWVH);
|
||||
EXPECT_EQ(BV > CV, BitcastV.get() > ConstantWVH);
|
||||
EXPECT_EQ(BV >= CV, BitcastV.get() >= ConstantWVH);
|
||||
|
||||
EXPECT_EQ(BV < CV, BitcastWVH < ConstantV);
|
||||
EXPECT_EQ(BV <= CV, BitcastWVH <= ConstantV);
|
||||
EXPECT_EQ(BV > CV, BitcastWVH > ConstantV);
|
||||
EXPECT_EQ(BV >= CV, BitcastWVH >= ConstantV);
|
||||
}
|
||||
|
||||
TEST_F(ValueHandle, WeakVH_FollowsRAUW) {
|
||||
WeakVH WVH(BitcastV.get());
|
||||
WeakVH WVH_Copy(WVH);
|
||||
WeakVH WVH_Recreated(BitcastV.get());
|
||||
BitcastV->replaceAllUsesWith(ConstantV);
|
||||
EXPECT_EQ(ConstantV, WVH);
|
||||
EXPECT_EQ(ConstantV, WVH_Copy);
|
||||
EXPECT_EQ(ConstantV, WVH_Recreated);
|
||||
}
|
||||
|
||||
TEST_F(ValueHandle, WeakVH_NullOnDeletion) {
|
||||
WeakVH WVH(BitcastV.get());
|
||||
WeakVH WVH_Copy(WVH);
|
||||
WeakVH WVH_Recreated(BitcastV.get());
|
||||
BitcastV.reset();
|
||||
Value *null_value = NULL;
|
||||
EXPECT_EQ(null_value, WVH);
|
||||
EXPECT_EQ(null_value, WVH_Copy);
|
||||
EXPECT_EQ(null_value, WVH_Recreated);
|
||||
}
|
||||
|
||||
|
||||
TEST_F(ValueHandle, AssertingVH_BasicOperation) {
|
||||
AssertingVH<CastInst> AVH(BitcastV.get());
|
||||
CastInst *implicit_to_exact_type = AVH;
|
||||
implicit_to_exact_type = implicit_to_exact_type; // Avoid warning.
|
||||
|
||||
AssertingVH<Value> GenericAVH(BitcastV.get());
|
||||
EXPECT_EQ(BitcastV.get(), GenericAVH);
|
||||
GenericAVH = ConstantV;
|
||||
EXPECT_EQ(ConstantV, GenericAVH);
|
||||
|
||||
// Make sure I can call a method on the underlying CastInst. It
|
||||
// doesn't matter which method.
|
||||
EXPECT_FALSE(AVH->mayWriteToMemory());
|
||||
EXPECT_FALSE((*AVH).mayWriteToMemory());
|
||||
}
|
||||
|
||||
TEST_F(ValueHandle, AssertingVH_Const) {
|
||||
const CastInst *ConstBitcast = BitcastV.get();
|
||||
AssertingVH<const CastInst> AVH(ConstBitcast);
|
||||
const CastInst *implicit_to_exact_type = AVH;
|
||||
implicit_to_exact_type = implicit_to_exact_type; // Avoid warning.
|
||||
}
|
||||
|
||||
TEST_F(ValueHandle, AssertingVH_Comparisons) {
|
||||
AssertingVH<Value> BitcastAVH(BitcastV.get());
|
||||
AssertingVH<Value> ConstantAVH(ConstantV);
|
||||
|
||||
EXPECT_TRUE(BitcastAVH == BitcastAVH);
|
||||
EXPECT_TRUE(BitcastV.get() == BitcastAVH);
|
||||
EXPECT_TRUE(BitcastAVH == BitcastV.get());
|
||||
EXPECT_FALSE(BitcastAVH == ConstantAVH);
|
||||
|
||||
EXPECT_TRUE(BitcastAVH != ConstantAVH);
|
||||
EXPECT_TRUE(BitcastV.get() != ConstantAVH);
|
||||
EXPECT_TRUE(BitcastAVH != ConstantV);
|
||||
EXPECT_FALSE(BitcastAVH != BitcastAVH);
|
||||
|
||||
// Cast to Value* so comparisons work.
|
||||
Value *BV = BitcastV.get();
|
||||
Value *CV = ConstantV;
|
||||
EXPECT_EQ(BV < CV, BitcastAVH < ConstantAVH);
|
||||
EXPECT_EQ(BV <= CV, BitcastAVH <= ConstantAVH);
|
||||
EXPECT_EQ(BV > CV, BitcastAVH > ConstantAVH);
|
||||
EXPECT_EQ(BV >= CV, BitcastAVH >= ConstantAVH);
|
||||
|
||||
EXPECT_EQ(BV < CV, BitcastV.get() < ConstantAVH);
|
||||
EXPECT_EQ(BV <= CV, BitcastV.get() <= ConstantAVH);
|
||||
EXPECT_EQ(BV > CV, BitcastV.get() > ConstantAVH);
|
||||
EXPECT_EQ(BV >= CV, BitcastV.get() >= ConstantAVH);
|
||||
|
||||
EXPECT_EQ(BV < CV, BitcastAVH < ConstantV);
|
||||
EXPECT_EQ(BV <= CV, BitcastAVH <= ConstantV);
|
||||
EXPECT_EQ(BV > CV, BitcastAVH > ConstantV);
|
||||
EXPECT_EQ(BV >= CV, BitcastAVH >= ConstantV);
|
||||
}
|
||||
|
||||
TEST_F(ValueHandle, AssertingVH_DoesNotFollowRAUW) {
|
||||
AssertingVH<Value> AVH(BitcastV.get());
|
||||
BitcastV->replaceAllUsesWith(ConstantV);
|
||||
EXPECT_EQ(BitcastV.get(), AVH);
|
||||
}
|
||||
|
||||
#ifdef NDEBUG
|
||||
|
||||
TEST_F(ValueHandle, AssertingVH_ReducesToPointer) {
|
||||
EXPECT_EQ(sizeof(CastInst *), sizeof(AssertingVH<CastInst>));
|
||||
}
|
||||
|
||||
#else // !NDEBUG
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
|
||||
TEST_F(ValueHandle, AssertingVH_Asserts) {
|
||||
AssertingVH<Value> AVH(BitcastV.get());
|
||||
EXPECT_DEATH({BitcastV.reset();},
|
||||
"An asserting value handle still pointed to this value!");
|
||||
AssertingVH<Value> Copy(AVH);
|
||||
AVH = NULL;
|
||||
EXPECT_DEATH({BitcastV.reset();},
|
||||
"An asserting value handle still pointed to this value!");
|
||||
Copy = NULL;
|
||||
BitcastV.reset();
|
||||
}
|
||||
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
|
||||
#endif // NDEBUG
|
||||
|
||||
TEST_F(ValueHandle, CallbackVH_BasicOperation) {
|
||||
ConcreteCallbackVH CVH(BitcastV.get());
|
||||
EXPECT_EQ(BitcastV.get(), CVH);
|
||||
CVH = ConstantV;
|
||||
EXPECT_EQ(ConstantV, CVH);
|
||||
|
||||
// Make sure I can call a method on the underlying Value. It
|
||||
// doesn't matter which method.
|
||||
EXPECT_EQ(Type::getInt32Ty(getGlobalContext()), CVH->getType());
|
||||
EXPECT_EQ(Type::getInt32Ty(getGlobalContext()), (*CVH).getType());
|
||||
}
|
||||
|
||||
TEST_F(ValueHandle, CallbackVH_Comparisons) {
|
||||
ConcreteCallbackVH BitcastCVH(BitcastV.get());
|
||||
ConcreteCallbackVH ConstantCVH(ConstantV);
|
||||
|
||||
EXPECT_TRUE(BitcastCVH == BitcastCVH);
|
||||
EXPECT_TRUE(BitcastV.get() == BitcastCVH);
|
||||
EXPECT_TRUE(BitcastCVH == BitcastV.get());
|
||||
EXPECT_FALSE(BitcastCVH == ConstantCVH);
|
||||
|
||||
EXPECT_TRUE(BitcastCVH != ConstantCVH);
|
||||
EXPECT_TRUE(BitcastV.get() != ConstantCVH);
|
||||
EXPECT_TRUE(BitcastCVH != ConstantV);
|
||||
EXPECT_FALSE(BitcastCVH != BitcastCVH);
|
||||
|
||||
// Cast to Value* so comparisons work.
|
||||
Value *BV = BitcastV.get();
|
||||
Value *CV = ConstantV;
|
||||
EXPECT_EQ(BV < CV, BitcastCVH < ConstantCVH);
|
||||
EXPECT_EQ(BV <= CV, BitcastCVH <= ConstantCVH);
|
||||
EXPECT_EQ(BV > CV, BitcastCVH > ConstantCVH);
|
||||
EXPECT_EQ(BV >= CV, BitcastCVH >= ConstantCVH);
|
||||
|
||||
EXPECT_EQ(BV < CV, BitcastV.get() < ConstantCVH);
|
||||
EXPECT_EQ(BV <= CV, BitcastV.get() <= ConstantCVH);
|
||||
EXPECT_EQ(BV > CV, BitcastV.get() > ConstantCVH);
|
||||
EXPECT_EQ(BV >= CV, BitcastV.get() >= ConstantCVH);
|
||||
|
||||
EXPECT_EQ(BV < CV, BitcastCVH < ConstantV);
|
||||
EXPECT_EQ(BV <= CV, BitcastCVH <= ConstantV);
|
||||
EXPECT_EQ(BV > CV, BitcastCVH > ConstantV);
|
||||
EXPECT_EQ(BV >= CV, BitcastCVH >= ConstantV);
|
||||
}
|
||||
|
||||
TEST_F(ValueHandle, CallbackVH_CallbackOnDeletion) {
|
||||
class RecordingVH : public CallbackVH {
|
||||
public:
|
||||
int DeletedCalls;
|
||||
int AURWCalls;
|
||||
|
||||
RecordingVH() : DeletedCalls(0), AURWCalls(0) {}
|
||||
RecordingVH(Value *V) : CallbackVH(V), DeletedCalls(0), AURWCalls(0) {}
|
||||
|
||||
private:
|
||||
virtual void deleted() { DeletedCalls++; CallbackVH::deleted(); }
|
||||
virtual void allUsesReplacedWith(Value *) { AURWCalls++; }
|
||||
};
|
||||
|
||||
RecordingVH RVH;
|
||||
RVH = BitcastV.get();
|
||||
EXPECT_EQ(0, RVH.DeletedCalls);
|
||||
EXPECT_EQ(0, RVH.AURWCalls);
|
||||
BitcastV.reset();
|
||||
EXPECT_EQ(1, RVH.DeletedCalls);
|
||||
EXPECT_EQ(0, RVH.AURWCalls);
|
||||
}
|
||||
|
||||
TEST_F(ValueHandle, CallbackVH_CallbackOnRAUW) {
|
||||
class RecordingVH : public CallbackVH {
|
||||
public:
|
||||
int DeletedCalls;
|
||||
Value *AURWArgument;
|
||||
|
||||
RecordingVH() : DeletedCalls(0), AURWArgument(NULL) {}
|
||||
RecordingVH(Value *V)
|
||||
: CallbackVH(V), DeletedCalls(0), AURWArgument(NULL) {}
|
||||
|
||||
private:
|
||||
virtual void deleted() { DeletedCalls++; CallbackVH::deleted(); }
|
||||
virtual void allUsesReplacedWith(Value *new_value) {
|
||||
EXPECT_EQ(NULL, AURWArgument);
|
||||
AURWArgument = new_value;
|
||||
}
|
||||
};
|
||||
|
||||
RecordingVH RVH;
|
||||
RVH = BitcastV.get();
|
||||
EXPECT_EQ(0, RVH.DeletedCalls);
|
||||
EXPECT_EQ(NULL, RVH.AURWArgument);
|
||||
BitcastV->replaceAllUsesWith(ConstantV);
|
||||
EXPECT_EQ(0, RVH.DeletedCalls);
|
||||
EXPECT_EQ(ConstantV, RVH.AURWArgument);
|
||||
}
|
||||
|
||||
TEST_F(ValueHandle, CallbackVH_DeletionCanRAUW) {
|
||||
class RecoveringVH : public CallbackVH {
|
||||
public:
|
||||
int DeletedCalls;
|
||||
Value *AURWArgument;
|
||||
LLVMContext *Context;
|
||||
|
||||
RecoveringVH() : DeletedCalls(0), AURWArgument(NULL),
|
||||
Context(&getGlobalContext()) {}
|
||||
RecoveringVH(Value *V)
|
||||
: CallbackVH(V), DeletedCalls(0), AURWArgument(NULL),
|
||||
Context(&getGlobalContext()) {}
|
||||
|
||||
private:
|
||||
virtual void deleted() {
|
||||
getValPtr()->replaceAllUsesWith(Constant::getNullValue(Type::getInt32Ty(getGlobalContext())));
|
||||
setValPtr(NULL);
|
||||
}
|
||||
virtual void allUsesReplacedWith(Value *new_value) {
|
||||
ASSERT_TRUE(NULL != getValPtr());
|
||||
EXPECT_EQ(1U, getValPtr()->getNumUses());
|
||||
EXPECT_EQ(NULL, AURWArgument);
|
||||
AURWArgument = new_value;
|
||||
}
|
||||
};
|
||||
|
||||
// Normally, if a value has uses, deleting it will crash. However, we can use
|
||||
// a CallbackVH to remove the uses before the check for no uses.
|
||||
RecoveringVH RVH;
|
||||
RVH = BitcastV.get();
|
||||
std::auto_ptr<BinaryOperator> BitcastUser(
|
||||
BinaryOperator::CreateAdd(RVH,
|
||||
Constant::getNullValue(Type::getInt32Ty(getGlobalContext()))));
|
||||
EXPECT_EQ(BitcastV.get(), BitcastUser->getOperand(0));
|
||||
BitcastV.reset(); // Would crash without the ValueHandler.
|
||||
EXPECT_EQ(Constant::getNullValue(Type::getInt32Ty(getGlobalContext())), RVH.AURWArgument);
|
||||
EXPECT_EQ(Constant::getNullValue(Type::getInt32Ty(getGlobalContext())),
|
||||
BitcastUser->getOperand(0));
|
||||
}
|
||||
|
||||
TEST_F(ValueHandle, DestroyingOtherVHOnSameValueDoesntBreakIteration) {
|
||||
// When a CallbackVH modifies other ValueHandles in its callbacks,
|
||||
// that shouldn't interfere with non-modified ValueHandles receiving
|
||||
// their appropriate callbacks.
|
||||
//
|
||||
// We create the active CallbackVH in the middle of a palindromic
|
||||
// arrangement of other VHs so that the bad behavior would be
|
||||
// triggered in whichever order callbacks run.
|
||||
|
||||
class DestroyingVH : public CallbackVH {
|
||||
public:
|
||||
OwningPtr<WeakVH> ToClear[2];
|
||||
DestroyingVH(Value *V) {
|
||||
ToClear[0].reset(new WeakVH(V));
|
||||
setValPtr(V);
|
||||
ToClear[1].reset(new WeakVH(V));
|
||||
}
|
||||
virtual void deleted() {
|
||||
ToClear[0].reset();
|
||||
ToClear[1].reset();
|
||||
CallbackVH::deleted();
|
||||
}
|
||||
virtual void allUsesReplacedWith(Value *) {
|
||||
ToClear[0].reset();
|
||||
ToClear[1].reset();
|
||||
}
|
||||
};
|
||||
|
||||
{
|
||||
WeakVH ShouldBeVisited1(BitcastV.get());
|
||||
DestroyingVH C(BitcastV.get());
|
||||
WeakVH ShouldBeVisited2(BitcastV.get());
|
||||
|
||||
BitcastV->replaceAllUsesWith(ConstantV);
|
||||
EXPECT_EQ(ConstantV, static_cast<Value*>(ShouldBeVisited1));
|
||||
EXPECT_EQ(ConstantV, static_cast<Value*>(ShouldBeVisited2));
|
||||
}
|
||||
|
||||
{
|
||||
WeakVH ShouldBeVisited1(BitcastV.get());
|
||||
DestroyingVH C(BitcastV.get());
|
||||
WeakVH ShouldBeVisited2(BitcastV.get());
|
||||
|
||||
BitcastV.reset();
|
||||
EXPECT_EQ(NULL, static_cast<Value*>(ShouldBeVisited1));
|
||||
EXPECT_EQ(NULL, static_cast<Value*>(ShouldBeVisited2));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ValueHandle, AssertingVHCheckedLast) {
|
||||
// If a CallbackVH exists to clear out a group of AssertingVHs on
|
||||
// Value deletion, the CallbackVH should get a chance to do so
|
||||
// before the AssertingVHs assert.
|
||||
|
||||
class ClearingVH : public CallbackVH {
|
||||
public:
|
||||
AssertingVH<Value> *ToClear[2];
|
||||
ClearingVH(Value *V,
|
||||
AssertingVH<Value> &A0, AssertingVH<Value> &A1)
|
||||
: CallbackVH(V) {
|
||||
ToClear[0] = &A0;
|
||||
ToClear[1] = &A1;
|
||||
}
|
||||
|
||||
virtual void deleted() {
|
||||
*ToClear[0] = 0;
|
||||
*ToClear[1] = 0;
|
||||
CallbackVH::deleted();
|
||||
}
|
||||
};
|
||||
|
||||
AssertingVH<Value> A1, A2;
|
||||
A1 = BitcastV.get();
|
||||
ClearingVH C(BitcastV.get(), A1, A2);
|
||||
A2 = BitcastV.get();
|
||||
// C.deleted() should run first, clearing the two AssertingVHs,
|
||||
// which should prevent them from asserting.
|
||||
BitcastV.reset();
|
||||
}
|
||||
|
||||
}
|
@ -1,146 +0,0 @@
|
||||
//===- llvm/unittest/Support/raw_ostream_test.cpp - raw_ostream tests -----===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/Support/Format.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
template<typename T> std::string printToString(const T &Value) {
|
||||
std::string res;
|
||||
llvm::raw_string_ostream(res) << Value;
|
||||
return res;
|
||||
}
|
||||
|
||||
/// printToString - Print the given value to a stream which only has \arg
|
||||
/// BytesLeftInBuffer bytes left in the buffer. This is useful for testing edge
|
||||
/// cases in the buffer handling logic.
|
||||
template<typename T> std::string printToString(const T &Value,
|
||||
unsigned BytesLeftInBuffer) {
|
||||
// FIXME: This is relying on internal knowledge of how raw_ostream works to
|
||||
// get the buffer position right.
|
||||
SmallString<256> SVec;
|
||||
assert(BytesLeftInBuffer < 256 && "Invalid buffer count!");
|
||||
llvm::raw_svector_ostream OS(SVec);
|
||||
unsigned StartIndex = 256 - BytesLeftInBuffer;
|
||||
for (unsigned i = 0; i != StartIndex; ++i)
|
||||
OS << '?';
|
||||
OS << Value;
|
||||
return OS.str().substr(StartIndex);
|
||||
}
|
||||
|
||||
template<typename T> std::string printToStringUnbuffered(const T &Value) {
|
||||
std::string res;
|
||||
llvm::raw_string_ostream OS(res);
|
||||
OS.SetUnbuffered();
|
||||
OS << Value;
|
||||
return res;
|
||||
}
|
||||
|
||||
TEST(raw_ostreamTest, Types_Buffered) {
|
||||
// Char
|
||||
EXPECT_EQ("c", printToString('c'));
|
||||
|
||||
// String
|
||||
EXPECT_EQ("hello", printToString("hello"));
|
||||
EXPECT_EQ("hello", printToString(std::string("hello")));
|
||||
|
||||
// Int
|
||||
EXPECT_EQ("0", printToString(0));
|
||||
EXPECT_EQ("2425", printToString(2425));
|
||||
EXPECT_EQ("-2425", printToString(-2425));
|
||||
|
||||
// Long long
|
||||
EXPECT_EQ("0", printToString(0LL));
|
||||
EXPECT_EQ("257257257235709", printToString(257257257235709LL));
|
||||
EXPECT_EQ("-257257257235709", printToString(-257257257235709LL));
|
||||
|
||||
// Double
|
||||
EXPECT_EQ("1.100000e+00", printToString(1.1));
|
||||
|
||||
// void*
|
||||
EXPECT_EQ("0x0", printToString((void*) 0));
|
||||
EXPECT_EQ("0xbeef", printToString((void*) 0xbeef));
|
||||
EXPECT_EQ("0xdeadbeef", printToString((void*) 0xdeadbeef));
|
||||
|
||||
// Min and max.
|
||||
EXPECT_EQ("18446744073709551615", printToString(UINT64_MAX));
|
||||
EXPECT_EQ("-9223372036854775808", printToString(INT64_MIN));
|
||||
}
|
||||
|
||||
TEST(raw_ostreamTest, Types_Unbuffered) {
|
||||
// Char
|
||||
EXPECT_EQ("c", printToStringUnbuffered('c'));
|
||||
|
||||
// String
|
||||
EXPECT_EQ("hello", printToStringUnbuffered("hello"));
|
||||
EXPECT_EQ("hello", printToStringUnbuffered(std::string("hello")));
|
||||
|
||||
// Int
|
||||
EXPECT_EQ("0", printToStringUnbuffered(0));
|
||||
EXPECT_EQ("2425", printToStringUnbuffered(2425));
|
||||
EXPECT_EQ("-2425", printToStringUnbuffered(-2425));
|
||||
|
||||
// Long long
|
||||
EXPECT_EQ("0", printToStringUnbuffered(0LL));
|
||||
EXPECT_EQ("257257257235709", printToStringUnbuffered(257257257235709LL));
|
||||
EXPECT_EQ("-257257257235709", printToStringUnbuffered(-257257257235709LL));
|
||||
|
||||
// Double
|
||||
EXPECT_EQ("1.100000e+00", printToStringUnbuffered(1.1));
|
||||
|
||||
// void*
|
||||
EXPECT_EQ("0x0", printToStringUnbuffered((void*) 0));
|
||||
EXPECT_EQ("0xbeef", printToStringUnbuffered((void*) 0xbeef));
|
||||
EXPECT_EQ("0xdeadbeef", printToStringUnbuffered((void*) 0xdeadbeef));
|
||||
|
||||
// Min and max.
|
||||
EXPECT_EQ("18446744073709551615", printToStringUnbuffered(UINT64_MAX));
|
||||
EXPECT_EQ("-9223372036854775808", printToStringUnbuffered(INT64_MIN));
|
||||
}
|
||||
|
||||
TEST(raw_ostreamTest, BufferEdge) {
|
||||
EXPECT_EQ("1.20", printToString(format("%.2f", 1.2), 1));
|
||||
EXPECT_EQ("1.20", printToString(format("%.2f", 1.2), 2));
|
||||
EXPECT_EQ("1.20", printToString(format("%.2f", 1.2), 3));
|
||||
EXPECT_EQ("1.20", printToString(format("%.2f", 1.2), 4));
|
||||
EXPECT_EQ("1.20", printToString(format("%.2f", 1.2), 10));
|
||||
}
|
||||
|
||||
TEST(raw_ostreamTest, TinyBuffer) {
|
||||
std::string Str;
|
||||
raw_string_ostream OS(Str);
|
||||
OS.SetBufferSize(1);
|
||||
OS << "hello";
|
||||
OS << 1;
|
||||
OS << 'w' << 'o' << 'r' << 'l' << 'd';
|
||||
EXPECT_EQ("hello1world", OS.str());
|
||||
}
|
||||
|
||||
TEST(raw_ostreamTest, WriteEscaped) {
|
||||
std::string Str;
|
||||
|
||||
Str = "";
|
||||
raw_string_ostream(Str).write_escaped("hi");
|
||||
EXPECT_EQ("hi", Str);
|
||||
|
||||
Str = "";
|
||||
raw_string_ostream(Str).write_escaped("\\\t\n\"");
|
||||
EXPECT_EQ("\\\\\\t\\n\\\"", Str);
|
||||
|
||||
Str = "";
|
||||
raw_string_ostream(Str).write_escaped("\1\10\200");
|
||||
EXPECT_EQ("\\001\\010\\200", Str);
|
||||
}
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
##===- unittests/Transforms/Makefile -----------------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ../..
|
||||
|
||||
PARALLEL_DIRS = Utils
|
||||
|
||||
include $(LEVEL)/Makefile.common
|
||||
|
||||
clean::
|
||||
$(Verb) $(RM) -f *Tests
|
@ -1,141 +0,0 @@
|
||||
//===- Cloning.cpp - Unit tests for the Cloner ----------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/Argument.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
class CloneInstruction : public ::testing::Test {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
V = NULL;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T *clone(T *V1) {
|
||||
Value *V2 = V1->clone();
|
||||
Orig.insert(V1);
|
||||
Clones.insert(V2);
|
||||
return cast<T>(V2);
|
||||
}
|
||||
|
||||
void eraseClones() {
|
||||
DeleteContainerPointers(Clones);
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
eraseClones();
|
||||
DeleteContainerPointers(Orig);
|
||||
delete V;
|
||||
}
|
||||
|
||||
SmallPtrSet<Value *, 4> Orig; // Erase on exit
|
||||
SmallPtrSet<Value *, 4> Clones; // Erase in eraseClones
|
||||
|
||||
LLVMContext context;
|
||||
Value *V;
|
||||
};
|
||||
|
||||
TEST_F(CloneInstruction, OverflowBits) {
|
||||
V = new Argument(Type::getInt32Ty(context));
|
||||
|
||||
BinaryOperator *Add = BinaryOperator::Create(Instruction::Add, V, V);
|
||||
BinaryOperator *Sub = BinaryOperator::Create(Instruction::Sub, V, V);
|
||||
BinaryOperator *Mul = BinaryOperator::Create(Instruction::Mul, V, V);
|
||||
|
||||
BinaryOperator *AddClone = this->clone(Add);
|
||||
BinaryOperator *SubClone = this->clone(Sub);
|
||||
BinaryOperator *MulClone = this->clone(Mul);
|
||||
|
||||
EXPECT_FALSE(AddClone->hasNoUnsignedWrap());
|
||||
EXPECT_FALSE(AddClone->hasNoSignedWrap());
|
||||
EXPECT_FALSE(SubClone->hasNoUnsignedWrap());
|
||||
EXPECT_FALSE(SubClone->hasNoSignedWrap());
|
||||
EXPECT_FALSE(MulClone->hasNoUnsignedWrap());
|
||||
EXPECT_FALSE(MulClone->hasNoSignedWrap());
|
||||
|
||||
eraseClones();
|
||||
|
||||
Add->setHasNoUnsignedWrap();
|
||||
Sub->setHasNoUnsignedWrap();
|
||||
Mul->setHasNoUnsignedWrap();
|
||||
|
||||
AddClone = this->clone(Add);
|
||||
SubClone = this->clone(Sub);
|
||||
MulClone = this->clone(Mul);
|
||||
|
||||
EXPECT_TRUE(AddClone->hasNoUnsignedWrap());
|
||||
EXPECT_FALSE(AddClone->hasNoSignedWrap());
|
||||
EXPECT_TRUE(SubClone->hasNoUnsignedWrap());
|
||||
EXPECT_FALSE(SubClone->hasNoSignedWrap());
|
||||
EXPECT_TRUE(MulClone->hasNoUnsignedWrap());
|
||||
EXPECT_FALSE(MulClone->hasNoSignedWrap());
|
||||
|
||||
eraseClones();
|
||||
|
||||
Add->setHasNoSignedWrap();
|
||||
Sub->setHasNoSignedWrap();
|
||||
Mul->setHasNoSignedWrap();
|
||||
|
||||
AddClone = this->clone(Add);
|
||||
SubClone = this->clone(Sub);
|
||||
MulClone = this->clone(Mul);
|
||||
|
||||
EXPECT_TRUE(AddClone->hasNoUnsignedWrap());
|
||||
EXPECT_TRUE(AddClone->hasNoSignedWrap());
|
||||
EXPECT_TRUE(SubClone->hasNoUnsignedWrap());
|
||||
EXPECT_TRUE(SubClone->hasNoSignedWrap());
|
||||
EXPECT_TRUE(MulClone->hasNoUnsignedWrap());
|
||||
EXPECT_TRUE(MulClone->hasNoSignedWrap());
|
||||
|
||||
eraseClones();
|
||||
|
||||
Add->setHasNoUnsignedWrap(false);
|
||||
Sub->setHasNoUnsignedWrap(false);
|
||||
Mul->setHasNoUnsignedWrap(false);
|
||||
|
||||
AddClone = this->clone(Add);
|
||||
SubClone = this->clone(Sub);
|
||||
MulClone = this->clone(Mul);
|
||||
|
||||
EXPECT_FALSE(AddClone->hasNoUnsignedWrap());
|
||||
EXPECT_TRUE(AddClone->hasNoSignedWrap());
|
||||
EXPECT_FALSE(SubClone->hasNoUnsignedWrap());
|
||||
EXPECT_TRUE(SubClone->hasNoSignedWrap());
|
||||
EXPECT_FALSE(MulClone->hasNoUnsignedWrap());
|
||||
EXPECT_TRUE(MulClone->hasNoSignedWrap());
|
||||
}
|
||||
|
||||
TEST_F(CloneInstruction, Inbounds) {
|
||||
V = new Argument(Type::getInt32PtrTy(context));
|
||||
|
||||
Constant *Z = Constant::getNullValue(Type::getInt32Ty(context));
|
||||
std::vector<Value *> ops;
|
||||
ops.push_back(Z);
|
||||
GetElementPtrInst *GEP = GetElementPtrInst::Create(V, ops.begin(), ops.end());
|
||||
EXPECT_FALSE(this->clone(GEP)->isInBounds());
|
||||
|
||||
GEP->setIsInBounds();
|
||||
EXPECT_TRUE(this->clone(GEP)->isInBounds());
|
||||
}
|
||||
|
||||
TEST_F(CloneInstruction, Exact) {
|
||||
V = new Argument(Type::getInt32Ty(context));
|
||||
|
||||
BinaryOperator *SDiv = BinaryOperator::Create(Instruction::SDiv, V, V);
|
||||
EXPECT_FALSE(this->clone(SDiv)->isExact());
|
||||
|
||||
SDiv->setIsExact(true);
|
||||
EXPECT_TRUE(this->clone(SDiv)->isExact());
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
##===- unittests/Transforms/Utils/Makefile -----------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ../../..
|
||||
TESTNAME = Utils
|
||||
LINK_COMPONENTS := core support transformutils
|
||||
|
||||
include $(LEVEL)/Makefile.config
|
||||
include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest
|
@ -1,113 +0,0 @@
|
||||
//===- llvm/unittest/VMCore/ConstantsTest.cpp - Constants unit tests ------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace {
|
||||
|
||||
TEST(ConstantsTest, Integer_i1) {
|
||||
const IntegerType* Int1 = IntegerType::get(getGlobalContext(), 1);
|
||||
Constant* One = ConstantInt::get(Int1, 1, true);
|
||||
Constant* Zero = ConstantInt::get(Int1, 0);
|
||||
Constant* NegOne = ConstantInt::get(Int1, static_cast<uint64_t>(-1), true);
|
||||
EXPECT_EQ(NegOne, ConstantInt::getSigned(Int1, -1));
|
||||
Constant* Undef = UndefValue::get(Int1);
|
||||
|
||||
// Input: @b = constant i1 add(i1 1 , i1 1)
|
||||
// Output: @b = constant i1 false
|
||||
EXPECT_EQ(Zero, ConstantExpr::getAdd(One, One));
|
||||
|
||||
// @c = constant i1 add(i1 -1, i1 1)
|
||||
// @c = constant i1 false
|
||||
EXPECT_EQ(Zero, ConstantExpr::getAdd(NegOne, One));
|
||||
|
||||
// @d = constant i1 add(i1 -1, i1 -1)
|
||||
// @d = constant i1 false
|
||||
EXPECT_EQ(Zero, ConstantExpr::getAdd(NegOne, NegOne));
|
||||
|
||||
// @e = constant i1 sub(i1 -1, i1 1)
|
||||
// @e = constant i1 false
|
||||
EXPECT_EQ(Zero, ConstantExpr::getSub(NegOne, One));
|
||||
|
||||
// @f = constant i1 sub(i1 1 , i1 -1)
|
||||
// @f = constant i1 false
|
||||
EXPECT_EQ(Zero, ConstantExpr::getSub(One, NegOne));
|
||||
|
||||
// @g = constant i1 sub(i1 1 , i1 1)
|
||||
// @g = constant i1 false
|
||||
EXPECT_EQ(Zero, ConstantExpr::getSub(One, One));
|
||||
|
||||
// @h = constant i1 shl(i1 1 , i1 1) ; undefined
|
||||
// @h = constant i1 undef
|
||||
EXPECT_EQ(Undef, ConstantExpr::getShl(One, One));
|
||||
|
||||
// @i = constant i1 shl(i1 1 , i1 0)
|
||||
// @i = constant i1 true
|
||||
EXPECT_EQ(One, ConstantExpr::getShl(One, Zero));
|
||||
|
||||
// @j = constant i1 lshr(i1 1, i1 1) ; undefined
|
||||
// @j = constant i1 undef
|
||||
EXPECT_EQ(Undef, ConstantExpr::getLShr(One, One));
|
||||
|
||||
// @m = constant i1 ashr(i1 1, i1 1) ; undefined
|
||||
// @m = constant i1 undef
|
||||
EXPECT_EQ(Undef, ConstantExpr::getAShr(One, One));
|
||||
|
||||
// @n = constant i1 mul(i1 -1, i1 1)
|
||||
// @n = constant i1 true
|
||||
EXPECT_EQ(One, ConstantExpr::getMul(NegOne, One));
|
||||
|
||||
// @o = constant i1 sdiv(i1 -1, i1 1) ; overflow
|
||||
// @o = constant i1 true
|
||||
EXPECT_EQ(One, ConstantExpr::getSDiv(NegOne, One));
|
||||
|
||||
// @p = constant i1 sdiv(i1 1 , i1 -1); overflow
|
||||
// @p = constant i1 true
|
||||
EXPECT_EQ(One, ConstantExpr::getSDiv(One, NegOne));
|
||||
|
||||
// @q = constant i1 udiv(i1 -1, i1 1)
|
||||
// @q = constant i1 true
|
||||
EXPECT_EQ(One, ConstantExpr::getUDiv(NegOne, One));
|
||||
|
||||
// @r = constant i1 udiv(i1 1, i1 -1)
|
||||
// @r = constant i1 true
|
||||
EXPECT_EQ(One, ConstantExpr::getUDiv(One, NegOne));
|
||||
|
||||
// @s = constant i1 srem(i1 -1, i1 1) ; overflow
|
||||
// @s = constant i1 false
|
||||
EXPECT_EQ(Zero, ConstantExpr::getSRem(NegOne, One));
|
||||
|
||||
// @t = constant i1 urem(i1 -1, i1 1)
|
||||
// @t = constant i1 false
|
||||
EXPECT_EQ(Zero, ConstantExpr::getURem(NegOne, One));
|
||||
|
||||
// @u = constant i1 srem(i1 1, i1 -1) ; overflow
|
||||
// @u = constant i1 false
|
||||
EXPECT_EQ(Zero, ConstantExpr::getSRem(One, NegOne));
|
||||
}
|
||||
|
||||
TEST(ConstantsTest, IntSigns) {
|
||||
const IntegerType* Int8Ty = Type::getInt8Ty(getGlobalContext());
|
||||
EXPECT_EQ(100, ConstantInt::get(Int8Ty, 100, false)->getSExtValue());
|
||||
EXPECT_EQ(100, ConstantInt::get(Int8Ty, 100, true)->getSExtValue());
|
||||
EXPECT_EQ(100, ConstantInt::getSigned(Int8Ty, 100)->getSExtValue());
|
||||
EXPECT_EQ(-50, ConstantInt::get(Int8Ty, 206)->getSExtValue());
|
||||
EXPECT_EQ(-50, ConstantInt::getSigned(Int8Ty, -50)->getSExtValue());
|
||||
EXPECT_EQ(206U, ConstantInt::getSigned(Int8Ty, -50)->getZExtValue());
|
||||
|
||||
// Overflow is handled by truncation.
|
||||
EXPECT_EQ(0x3b, ConstantInt::get(Int8Ty, 0x13b)->getSExtValue());
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
} // end namespace llvm
|
@ -1,33 +0,0 @@
|
||||
//===- llvm/unittest/VMCore/DerivedTypesTest.cpp - Types unit tests -------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "../lib/VMCore/LLVMContextImpl.h"
|
||||
#include "llvm/Type.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(OpaqueTypeTest, RegisterWithContext) {
|
||||
LLVMContext C;
|
||||
LLVMContextImpl *pImpl = C.pImpl;
|
||||
|
||||
// 1 refers to the AlwaysOpaqueTy allocated in the Context's constructor and
|
||||
// destroyed in the destructor.
|
||||
EXPECT_EQ(1u, pImpl->OpaqueTypes.size());
|
||||
{
|
||||
PATypeHolder Type = OpaqueType::get(C);
|
||||
EXPECT_EQ(2u, pImpl->OpaqueTypes.size());
|
||||
}
|
||||
EXPECT_EQ(1u, pImpl->OpaqueTypes.size());
|
||||
}
|
||||
|
||||
} // namespace
|
@ -1,128 +0,0 @@
|
||||
//===- llvm/unittest/VMCore/InstructionsTest.cpp - Instructions unit tests ===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/BasicBlock.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace {
|
||||
|
||||
TEST(InstructionsTest, ReturnInst) {
|
||||
LLVMContext &C(getGlobalContext());
|
||||
|
||||
// test for PR6589
|
||||
const ReturnInst* r0 = ReturnInst::Create(C);
|
||||
EXPECT_EQ(r0->getNumOperands(), 0U);
|
||||
EXPECT_EQ(r0->op_begin(), r0->op_end());
|
||||
|
||||
const IntegerType* Int1 = IntegerType::get(C, 1);
|
||||
Constant* One = ConstantInt::get(Int1, 1, true);
|
||||
const ReturnInst* r1 = ReturnInst::Create(C, One);
|
||||
EXPECT_EQ(r1->getNumOperands(), 1U);
|
||||
User::const_op_iterator b(r1->op_begin());
|
||||
EXPECT_NE(b, r1->op_end());
|
||||
EXPECT_EQ(*b, One);
|
||||
EXPECT_EQ(r1->getOperand(0), One);
|
||||
++b;
|
||||
EXPECT_EQ(b, r1->op_end());
|
||||
|
||||
// clean up
|
||||
delete r0;
|
||||
delete r1;
|
||||
}
|
||||
|
||||
TEST(InstructionsTest, BranchInst) {
|
||||
LLVMContext &C(getGlobalContext());
|
||||
|
||||
// Make a BasicBlocks
|
||||
BasicBlock* bb0 = BasicBlock::Create(C);
|
||||
BasicBlock* bb1 = BasicBlock::Create(C);
|
||||
|
||||
// Mandatory BranchInst
|
||||
const BranchInst* b0 = BranchInst::Create(bb0);
|
||||
|
||||
EXPECT_TRUE(b0->isUnconditional());
|
||||
EXPECT_FALSE(b0->isConditional());
|
||||
EXPECT_EQ(b0->getNumSuccessors(), 1U);
|
||||
|
||||
// check num operands
|
||||
EXPECT_EQ(b0->getNumOperands(), 1U);
|
||||
|
||||
EXPECT_NE(b0->op_begin(), b0->op_end());
|
||||
EXPECT_EQ(next(b0->op_begin()), b0->op_end());
|
||||
|
||||
EXPECT_EQ(next(b0->op_begin()), b0->op_end());
|
||||
|
||||
const IntegerType* Int1 = IntegerType::get(C, 1);
|
||||
Constant* One = ConstantInt::get(Int1, 1, true);
|
||||
|
||||
// Conditional BranchInst
|
||||
BranchInst* b1 = BranchInst::Create(bb0, bb1, One);
|
||||
|
||||
EXPECT_FALSE(b1->isUnconditional());
|
||||
EXPECT_TRUE(b1->isConditional());
|
||||
EXPECT_EQ(b1->getNumSuccessors(), 2U);
|
||||
|
||||
// check num operands
|
||||
EXPECT_EQ(b1->getNumOperands(), 3U);
|
||||
|
||||
User::const_op_iterator b(b1->op_begin());
|
||||
|
||||
// check COND
|
||||
EXPECT_NE(b, b1->op_end());
|
||||
EXPECT_EQ(*b, One);
|
||||
EXPECT_EQ(b1->getOperand(0), One);
|
||||
EXPECT_EQ(b1->getCondition(), One);
|
||||
++b;
|
||||
|
||||
// check ELSE
|
||||
EXPECT_EQ(*b, bb1);
|
||||
EXPECT_EQ(b1->getOperand(1), bb1);
|
||||
EXPECT_EQ(b1->getSuccessor(1), bb1);
|
||||
++b;
|
||||
|
||||
// check THEN
|
||||
EXPECT_EQ(*b, bb0);
|
||||
EXPECT_EQ(b1->getOperand(2), bb0);
|
||||
EXPECT_EQ(b1->getSuccessor(0), bb0);
|
||||
++b;
|
||||
|
||||
EXPECT_EQ(b, b1->op_end());
|
||||
|
||||
// shrink it
|
||||
b1->setUnconditionalDest(bb1);
|
||||
|
||||
// check num operands
|
||||
EXPECT_EQ(b1->getNumOperands(), 1U);
|
||||
|
||||
User::const_op_iterator c(b1->op_begin());
|
||||
EXPECT_NE(c, b1->op_end());
|
||||
|
||||
// check THEN
|
||||
EXPECT_EQ(*c, bb1);
|
||||
EXPECT_EQ(b1->getOperand(0), bb1);
|
||||
EXPECT_EQ(b1->getSuccessor(0), bb1);
|
||||
++c;
|
||||
|
||||
EXPECT_EQ(c, b1->op_end());
|
||||
|
||||
// clean up
|
||||
delete b0;
|
||||
delete b1;
|
||||
|
||||
delete bb0;
|
||||
delete bb1;
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
} // end namespace llvm
|
@ -1,15 +0,0 @@
|
||||
##===- unittests/VMCore/Makefile ---------------------------*- Makefile -*-===##
|
||||
#
|
||||
# The LLVM Compiler Infrastructure
|
||||
#
|
||||
# This file is distributed under the University of Illinois Open Source
|
||||
# License. See LICENSE.TXT for details.
|
||||
#
|
||||
##===----------------------------------------------------------------------===##
|
||||
|
||||
LEVEL = ../..
|
||||
TESTNAME = VMCore
|
||||
LINK_COMPONENTS := core support target ipa
|
||||
|
||||
include $(LEVEL)/Makefile.config
|
||||
include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest
|
@ -1,144 +0,0 @@
|
||||
//===- llvm/unittest/VMCore/Metadata.cpp - Metadata unit tests ------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/Metadata.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/Type.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Support/ValueHandle.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
class MetadataTest : public testing::Test {
|
||||
protected:
|
||||
LLVMContext Context;
|
||||
};
|
||||
typedef MetadataTest MDStringTest;
|
||||
|
||||
// Test that construction of MDString with different value produces different
|
||||
// MDString objects, even with the same string pointer and nulls in the string.
|
||||
TEST_F(MDStringTest, CreateDifferent) {
|
||||
char x[3] = { 'f', 0, 'A' };
|
||||
MDString *s1 = MDString::get(Context, StringRef(&x[0], 3));
|
||||
x[2] = 'B';
|
||||
MDString *s2 = MDString::get(Context, StringRef(&x[0], 3));
|
||||
EXPECT_NE(s1, s2);
|
||||
}
|
||||
|
||||
// Test that creation of MDStrings with the same string contents produces the
|
||||
// same MDString object, even with different pointers.
|
||||
TEST_F(MDStringTest, CreateSame) {
|
||||
char x[4] = { 'a', 'b', 'c', 'X' };
|
||||
char y[4] = { 'a', 'b', 'c', 'Y' };
|
||||
|
||||
MDString *s1 = MDString::get(Context, StringRef(&x[0], 3));
|
||||
MDString *s2 = MDString::get(Context, StringRef(&y[0], 3));
|
||||
EXPECT_EQ(s1, s2);
|
||||
}
|
||||
|
||||
// Test that MDString prints out the string we fed it.
|
||||
TEST_F(MDStringTest, PrintingSimple) {
|
||||
char *str = new char[13];
|
||||
strncpy(str, "testing 1 2 3", 13);
|
||||
MDString *s = MDString::get(Context, StringRef(str, 13));
|
||||
strncpy(str, "aaaaaaaaaaaaa", 13);
|
||||
delete[] str;
|
||||
|
||||
std::string Str;
|
||||
raw_string_ostream oss(Str);
|
||||
s->print(oss);
|
||||
EXPECT_STREQ("metadata !\"testing 1 2 3\"", oss.str().c_str());
|
||||
}
|
||||
|
||||
// Test printing of MDString with non-printable characters.
|
||||
TEST_F(MDStringTest, PrintingComplex) {
|
||||
char str[5] = {0, '\n', '"', '\\', -1};
|
||||
MDString *s = MDString::get(Context, StringRef(str+0, 5));
|
||||
std::string Str;
|
||||
raw_string_ostream oss(Str);
|
||||
s->print(oss);
|
||||
EXPECT_STREQ("metadata !\"\\00\\0A\\22\\5C\\FF\"", oss.str().c_str());
|
||||
}
|
||||
|
||||
typedef MetadataTest MDNodeTest;
|
||||
|
||||
// Test the two constructors, and containing other Constants.
|
||||
TEST_F(MDNodeTest, Simple) {
|
||||
char x[3] = { 'a', 'b', 'c' };
|
||||
char y[3] = { '1', '2', '3' };
|
||||
|
||||
MDString *s1 = MDString::get(Context, StringRef(&x[0], 3));
|
||||
MDString *s2 = MDString::get(Context, StringRef(&y[0], 3));
|
||||
ConstantInt *CI = ConstantInt::get(getGlobalContext(), APInt(8, 0));
|
||||
|
||||
std::vector<Value *> V;
|
||||
V.push_back(s1);
|
||||
V.push_back(CI);
|
||||
V.push_back(s2);
|
||||
|
||||
MDNode *n1 = MDNode::get(Context, &V[0], 3);
|
||||
Value *const c1 = n1;
|
||||
MDNode *n2 = MDNode::get(Context, &c1, 1);
|
||||
MDNode *n3 = MDNode::get(Context, &V[0], 3);
|
||||
EXPECT_NE(n1, n2);
|
||||
#ifdef ENABLE_MDNODE_UNIQUING
|
||||
EXPECT_EQ(n1, n3);
|
||||
#else
|
||||
(void) n3;
|
||||
#endif
|
||||
|
||||
EXPECT_EQ(3u, n1->getNumOperands());
|
||||
EXPECT_EQ(s1, n1->getOperand(0));
|
||||
EXPECT_EQ(CI, n1->getOperand(1));
|
||||
EXPECT_EQ(s2, n1->getOperand(2));
|
||||
|
||||
EXPECT_EQ(1u, n2->getNumOperands());
|
||||
EXPECT_EQ(n1, n2->getOperand(0));
|
||||
}
|
||||
|
||||
TEST_F(MDNodeTest, Delete) {
|
||||
Constant *C = ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 1);
|
||||
Instruction *I = new BitCastInst(C, Type::getInt32Ty(getGlobalContext()));
|
||||
|
||||
Value *const V = I;
|
||||
MDNode *n = MDNode::get(Context, &V, 1);
|
||||
WeakVH wvh = n;
|
||||
|
||||
EXPECT_EQ(n, wvh);
|
||||
|
||||
delete I;
|
||||
}
|
||||
|
||||
TEST(NamedMDNodeTest, Search) {
|
||||
LLVMContext Context;
|
||||
Constant *C = ConstantInt::get(Type::getInt32Ty(Context), 1);
|
||||
Constant *C2 = ConstantInt::get(Type::getInt32Ty(Context), 2);
|
||||
|
||||
Value *const V = C;
|
||||
Value *const V2 = C2;
|
||||
MDNode *n = MDNode::get(Context, &V, 1);
|
||||
MDNode *n2 = MDNode::get(Context, &V2, 1);
|
||||
|
||||
MDNode *Nodes[2] = { n, n2 };
|
||||
|
||||
Module M("MyModule", Context);
|
||||
const char *Name = "llvm.NMD1";
|
||||
NamedMDNode *NMD = NamedMDNode::Create(Context, Name, &Nodes[0], 2, &M);
|
||||
std::string Str;
|
||||
raw_string_ostream oss(Str);
|
||||
NMD->print(oss);
|
||||
EXPECT_STREQ("!llvm.NMD1 = !{!0, !1}\n",
|
||||
oss.str().c_str());
|
||||
}
|
||||
}
|
@ -1,527 +0,0 @@
|
||||
//===- llvm/unittest/VMCore/PassManager.cpp - Constants unit tests ------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Analysis/LoopPass.h"
|
||||
#include "llvm/CallGraphSCCPass.h"
|
||||
#include "llvm/Target/TargetData.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/GlobalVariable.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/CallingConv.h"
|
||||
#include "llvm/BasicBlock.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/InlineAsm.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/Analysis/Verifier.h"
|
||||
#include "llvm/Assembly/PrintModulePass.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace {
|
||||
// ND = no deps
|
||||
// NM = no modifications
|
||||
struct ModuleNDNM: public ModulePass {
|
||||
public:
|
||||
static char run;
|
||||
static char ID;
|
||||
ModuleNDNM() : ModulePass(&ID) {}
|
||||
virtual bool runOnModule(Module &M) {
|
||||
run++;
|
||||
return false;
|
||||
}
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
}
|
||||
};
|
||||
char ModuleNDNM::ID=0;
|
||||
char ModuleNDNM::run=0;
|
||||
|
||||
struct ModuleNDM : public ModulePass {
|
||||
public:
|
||||
static char run;
|
||||
static char ID;
|
||||
ModuleNDM() : ModulePass(&ID) {}
|
||||
virtual bool runOnModule(Module &M) {
|
||||
run++;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
char ModuleNDM::ID=0;
|
||||
char ModuleNDM::run=0;
|
||||
RegisterPass<ModuleNDM> X("mndm","mndm",false,false);
|
||||
|
||||
struct ModuleNDM2 : public ModulePass {
|
||||
public:
|
||||
static char run;
|
||||
static char ID;
|
||||
ModuleNDM2() : ModulePass(&ID) {}
|
||||
virtual bool runOnModule(Module &M) {
|
||||
run++;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
char ModuleNDM2::ID=0;
|
||||
char ModuleNDM2::run=0;
|
||||
|
||||
struct ModuleDNM : public ModulePass {
|
||||
public:
|
||||
static char run;
|
||||
static char ID;
|
||||
ModuleDNM() : ModulePass(&ID) {}
|
||||
virtual bool runOnModule(Module &M) {
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
|
||||
run++;
|
||||
return false;
|
||||
}
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<ModuleNDM>();
|
||||
AU.setPreservesAll();
|
||||
}
|
||||
};
|
||||
char ModuleDNM::ID=0;
|
||||
char ModuleDNM::run=0;
|
||||
|
||||
template<typename P>
|
||||
struct PassTestBase : public P {
|
||||
protected:
|
||||
static int runc;
|
||||
static bool initialized;
|
||||
static bool finalized;
|
||||
int allocated;
|
||||
void run() {
|
||||
EXPECT_EQ(true, initialized);
|
||||
EXPECT_EQ(false, finalized);
|
||||
EXPECT_EQ(0, allocated);
|
||||
allocated++;
|
||||
runc++;
|
||||
}
|
||||
public:
|
||||
static char ID;
|
||||
static void finishedOK(int run) {
|
||||
EXPECT_GT(runc, 0);
|
||||
EXPECT_EQ(true, initialized);
|
||||
EXPECT_EQ(true, finalized);
|
||||
EXPECT_EQ(run, runc);
|
||||
}
|
||||
PassTestBase() : P(&ID), allocated(0) {
|
||||
initialized = false;
|
||||
finalized = false;
|
||||
runc = 0;
|
||||
}
|
||||
|
||||
virtual void releaseMemory() {
|
||||
EXPECT_GT(runc, 0);
|
||||
EXPECT_GT(allocated, 0);
|
||||
allocated--;
|
||||
}
|
||||
};
|
||||
template<typename P> char PassTestBase<P>::ID;
|
||||
template<typename P> int PassTestBase<P>::runc;
|
||||
template<typename P> bool PassTestBase<P>::initialized;
|
||||
template<typename P> bool PassTestBase<P>::finalized;
|
||||
|
||||
template<typename T, typename P>
|
||||
struct PassTest : public PassTestBase<P> {
|
||||
public:
|
||||
virtual bool doInitialization(T &t) {
|
||||
EXPECT_EQ(false, PassTestBase<P>::initialized);
|
||||
PassTestBase<P>::initialized = true;
|
||||
return false;
|
||||
}
|
||||
virtual bool doFinalization(T &t) {
|
||||
EXPECT_EQ(false, PassTestBase<P>::finalized);
|
||||
PassTestBase<P>::finalized = true;
|
||||
EXPECT_EQ(0, PassTestBase<P>::allocated);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
struct CGPass : public PassTest<CallGraph, CallGraphSCCPass> {
|
||||
public:
|
||||
virtual bool runOnSCC(CallGraphSCC &SCMM) {
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
|
||||
run();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
RegisterPass<CGPass> X1("cgp","cgp");
|
||||
|
||||
struct FPass : public PassTest<Module, FunctionPass> {
|
||||
public:
|
||||
virtual bool runOnFunction(Function &F) {
|
||||
// FIXME: PR4112
|
||||
// EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
|
||||
run();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
RegisterPass<FPass> X2("fp","fp");
|
||||
|
||||
struct LPass : public PassTestBase<LoopPass> {
|
||||
private:
|
||||
static int initcount;
|
||||
static int fincount;
|
||||
public:
|
||||
LPass() {
|
||||
initcount = 0; fincount=0;
|
||||
EXPECT_EQ(false, initialized);
|
||||
}
|
||||
static void finishedOK(int run, int finalized) {
|
||||
PassTestBase<LoopPass>::finishedOK(run);
|
||||
EXPECT_EQ(run, initcount);
|
||||
EXPECT_EQ(finalized, fincount);
|
||||
}
|
||||
virtual bool doInitialization(Loop* L, LPPassManager &LPM) {
|
||||
initialized = true;
|
||||
initcount++;
|
||||
return false;
|
||||
}
|
||||
virtual bool runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
|
||||
run();
|
||||
return false;
|
||||
}
|
||||
virtual bool doFinalization() {
|
||||
fincount++;
|
||||
finalized = true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
int LPass::initcount=0;
|
||||
int LPass::fincount=0;
|
||||
RegisterPass<LPass> X3("lp","lp");
|
||||
|
||||
struct BPass : public PassTestBase<BasicBlockPass> {
|
||||
private:
|
||||
static int inited;
|
||||
static int fin;
|
||||
public:
|
||||
static void finishedOK(int run, int N) {
|
||||
PassTestBase<BasicBlockPass>::finishedOK(run);
|
||||
EXPECT_EQ(inited, N);
|
||||
EXPECT_EQ(fin, N);
|
||||
}
|
||||
BPass() {
|
||||
inited = 0;
|
||||
fin = 0;
|
||||
}
|
||||
virtual bool doInitialization(Module &M) {
|
||||
EXPECT_EQ(false, initialized);
|
||||
initialized = true;
|
||||
return false;
|
||||
}
|
||||
virtual bool doInitialization(Function &F) {
|
||||
inited++;
|
||||
return false;
|
||||
}
|
||||
virtual bool runOnBasicBlock(BasicBlock &BB) {
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
|
||||
run();
|
||||
return false;
|
||||
}
|
||||
virtual bool doFinalization(Function &F) {
|
||||
fin++;
|
||||
return false;
|
||||
}
|
||||
virtual bool doFinalization(Module &M) {
|
||||
EXPECT_EQ(false, finalized);
|
||||
finalized = true;
|
||||
EXPECT_EQ(0, allocated);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
int BPass::inited=0;
|
||||
int BPass::fin=0;
|
||||
RegisterPass<BPass> X4("bp","bp");
|
||||
|
||||
struct OnTheFlyTest: public ModulePass {
|
||||
public:
|
||||
static char ID;
|
||||
OnTheFlyTest() : ModulePass(&ID) {}
|
||||
virtual bool runOnModule(Module &M) {
|
||||
EXPECT_TRUE(getAnalysisIfAvailable<TargetData>());
|
||||
for (Module::iterator I=M.begin(),E=M.end(); I != E; ++I) {
|
||||
Function &F = *I;
|
||||
{
|
||||
SCOPED_TRACE("Running on the fly function pass");
|
||||
getAnalysis<FPass>(F);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<FPass>();
|
||||
}
|
||||
};
|
||||
char OnTheFlyTest::ID=0;
|
||||
|
||||
TEST(PassManager, RunOnce) {
|
||||
Module M("test-once", getGlobalContext());
|
||||
struct ModuleNDNM *mNDNM = new ModuleNDNM();
|
||||
struct ModuleDNM *mDNM = new ModuleDNM();
|
||||
struct ModuleNDM *mNDM = new ModuleNDM();
|
||||
struct ModuleNDM2 *mNDM2 = new ModuleNDM2();
|
||||
|
||||
mNDM->run = mNDNM->run = mDNM->run = mNDM2->run = 0;
|
||||
|
||||
PassManager Passes;
|
||||
Passes.add(new TargetData(&M));
|
||||
Passes.add(mNDM2);
|
||||
Passes.add(mNDM);
|
||||
Passes.add(mNDNM);
|
||||
Passes.add(mDNM);
|
||||
|
||||
Passes.run(M);
|
||||
// each pass must be run exactly once, since nothing invalidates them
|
||||
EXPECT_EQ(1, mNDM->run);
|
||||
EXPECT_EQ(1, mNDNM->run);
|
||||
EXPECT_EQ(1, mDNM->run);
|
||||
EXPECT_EQ(1, mNDM2->run);
|
||||
}
|
||||
|
||||
TEST(PassManager, ReRun) {
|
||||
Module M("test-rerun", getGlobalContext());
|
||||
struct ModuleNDNM *mNDNM = new ModuleNDNM();
|
||||
struct ModuleDNM *mDNM = new ModuleDNM();
|
||||
struct ModuleNDM *mNDM = new ModuleNDM();
|
||||
struct ModuleNDM2 *mNDM2 = new ModuleNDM2();
|
||||
|
||||
mNDM->run = mNDNM->run = mDNM->run = mNDM2->run = 0;
|
||||
|
||||
PassManager Passes;
|
||||
Passes.add(new TargetData(&M));
|
||||
Passes.add(mNDM);
|
||||
Passes.add(mNDNM);
|
||||
Passes.add(mNDM2);// invalidates mNDM needed by mDNM
|
||||
Passes.add(mDNM);
|
||||
|
||||
Passes.run(M);
|
||||
// Some passes must be rerun because a pass that modified the
|
||||
// module/function was run inbetween
|
||||
EXPECT_EQ(2, mNDM->run);
|
||||
EXPECT_EQ(1, mNDNM->run);
|
||||
EXPECT_EQ(1, mNDM2->run);
|
||||
EXPECT_EQ(1, mDNM->run);
|
||||
}
|
||||
|
||||
Module* makeLLVMModule();
|
||||
|
||||
template<typename T>
|
||||
void MemoryTestHelper(int run) {
|
||||
OwningPtr<Module> M(makeLLVMModule());
|
||||
T *P = new T();
|
||||
PassManager Passes;
|
||||
Passes.add(new TargetData(M.get()));
|
||||
Passes.add(P);
|
||||
Passes.run(*M);
|
||||
T::finishedOK(run);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void MemoryTestHelper(int run, int N) {
|
||||
Module *M = makeLLVMModule();
|
||||
T *P = new T();
|
||||
PassManager Passes;
|
||||
Passes.add(new TargetData(M));
|
||||
Passes.add(P);
|
||||
Passes.run(*M);
|
||||
T::finishedOK(run, N);
|
||||
delete M;
|
||||
}
|
||||
|
||||
TEST(PassManager, Memory) {
|
||||
// SCC#1: test1->test2->test3->test1
|
||||
// SCC#2: test4
|
||||
// SCC#3: indirect call node
|
||||
{
|
||||
SCOPED_TRACE("Callgraph pass");
|
||||
MemoryTestHelper<CGPass>(3);
|
||||
}
|
||||
|
||||
{
|
||||
SCOPED_TRACE("Function pass");
|
||||
MemoryTestHelper<FPass>(4);// 4 functions
|
||||
}
|
||||
|
||||
{
|
||||
SCOPED_TRACE("Loop pass");
|
||||
MemoryTestHelper<LPass>(2, 1); //2 loops, 1 function
|
||||
}
|
||||
{
|
||||
SCOPED_TRACE("Basic block pass");
|
||||
MemoryTestHelper<BPass>(7, 4); //9 basic blocks
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TEST(PassManager, MemoryOnTheFly) {
|
||||
Module *M = makeLLVMModule();
|
||||
{
|
||||
SCOPED_TRACE("Running OnTheFlyTest");
|
||||
struct OnTheFlyTest *O = new OnTheFlyTest();
|
||||
PassManager Passes;
|
||||
Passes.add(new TargetData(M));
|
||||
Passes.add(O);
|
||||
Passes.run(*M);
|
||||
|
||||
FPass::finishedOK(4);
|
||||
}
|
||||
delete M;
|
||||
}
|
||||
|
||||
Module* makeLLVMModule() {
|
||||
// Module Construction
|
||||
Module* mod = new Module("test-mem", getGlobalContext());
|
||||
mod->setDataLayout("e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
|
||||
"i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-"
|
||||
"a0:0:64-s0:64:64-f80:128:128");
|
||||
mod->setTargetTriple("x86_64-unknown-linux-gnu");
|
||||
|
||||
// Type Definitions
|
||||
std::vector<const Type*>FuncTy_0_args;
|
||||
FunctionType* FuncTy_0 = FunctionType::get(
|
||||
/*Result=*/IntegerType::get(getGlobalContext(), 32),
|
||||
/*Params=*/FuncTy_0_args,
|
||||
/*isVarArg=*/false);
|
||||
|
||||
std::vector<const Type*>FuncTy_2_args;
|
||||
FuncTy_2_args.push_back(IntegerType::get(getGlobalContext(), 1));
|
||||
FunctionType* FuncTy_2 = FunctionType::get(
|
||||
/*Result=*/Type::getVoidTy(getGlobalContext()),
|
||||
/*Params=*/FuncTy_2_args,
|
||||
/*isVarArg=*/false);
|
||||
|
||||
|
||||
// Function Declarations
|
||||
|
||||
Function* func_test1 = Function::Create(
|
||||
/*Type=*/FuncTy_0,
|
||||
/*Linkage=*/GlobalValue::ExternalLinkage,
|
||||
/*Name=*/"test1", mod);
|
||||
func_test1->setCallingConv(CallingConv::C);
|
||||
AttrListPtr func_test1_PAL;
|
||||
func_test1->setAttributes(func_test1_PAL);
|
||||
|
||||
Function* func_test2 = Function::Create(
|
||||
/*Type=*/FuncTy_0,
|
||||
/*Linkage=*/GlobalValue::ExternalLinkage,
|
||||
/*Name=*/"test2", mod);
|
||||
func_test2->setCallingConv(CallingConv::C);
|
||||
AttrListPtr func_test2_PAL;
|
||||
func_test2->setAttributes(func_test2_PAL);
|
||||
|
||||
Function* func_test3 = Function::Create(
|
||||
/*Type=*/FuncTy_0,
|
||||
/*Linkage=*/GlobalValue::ExternalLinkage,
|
||||
/*Name=*/"test3", mod);
|
||||
func_test3->setCallingConv(CallingConv::C);
|
||||
AttrListPtr func_test3_PAL;
|
||||
func_test3->setAttributes(func_test3_PAL);
|
||||
|
||||
Function* func_test4 = Function::Create(
|
||||
/*Type=*/FuncTy_2,
|
||||
/*Linkage=*/GlobalValue::ExternalLinkage,
|
||||
/*Name=*/"test4", mod);
|
||||
func_test4->setCallingConv(CallingConv::C);
|
||||
AttrListPtr func_test4_PAL;
|
||||
func_test4->setAttributes(func_test4_PAL);
|
||||
|
||||
// Global Variable Declarations
|
||||
|
||||
|
||||
// Constant Definitions
|
||||
|
||||
// Global Variable Definitions
|
||||
|
||||
// Function Definitions
|
||||
|
||||
// Function: test1 (func_test1)
|
||||
{
|
||||
|
||||
BasicBlock* label_entry = BasicBlock::Create(getGlobalContext(), "entry",func_test1,0);
|
||||
|
||||
// Block entry (label_entry)
|
||||
CallInst* int32_3 = CallInst::Create(func_test2, "", label_entry);
|
||||
int32_3->setCallingConv(CallingConv::C);
|
||||
int32_3->setTailCall(false);AttrListPtr int32_3_PAL;
|
||||
int32_3->setAttributes(int32_3_PAL);
|
||||
|
||||
ReturnInst::Create(getGlobalContext(), int32_3, label_entry);
|
||||
|
||||
}
|
||||
|
||||
// Function: test2 (func_test2)
|
||||
{
|
||||
|
||||
BasicBlock* label_entry_5 = BasicBlock::Create(getGlobalContext(), "entry",func_test2,0);
|
||||
|
||||
// Block entry (label_entry_5)
|
||||
CallInst* int32_6 = CallInst::Create(func_test3, "", label_entry_5);
|
||||
int32_6->setCallingConv(CallingConv::C);
|
||||
int32_6->setTailCall(false);AttrListPtr int32_6_PAL;
|
||||
int32_6->setAttributes(int32_6_PAL);
|
||||
|
||||
ReturnInst::Create(getGlobalContext(), int32_6, label_entry_5);
|
||||
|
||||
}
|
||||
|
||||
// Function: test3 (func_test3)
|
||||
{
|
||||
|
||||
BasicBlock* label_entry_8 = BasicBlock::Create(getGlobalContext(), "entry",func_test3,0);
|
||||
|
||||
// Block entry (label_entry_8)
|
||||
CallInst* int32_9 = CallInst::Create(func_test1, "", label_entry_8);
|
||||
int32_9->setCallingConv(CallingConv::C);
|
||||
int32_9->setTailCall(false);AttrListPtr int32_9_PAL;
|
||||
int32_9->setAttributes(int32_9_PAL);
|
||||
|
||||
ReturnInst::Create(getGlobalContext(), int32_9, label_entry_8);
|
||||
|
||||
}
|
||||
|
||||
// Function: test4 (func_test4)
|
||||
{
|
||||
Function::arg_iterator args = func_test4->arg_begin();
|
||||
Value* int1_f = args++;
|
||||
int1_f->setName("f");
|
||||
|
||||
BasicBlock* label_entry_11 = BasicBlock::Create(getGlobalContext(), "entry",func_test4,0);
|
||||
BasicBlock* label_bb = BasicBlock::Create(getGlobalContext(), "bb",func_test4,0);
|
||||
BasicBlock* label_bb1 = BasicBlock::Create(getGlobalContext(), "bb1",func_test4,0);
|
||||
BasicBlock* label_return = BasicBlock::Create(getGlobalContext(), "return",func_test4,0);
|
||||
|
||||
// Block entry (label_entry_11)
|
||||
BranchInst::Create(label_bb, label_entry_11);
|
||||
|
||||
// Block bb (label_bb)
|
||||
BranchInst::Create(label_bb, label_bb1, int1_f, label_bb);
|
||||
|
||||
// Block bb1 (label_bb1)
|
||||
BranchInst::Create(label_bb1, label_return, int1_f, label_bb1);
|
||||
|
||||
// Block return (label_return)
|
||||
ReturnInst::Create(getGlobalContext(), label_return);
|
||||
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
//===- llvm/unittest/VMCore/VerifierTest.cpp - Verifier unit tests --------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/LLVMContext.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/Analysis/Verifier.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace llvm {
|
||||
namespace {
|
||||
|
||||
TEST(VerifierTest, Branch_i1) {
|
||||
LLVMContext &C = getGlobalContext();
|
||||
FunctionType *FTy = FunctionType::get(Type::getVoidTy(C), /*isVarArg=*/false);
|
||||
OwningPtr<Function> F(Function::Create(FTy, GlobalValue::ExternalLinkage));
|
||||
BasicBlock *Entry = BasicBlock::Create(C, "entry", F.get());
|
||||
BasicBlock *Exit = BasicBlock::Create(C, "exit", F.get());
|
||||
ReturnInst::Create(C, Exit);
|
||||
|
||||
// To avoid triggering an assertion in BranchInst::Create, we first create
|
||||
// a branch with an 'i1' condition ...
|
||||
|
||||
Constant *False = ConstantInt::getFalse(C);
|
||||
BranchInst *BI = BranchInst::Create(Exit, Exit, False, Entry);
|
||||
|
||||
// ... then use setOperand to redirect it to a value of different type.
|
||||
|
||||
Constant *Zero32 = ConstantInt::get(IntegerType::get(C, 32), 0);
|
||||
BI->setOperand(0, Zero32);
|
||||
|
||||
EXPECT_TRUE(verifyFunction(*F, ReturnStatusAction));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,573 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="Analysis"
|
||||
ProjectGUID="{0622E827-8464-489D-8B1C-B0B496F35C08}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(ProjectDir)..\bin\$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;.."
|
||||
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_LIB;__STDC_LIMIT_MACROS"
|
||||
StringPooling="true"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4355,4146,4800"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/Analysis.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(ProjectDir)..\bin\$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include;.."
|
||||
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;_DEBUG;_LIB;__STDC_LIMIT_MACROS"
|
||||
StringPooling="true"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4355,4146,4800"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/Analysis.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(ProjectDir)..\bin\$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops;..\common.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\include;.."
|
||||
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;NDEBUG;_LIB;__STDC_LIMIT_MACROS"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4355,4146,4800"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/Analysis.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(ProjectDir)..\bin\$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\include;.."
|
||||
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;WIN32;NDEBUG;_LIB;__STDC_LIMIT_MACROS"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4355,4146,4800"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/Analysis.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\AliasAnalysis.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\AliasAnalysisCounter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\AliasAnalysisEvaluator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\AliasDebugger.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\AliasSetTracker.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\Analysis.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\BasicAliasAnalysis.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\CFGPrinter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\ConstantFolding.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\DbgInfoPrinter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\DebugInfo.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\InstCount.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\Interval.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\IntervalPartition.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\LibCallAliasAnalysis.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\LibCallSemantics.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\LoopInfo.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\LoopPass.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\LoopVR.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\MemoryDependenceAnalysis.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\PostDominators.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\ProfileInfo.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\ProfileInfoLoader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\ProfileInfoLoaderPass.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\ScalarEvolution.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\ScalarEvolutionExpander.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\SparsePropagation.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\Trace.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\ValueTracking.cpp"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="IPA"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\Ipa\Andersens.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\Ipa\CallGraph.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\Ipa\CallGraphSCCPass.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\CaptureTracking.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\Ipa\FindUsedTypes.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\lib\Analysis\Ipa\GlobalsModRef.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\AliasAnalysis.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\AliasSetTracker.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\CallGraph.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\CFGPrinter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\ConstantFolding.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\ConstantsScanner.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\DominatorInternals.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\Dominators.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\ET-Forest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\FindUsedTypes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\Interval.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\IntervalIterator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\IntervalPartition.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\LoadValueNumbering.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\LoopInfo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\LoopPass.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\LoopVR.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\Passes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\PostDominators.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\ProfileInfo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\ProfileInfoLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\ProfileInfoTypes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\ScalarEvolution.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\ScalarEvolutionExpander.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\ScalarEvolutionExpressions.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\Trace.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\ValueNumbering.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\llvm\Analysis\Verifier.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user