diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake index 0c9cd667603..89cf1644382 100644 --- a/cmake/modules/AddClang.cmake +++ b/cmake/modules/AddClang.cmake @@ -86,9 +86,13 @@ macro(add_clang_library name) # llvm_add_library ignores BUILD_SHARED_LIBS if STATIC is explicitly set, # so we need to handle it here. if(BUILD_SHARED_LIBS) - set(LIBTYPE SHARED OBJECT) + set(LIBTYPE SHARED) else() - set(LIBTYPE STATIC OBJECT) + set(LIBTYPE STATIC) + endif() + if(NOT XCODE) + # The Xcode generator doesn't handle object libraries correctly. + list(APPEND LIBTYPE OBJECT) endif() set_property(GLOBAL APPEND PROPERTY CLANG_STATIC_LIBS ${name}) endif() diff --git a/include/indexstore/indexstore.h b/include/indexstore/indexstore.h index e5154694eb2..852f673914d 100644 --- a/include/indexstore/indexstore.h +++ b/include/indexstore/indexstore.h @@ -297,6 +297,7 @@ typedef enum { INDEXSTORE_SYMBOL_ROLE_ADDRESSOF = 1 << 7, INDEXSTORE_SYMBOL_ROLE_IMPLICIT = 1 << 8, INDEXSTORE_SYMBOL_ROLE_UNDEFINITION = 1 << 19, + INDEXSTORE_SYMBOL_ROLE_NAMEREFERENCE = 1 << 20, // Relation roles. INDEXSTORE_SYMBOL_ROLE_REL_CHILDOF = 1 << 9, diff --git a/lib/DirectoryWatcher/DirectoryWatcher.cpp b/lib/DirectoryWatcher/DirectoryWatcher.cpp index 0feaacefe7a..b735da6b6a4 100644 --- a/lib/DirectoryWatcher/DirectoryWatcher.cpp +++ b/lib/DirectoryWatcher/DirectoryWatcher.cpp @@ -92,7 +92,11 @@ struct DirectoryScan { # define __has_include(x) 0 #endif -#if __has_include() +#if !defined(__is_target_os) +#define __is_target_os(x) 0 +#endif + +#if __is_target_os(macos) # include "DirectoryWatcher-mac.inc.h" #elif __has_include() # include "DirectoryWatcher-linux.inc.h" diff --git a/lib/Index/IndexDataStoreUtils.cpp b/lib/Index/IndexDataStoreUtils.cpp index 39dea609c83..c6cd43a471a 100644 --- a/lib/Index/IndexDataStoreUtils.cpp +++ b/lib/Index/IndexDataStoreUtils.cpp @@ -275,6 +275,8 @@ SymbolRoleSet index::getSymbolRoles(uint64_t Roles) { SymbolRoles |= (SymbolRoleSet)SymbolRole::RelationIBTypeOf; if (Roles & INDEXSTORE_SYMBOL_ROLE_REL_SPECIALIZATIONOF) SymbolRoles |= (SymbolRoleSet)SymbolRole::RelationSpecializationOf; + if (Roles & INDEXSTORE_SYMBOL_ROLE_NAMEREFERENCE) + SymbolRoles |= (SymbolRoleSet)SymbolRole::NameReference; return SymbolRoles; } @@ -511,6 +513,9 @@ uint64_t index::getIndexStoreRoles(SymbolRoleSet Roles) { case SymbolRole::RelationSpecializationOf: storeRoles |= INDEXSTORE_SYMBOL_ROLE_REL_SPECIALIZATIONOF; break; + case SymbolRole::NameReference: + storeRoles |= INDEXSTORE_SYMBOL_ROLE_NAMEREFERENCE; + break; } }); return storeRoles; diff --git a/tools/clang-shlib/CMakeLists.txt b/tools/clang-shlib/CMakeLists.txt index 162a935301c..bc34fa10d1f 100644 --- a/tools/clang-shlib/CMakeLists.txt +++ b/tools/clang-shlib/CMakeLists.txt @@ -6,7 +6,13 @@ endif() get_property(clang_libs GLOBAL PROPERTY CLANG_STATIC_LIBS) foreach (lib ${clang_libs}) - list(APPEND _OBJECTS $) + if(XCODE) + # Xcode doesn't support object libraries, so we have to trick it into + # linking the static libraries instead. + list(APPEND _DEPS "-force_load" ${lib}) + else() + list(APPEND _OBJECTS $) + endif() list(APPEND _DEPS $) list(APPEND _DEPS $) endforeach ()