diff -ur llvm-project-apple-stable-20191106/clang/include/clang/Basic/FileManager.h llvm-project-apple-stable-20191106+arm64e/clang/include/clang/Basic/FileManager.h --- llvm-project-apple-stable-20191106/clang/include/clang/Basic/FileManager.h 2019-12-03 19:28:47.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/clang/include/clang/Basic/FileManager.h 2019-12-15 00:26:20.000000000 -1000 @@ -398,6 +398,9 @@ std::error_code getNoncachedStatValue(StringRef Path, llvm::vfs::Status &Result); + // Remove the real file \p Entry from the cache. + void invalidateCache(const FileEntry *Entry); + /// If path is not absolute and FileSystemOptions set the working /// directory, the path is modified to be relative to the given /// working directory. diff -ur llvm-project-apple-stable-20191106/clang/lib/Basic/FileManager.cpp llvm-project-apple-stable-20191106+arm64e/clang/lib/Basic/FileManager.cpp --- llvm-project-apple-stable-20191106/clang/lib/Basic/FileManager.cpp 2019-12-03 19:28:47.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/clang/lib/Basic/FileManager.cpp 2019-12-15 00:26:55.000000000 -1000 @@ -522,6 +522,21 @@ return std::error_code(); } +void FileManager::invalidateCache(const FileEntry *Entry) { + assert(Entry && "Cannot invalidate a NULL FileEntry"); + + SeenFileEntries.erase(Entry->getName()); + + // FileEntry invalidation should not block future optimizations in the file + // caches. Possible alternatives are cache truncation (invalidate last N) or + // invalidation of the whole cache. + // + // FIXME: This is broken. We sometimes have the same FileEntry* shared + // between multiple SeenFileEntries, so this can leave dangling pointers. + UniqueRealFiles.erase(Entry->getUniqueID()); +} + + void FileManager::GetUniqueIDMapping( SmallVectorImpl &UIDToFiles) const { UIDToFiles.clear(); diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/CMakeLists.txt llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/CMakeLists.txt --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/CMakeLists.txt 2019-12-16 00:04:41.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/CMakeLists.txt 2019-12-12 08:33:27.000000000 -1000 @@ -1,6 +1,6 @@ -if(NOT APPLE) - message(FATAL_ERROR "Unsupported configuration.") -endif() +#if(NOT APPLE) +# message(FATAL_ERROR "Unsupported configuration.") +#endif() set(TAPI_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(TAPI_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) @@ -38,11 +38,11 @@ if(DEFINED ENV{RC_SUPPORTED_ARCHS}) string(REPLACE " " ";" TAPI_SUPPORTED_ARCHS $ENV{RC_SUPPORTED_ARCHS}) elseif(NOT DEFINED TAPI_SUPPORTED_ARCHS) - set(TAPI_SUPPORTED_ARCHS i386 x86_64 x86_64h armv4t armv6 armv5 armv7 armv7s armv7k armv6m armv7m armv7em arm64) + set(TAPI_SUPPORTED_ARCHS i386 x86_64 x86_64h armv4t armv6 armv5 armv7 armv7s armv7k armv6m armv7m armv7em arm64 arm64e) endif() message(STATUS "Supported Architectures: ${TAPI_SUPPORTED_ARCHS}") -set(KNOWN_ARCHS i386 x86_64 x86_64h armv4t armv6 armv5 armv7 armv7s armv7k armv6m armv7m armv7em arm64) +set(KNOWN_ARCHS i386 x86_64 x86_64h armv4t armv6 armv5 armv7 armv7s armv7k armv6m armv7m armv7em arm64 arm64e) set (CONFIG_FILE ${CMAKE_CURRENT_BINARY_DIR}/include/tapi/Core/ArchitectureConfig.h) file(WRITE ${CONFIG_FILE} "#ifndef TAPI_CORE_ARCHITECTURE_CONFIG_H\n") @@ -171,6 +171,13 @@ ${CMAKE_CURRENT_SOURCE_DIR}/include ) +if (LLVM_EXTERNAL_CLANG_SOURCE_DIR) + include_directories(${LLVM_EXTERNAL_CLANG_SOURCE_DIR}/include) +else () + include_directories(${CMAKE_SOURCE_DIR}/tools/clang/include) +endif () +include_directories("${CMAKE_CURRENT_BINARY_DIR}/../../tools/clang/include") + option(TAPI_INCLUDE_TESTS "Generate build targets for the TAPI unit tests." ${LLVM_INCLUDE_TESTS}) option(TAPI_INCLUDE_DOCS "Generate build targets for the TAPI docs." diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Core/Architecture.def llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Core/Architecture.def --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Core/Architecture.def 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Core/Architecture.def 2019-12-12 09:55:31.000000000 -1000 @@ -70,3 +70,7 @@ ARCHINFO(arm64, MachO::CPU_TYPE_ARM64, MachO::CPU_SUBTYPE_ARM64_ALL) #endif +#ifdef SUPPORT_ARCH_ARM64E +ARCHINFO(arm64e, MachO::CPU_TYPE_ARM64, MachO::CPU_SUBTYPE_ARM64E) +#endif + diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Core/ArchitectureSupport.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Core/ArchitectureSupport.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Core/ArchitectureSupport.h 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Core/ArchitectureSupport.h 2019-12-12 08:36:32.000000000 -1000 @@ -21,7 +21,7 @@ #include "tapi/LinkerInterfaceFile.h" #include "tapi/PackedVersion32.h" #include "tapi/tapi.h" -#include "clang/Basic/VersionTuple.h" +#include "llvm/Support/VersionTuple.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/raw_ostream.h" #include @@ -35,7 +35,7 @@ constexpr PackedVersion(uint32_t version) : _version(version) {} PackedVersion(unsigned major, unsigned minor, unsigned subminor) : _version((major << 16) | ((minor & 0xff) << 8) | (subminor & 0xff)) {} - PackedVersion(clang::VersionTuple version) { + PackedVersion(llvm::VersionTuple version) { _version = version.getMajor() << 16; if (auto minor = version.getMinor()) _version |= (*minor & 0xff) << 8; diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Core/FileManager.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Core/FileManager.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Core/FileManager.h 2019-12-16 00:04:41.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Core/FileManager.h 2019-12-12 08:55:23.000000000 -1000 @@ -47,14 +47,17 @@ FileManager(const clang::FileSystemOptions &fileSystemOpts, llvm::IntrusiveRefCntPtr cacheFactory = nullptr, - llvm::IntrusiveRefCntPtr fs = nullptr); + llvm::IntrusiveRefCntPtr fs = nullptr); /// \brief Check if a particular path exists. bool exists(StringRef path); /// \brief Check if a particular path is a directory. bool isDirectory(StringRef path, bool CacheFailure = true) { - return getDirectory(path, CacheFailure) != nullptr; + if (auto DirEntry = getDirectory(path, CacheFailure)) + return true; + else + return false; } /// \brief Check if a particular path is a symlink using directory_iterator. diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Core/HeaderFile.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Core/HeaderFile.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Core/HeaderFile.h 2019-12-16 00:04:41.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Core/HeaderFile.h 2019-05-30 08:01:05.000000000 -1000 @@ -19,6 +19,7 @@ #include "tapi/Defines.h" #include "llvm/ADT/StringRef.h" #include +#include TAPI_NAMESPACE_INTERNAL_BEGIN diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Core/Platform.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Core/Platform.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Core/Platform.h 2019-12-16 00:04:41.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Core/Platform.h 2019-05-30 08:01:05.000000000 -1000 @@ -34,6 +34,8 @@ watchOS, watchOSSimulator, bridgeOS, + iOSMac, + zippered }; Platform mapToSim(Platform platform, bool wantSim); diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Core/YAML.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Core/YAML.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Core/YAML.h 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Core/YAML.h 2019-12-12 11:23:59.000000000 -1000 @@ -22,6 +22,7 @@ #include "tapi/Core/Platform.h" #include "tapi/Core/YAMLReaderWriter.h" #include "clang/Frontend/FrontendOptions.h" +#include "clang/Basic/LangStandard.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/Support/YAMLTraits.h" @@ -90,9 +91,8 @@ static QuotingType mustQuote(StringRef); }; -using clang::InputKind; -template <> struct ScalarEnumerationTraits { - static void enumeration(IO &io, InputKind::Language &kind); +template <> struct ScalarEnumerationTraits { + static void enumeration(IO &io, clang::Language &kind); }; } // end namespace yaml. diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Diagnostics/DiagnosticTAPIKinds.td llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Diagnostics/DiagnosticTAPIKinds.td --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Diagnostics/DiagnosticTAPIKinds.td 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Diagnostics/DiagnosticTAPIKinds.td 2019-12-12 11:13:08.000000000 -1000 @@ -35,6 +35,15 @@ string CategoryName = Name; } +// Textual substitutions which may be performed on the text of diagnostics +class TextSubstitution { + string Substitution = Text; + // TODO: These are only here to allow substitutions to be declared inline with + // diagnostics + string Component = ""; + string CategoryName = ""; +} + // Diagnostic Groups. class DiagGroup subgroups = []> { string GroupName = Name; diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Driver/Configuration.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Driver/Configuration.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Driver/Configuration.h 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Driver/Configuration.h 2019-12-12 11:22:25.000000000 -1000 @@ -33,7 +33,7 @@ class Context; struct CommandLineConfiguration { - clang::InputKind::Language language = clang::InputKind::Unknown; + clang::Language language = clang::Language::Unknown; std::string std; std::string isysroot; std::string publicUmbrellaHeaderPath; @@ -68,7 +68,7 @@ Context &context); StringRef getSysRoot() const; - clang::InputKind::Language getLanguage(StringRef path) const; + clang::Language getLanguage(StringRef path) const; const std::vector &getMacros(StringRef path) const; const PathSeq &getIncludePaths(StringRef path) const; const PathSeq &getFrameworkPaths(StringRef path) const; diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Driver/ConfigurationFile.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Driver/ConfigurationFile.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Driver/ConfigurationFile.h 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Driver/ConfigurationFile.h 2019-12-12 11:21:11.000000000 -1000 @@ -38,8 +38,8 @@ TAPI_NAMESPACE_INTERNAL_BEGIN using Macro = std::pair; -static const clang::InputKind::Language defaultLanguage = - clang::InputKind::ObjC; +static const clang::Language defaultLanguage = + clang::Language::ObjC; namespace configuration { namespace v1 { @@ -54,7 +54,7 @@ std::string name; std::string path; std::string installName; - clang::InputKind::Language language; + clang::Language language; PathSeq includePaths; PathSeq frameworkPaths; std::vector macros; @@ -65,7 +65,7 @@ struct DylibConfiguration { std::string name; std::string installName; - clang::InputKind::Language language; + clang::Language language; PathSeq includePaths; PathSeq binaries; std::vector macros; @@ -77,7 +77,7 @@ Platform platform; PackedVersion version; std::string isysroot; - clang::InputKind::Language language; + clang::Language language; PathSeq includePaths; PathSeq frameworkPaths; std::vector macros; @@ -107,7 +107,7 @@ Platform platform; PackedVersion version; std::string isysroot; - clang::InputKind::Language language; + clang::Language language; PathSeq includePaths; PathSeq frameworkPaths; std::vector macros; diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Driver/Options.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Driver/Options.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Driver/Options.h 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Driver/Options.h 2019-12-12 11:15:29.000000000 -1000 @@ -169,7 +169,7 @@ std::vector targets; /// \brief Specify the language to use for parsing. - clang::InputKind::Language language = clang::InputKind::ObjC; + clang::Language language = clang::Language::ObjC; /// \brief Language standard to use for parsing. std::string language_std; diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Driver/SnapshotFileSystem.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Driver/SnapshotFileSystem.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Driver/SnapshotFileSystem.h 2019-12-16 00:04:41.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Driver/SnapshotFileSystem.h 2019-12-12 11:17:50.000000000 -1000 @@ -16,23 +16,23 @@ #include "tapi/Core/LLVM.h" #include "tapi/Defines.h" -#include "clang/Basic/VirtualFileSystem.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorOr.h" #include "llvm/Support/Path.h" +#include "llvm/Support/VirtualFileSystem.h" #include -using clang::vfs::directory_iterator; -using clang::vfs::File; -using clang::vfs::Status; +using llvm::vfs::directory_iterator; +using llvm::vfs::File; +using llvm::vfs::Status; TAPI_NAMESPACE_INTERNAL_BEGIN /// \brief The snapshot virtual file system. -class SnapshotFileSystem final : public clang::vfs::FileSystem { +class SnapshotFileSystem final : public llvm::vfs::FileSystem { private: enum class EntryKind { Directory, File }; @@ -54,7 +54,7 @@ public: DirectoryEntry(StringRef name) : Entry(EntryKind::Directory, name), - status(name, clang::vfs::getNextVirtualUniqueID(), + status(name, llvm::vfs::getNextVirtualUniqueID(), llvm::sys::TimePoint<>(), 0, 0, 0, llvm::sys::fs::file_type::directory_file, llvm::sys::fs::all_all) {} @@ -108,15 +108,15 @@ public: SnapshotFileSystem(IntrusiveRefCntPtr externalFS = - clang::vfs::getRealFileSystem()) - : root(llvm::make_unique("/")), + llvm::vfs::getRealFileSystem()) + : root(std::make_unique("/")), externalFS(std::move(externalFS)) {} /// \brief Get the status of the entry at \p Path, if one exists. llvm::ErrorOr status(const Twine &path) override; /// \brief Get a \p File object for the file at \p Path, if one exists. - llvm::ErrorOr> + llvm::ErrorOr> openFileForRead(const Twine &path) override; /// \brief Get a directory_iterator for \p Dir. diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Driver/StatRecorder.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Driver/StatRecorder.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Driver/StatRecorder.h 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Driver/StatRecorder.h 2019-12-14 23:52:42.000000000 -1000 @@ -18,6 +18,8 @@ #include "tapi/Driver/Snapshot.h" #include "tapi/Driver/SnapshotFileSystem.h" #include "clang/Basic/FileSystemStatCache.h" +#include "clang/Sema/Lookup.h" +#include "llvm/Support/VirtualFileSystem.h" TAPI_NAMESPACE_INTERNAL_BEGIN @@ -28,21 +30,21 @@ public: StatRecorder() = default; - LookupResult getStat(StringRef path, clang::FileData &data, bool isFile, - std::unique_ptr *file, - clang::vfs::FileSystem &fs) override { - auto result = statChained(path, data, isFile, file, fs); + std::error_code getStat(StringRef path, llvm::vfs::Status &status, bool isFile, + std::unique_ptr *file, + llvm::vfs::FileSystem &fs) override { + auto err = get(path, status, isFile, file, nullptr, fs); // Don't record non existing files and directories. - if (result == CacheMissing) - return result; + if (err) + return err; - if (data.IsDirectory) + if (status.isDirectory()) TAPI_INTERNAL::globalSnapshot->recordDirectory(path); else TAPI_INTERNAL::globalSnapshot->recordFile(path); - return result; + return std::error_code(); } }; diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Frontend/Frontend.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Frontend/Frontend.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Frontend/Frontend.h 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Frontend/Frontend.h 2019-12-12 10:11:55.000000000 -1000 @@ -28,9 +28,9 @@ struct FrontendJob { std::string workingDirectory; IntrusiveRefCntPtr cacheFactory; - IntrusiveRefCntPtr vfs; + IntrusiveRefCntPtr vfs; llvm::Triple target; - clang::InputKind::Language language = clang::InputKind::Unknown; + clang::Language language = clang::Language::Unknown; bool useRTTI = true; bool enableModules = false; bool validateSystemHeaders = false; diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Frontend/FrontendContext.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Frontend/FrontendContext.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/Frontend/FrontendContext.h 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/Frontend/FrontendContext.h 2019-12-12 10:08:58.000000000 -1000 @@ -39,7 +39,7 @@ FrontendContext( StringRef workingDirectory = StringRef(), IntrusiveRefCntPtr cacheFactory = nullptr, - IntrusiveRefCntPtr vfs = nullptr); + IntrusiveRefCntPtr vfs = nullptr); void visit(APIVisitor &visitor) { api.visit(visitor); } }; diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/LinkerInterfaceFile.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/LinkerInterfaceFile.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/include/tapi/LinkerInterfaceFile.h 2019-12-16 00:04:41.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/include/tapi/LinkerInterfaceFile.h 2019-05-30 08:01:05.000000000 -1000 @@ -64,6 +64,8 @@ /// \since 1.2 bridgeOS = 5, + iOSMac = 6, + zippered = 10 }; /// diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/CMakeLists.txt llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/CMakeLists.txt --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/CMakeLists.txt 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/CMakeLists.txt 2019-12-11 23:53:54.000000000 -1000 @@ -40,3 +40,20 @@ LINK_LIBS clangBasic ) +add_dependencies(tapiCore clang-resource-headers) +if(Clang_DIR) + set(clang_lib_dir ${Clang_DIR}/../..) +elseif(LLVM_DIR) + set(clang_lib_dir ${LLVM_DIR}/../..) +elseif(LLVM_LIBRARY_DIRS) + set(clang_lib_dir ${LLVM_LIBRARY_DIRS}) +elseif(LLVM_BUILD_LIBRARY_DIR) + set(clang_lib_dir ${LLVM_BUILD_LIBRARY_DIR}) +elseif(LLVM_BINARY_DIR) + set(clang_lib_dir ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}) +endif() +set(clang_version ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}) +set(clang_resource_headers_dir ${clang_lib_dir}/clang/${clang_version}/include) +if(NOT EXISTS ${clang_resource_headers_dir}) + message(WARNING "Expected directory for clang-resource headers not found: ${clang_resource_headers_dir}") +endif() diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/FileManager.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/FileManager.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/FileManager.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/FileManager.cpp 2019-12-12 08:46:41.000000000 -1000 @@ -15,7 +15,7 @@ #include "tapi/Core/FileManager.h" #include "tapi/Defines.h" #include "clang/Basic/FileSystemStatCache.h" -#include "clang/Basic/VirtualFileSystem.h" +#include "llvm/Support/VirtualFileSystem.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/ADT/StringRef.h" @@ -38,7 +38,7 @@ } bool FileManager::exists(StringRef path) { - clang::vfs::Status result; + vfs::Status result; if (getNoncachedStatValue(path, result)) return false; return result.exists(); @@ -51,9 +51,9 @@ } void FileManager::installStatRecorder() { - clearStatCaches(); + clearStatCache(); if (cacheFactory != nullptr) - addStatCache(std::unique_ptr(cacheFactory->create())); + setStatCache(std::unique_ptr(cacheFactory->create())); } TAPI_NAMESPACE_INTERNAL_END diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/InterfaceFileManager.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/InterfaceFileManager.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/InterfaceFileManager.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/InterfaceFileManager.cpp 2019-12-12 09:05:14.000000000 -1000 @@ -30,12 +30,11 @@ Expected InterfaceFileManager::readFile(const std::string &path) { - auto *file = _fm.getFile(path); - if (file == nullptr) - return errorCodeToError( - std::make_error_code(std::errc::no_such_file_or_directory)); + auto fileOrErr = _fm.getFile(path); + if (!fileOrErr) + return errorCodeToError(fileOrErr.getError()); - auto bufferOrErr = _fm.getBufferForFile(file); + auto bufferOrErr = _fm.getBufferForFile(fileOrErr.get()); if (!bufferOrErr) return errorCodeToError(bufferOrErr.getError()); diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/MachODylibReader.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/MachODylibReader.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/MachODylibReader.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/MachODylibReader.cpp 2019-12-12 09:12:22.000000000 -1000 @@ -25,19 +25,6 @@ using namespace llvm; using namespace llvm::object; -// Define missing platform enums. -namespace llvm { -namespace MachO { -// clang-format off - enum MissingPlatformType { - PLATFORM_IOSSIMULATOR = 7, - PLATFORM_TVOSSIMULATOR = 8, - PLATFORM_WATCHOSSIMULATOR = 9, - }; -// clang-format on -} // end namespace MachO. -} // end namespace llvm. - TAPI_NAMESPACE_INTERNAL_BEGIN Expected @@ -266,12 +253,17 @@ } for (auto §ion : object->sections()) { - StringRef sectionName; - section.getName(sectionName); + Expected sectionNameOrErr = section.getName(); + if (!sectionNameOrErr) continue; + StringRef sectionName = sectionNameOrErr.get(); + if (sectionName != "__objc_imageinfo" && sectionName != "__image_info") continue; - StringRef content; - section.getContents(content); + Expected contentOrErr = section.getContents(); + if (!contentOrErr) continue; + + StringRef content = *contentOrErr; + if ((content.size() >= 8) && (content[0] == 0)) { uint32_t flags; if (object->isLittleEndian()) { diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/Path.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/Path.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/Path.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/Path.cpp 2019-12-12 09:15:41.000000000 -1000 @@ -17,7 +17,7 @@ #include "tapi/Core/LLVM.h" #include "tapi/Core/Utils.h" #include "tapi/Defines.h" -#include "clang/Basic/VirtualFileSystem.h" +#include "llvm/Support/VirtualFileSystem.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/Error.h" @@ -54,8 +54,8 @@ const std::function &func) { PathSeq files; std::error_code ec; - auto &fs = *fm.getVirtualFileSystem(); - for (clang::vfs::recursive_directory_iterator i(fs, path, ec), ie; i != ie; + auto &fs = fm.getVirtualFileSystem(); + for (llvm::vfs::recursive_directory_iterator i(fs, path, ec), ie; i != ie; i.increment(ec)) { // Skip files that not exist. This usually happens for broken symlinks. @@ -67,7 +67,7 @@ if (ec) return errorCodeToError(ec); - auto path = i->getName(); + auto path = i->path(); if (func(path)) files.emplace_back(path); } diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/Platform.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/Platform.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/Platform.cpp 2019-12-16 00:04:41.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/Platform.cpp 2019-05-30 08:01:05.000000000 -1000 @@ -93,6 +93,10 @@ return "tvOSSimulator"; case Platform::bridgeOS: return "bridgeOS"; + case Platform::iOSMac: + return "iOSMac"; + case Platform::zippered: + return "zippered"; } } @@ -116,6 +120,10 @@ return "tvos" + version + "-simulator"; case Platform::bridgeOS: return "bridgeos" + version; + case Platform::iOSMac: + return "iOSMac" + version; + case Platform::zippered: + return "zippered" + version; } } diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/Registry.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/Registry.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/Registry.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/Registry.cpp 2019-12-12 09:16:35.000000000 -1000 @@ -149,7 +149,7 @@ } void Registry::addYAMLReaders() { - auto reader = make_unique(); + auto reader = std::make_unique(); reader->add( std::unique_ptr(new stub::v1::YAMLDocumentHandler)); reader->add( @@ -160,7 +160,7 @@ } void Registry::addYAMLWriters() { - auto writer = make_unique(); + auto writer = std::make_unique(); writer->add( std::unique_ptr(new stub::v1::YAMLDocumentHandler)); writer->add( @@ -174,6 +174,6 @@ add(std::unique_ptr(new ReexportFileWriter)); } -void Registry::addDiagnosticReader() { add(make_unique()); } +void Registry::addDiagnosticReader() { add(std::make_unique()); } TAPI_NAMESPACE_INTERNAL_END diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/YAML.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/YAML.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Core/YAML.cpp 2019-12-16 00:04:41.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Core/YAML.cpp 2019-12-12 09:29:16.000000000 -1000 @@ -55,6 +55,9 @@ io.enumCase(platform, "tvos", Platform::tvOS); io.enumCase(platform, "tvos", Platform::tvOSSimulator); io.enumCase(platform, "bridgeos", Platform::bridgeOS); + + io.enumCase(platform, "iosmac", Platform::zippered); + io.enumCase(platform, "zippered", Platform::zippered); } using TAPI_INTERNAL::Architecture; @@ -191,16 +194,16 @@ return QuotingType::Single; } -using clang::InputKind; -void ScalarEnumerationTraits::enumeration( - IO &io, InputKind::Language &kind) { - io.enumCase(kind, "c", InputKind::C); - io.enumCase(kind, "cxx", InputKind::CXX); - io.enumCase(kind, "objective-c", InputKind::ObjC); - io.enumCase(kind, "objc", InputKind::ObjC); // to keep old snapshots working. - io.enumCase(kind, "objective-cxx", InputKind::ObjCXX); +using namespace clang; +void ScalarEnumerationTraits::enumeration( + IO &io, Language &kind) { + io.enumCase(kind, "c", Language::C); + io.enumCase(kind, "cxx", Language::CXX); + io.enumCase(kind, "objective-c", Language::ObjC); + io.enumCase(kind, "objc", Language::ObjC); // to keep old snapshots working. + io.enumCase(kind, "objective-cxx", Language::ObjCXX); io.enumCase(kind, "objcxx", - InputKind::ObjCXX); // to keep old snapshots working. + Language::ObjCXX); // to keep old snapshots working. } } // end namespace yaml. diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Diagnostics/Diagnostics.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Diagnostics/Diagnostics.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Diagnostics/Diagnostics.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Diagnostics/Diagnostics.cpp 2019-12-15 23:58:25.000000000 -1000 @@ -140,7 +140,7 @@ raw_ostream *os = &llvm::errs(); if (output != "-") { // Create the output stream. - auto fileOS = llvm::make_unique( + auto fileOS = std::make_unique( output, ec, llvm::sys::fs::F_Append | llvm::sys::fs::F_Text); if (ec) { report(diag::err_cannot_open_file) << output << ec.message(); @@ -153,7 +153,7 @@ diagOpts->DiagnosticLogFile = output.str(); // Chain in the diagnostic client which will log the diagnostics. - auto Logger = llvm::make_unique( + auto Logger = std::make_unique( *os, diagOpts.get(), std::move(streamOwner)); assert(diag->ownsClient()); diag->setClient(new clang::ChainedDiagnosticConsumer(diag->takeClient(), diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/Configuration.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/Configuration.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/Configuration.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/Configuration.cpp 2019-12-12 11:23:09.000000000 -1000 @@ -152,8 +152,8 @@ return file.isysroot; } -clang::InputKind::Language Configuration::getLanguage(StringRef path) const { - if (commandLine.language != clang::InputKind::Unknown) +clang::Language Configuration::getLanguage(StringRef path) const { + if (commandLine.language != clang::Language::Unknown) return commandLine.language; auto it = pathToConfig.find(getCanonicalPath(path)); diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/ConfigurationFile.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/ConfigurationFile.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/ConfigurationFile.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/ConfigurationFile.cpp 2019-12-12 11:25:06.000000000 -1000 @@ -120,7 +120,7 @@ Platform platform; PackedVersion version; std::string isysroot; - clang::InputKind::Language language; + clang::Language language; PathSeq includePaths; PathSeq frameworkPaths; std::vector macros; @@ -135,7 +135,7 @@ io.mapRequired("sdk-platform", keys->platform); io.mapRequired("sdk-version", keys->version); io.mapRequired("sdk-root", keys->isysroot); - io.mapOptional("language", keys->language, clang::InputKind::ObjC); + io.mapOptional("language", keys->language, clang::Language::ObjC); io.mapOptional("include-paths", keys->includePaths); io.mapOptional("framework-paths", keys->frameworkPaths); io.mapOptional("macros", keys->macros); diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/DirectoryScanner.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/DirectoryScanner.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/DirectoryScanner.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/DirectoryScanner.cpp 2019-12-12 11:34:02.000000000 -1000 @@ -21,9 +21,9 @@ #include "tapi/Core/Utils.h" #include "tapi/Diagnostics/Diagnostics.h" #include "clang/Basic/Diagnostic.h" -#include "clang/Basic/VirtualFileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/VirtualFileSystem.h" using namespace llvm; using namespace clang; @@ -53,11 +53,10 @@ sys::path::append(path, subDirectory); return _fm.getDirectory(path, /*CacheFailure=*/false); }; - const DirectoryEntry *directoryEntryPublic = getDirectory("usr/include"); - const DirectoryEntry *directoryEntryPrivate = - getDirectory("usr/local/include"); + auto directoryEntryPublicOrError = getDirectory("usr/include"); + auto directoryEntryPrivateOrError = getDirectory("usr/local/include"); - if (!directoryEntryPublic && !directoryEntryPrivate) { + if (!directoryEntryPublicOrError && !directoryEntryPrivateOrError) { errs() << "error: Cannot find public or private sub directories: " << directory << "\n"; } @@ -66,13 +65,13 @@ auto &dylib = frameworks.back(); dylib.isDynamicLibrary = true; - if (directoryEntryPublic) { - if (!scanHeaders(dylib, directoryEntryPublic->getName(), + if (directoryEntryPublicOrError) { + if (!scanHeaders(dylib, directoryEntryPublicOrError.get()->getName(), HeaderType::Public)) return false; } - if (directoryEntryPrivate) { - if (!scanHeaders(dylib, directoryEntryPrivate->getName(), + if (directoryEntryPrivateOrError) { + if (!scanHeaders(dylib, directoryEntryPrivateOrError.get()->getName(), HeaderType::Private)) return false; } @@ -114,10 +113,10 @@ bool DirectoryScanner::scanFrameworksDirectory( std::vector &frameworks, StringRef directory) const { std::error_code ec; - auto &fs = *_fm.getVirtualFileSystem(); + auto &fs = _fm.getVirtualFileSystem(); for (vfs::directory_iterator i = fs.dir_begin(directory, ec), ie; i != ie; i.increment(ec)) { - auto path = i->getName(); + auto path = i->path(); // Skip files that not exist. This usually happens for broken symlinks. if (ec == std::errc::no_such_file_or_directory) { @@ -158,10 +157,10 @@ // there is a Versions directory, then we have symlinks and directly proceed // to the Versiosn folder. std::error_code ec; - auto &fs = *_fm.getVirtualFileSystem(); + auto &fs = _fm.getVirtualFileSystem(); for (vfs::directory_iterator i = fs.dir_begin(framework.getPath(), ec), ie; i != ie; i.increment(ec)) { - auto path = i->getName(); + auto path = i->path(); // Skip files that not exist. This usually happens for broken symlinks. if (ec == std::errc::no_such_file_or_directory) { @@ -232,10 +231,10 @@ bool DirectoryScanner::scanHeaders(Framework &framework, StringRef path, HeaderType type) const { std::error_code ec; - auto &fs = *_fm.getVirtualFileSystem(); + auto &fs = _fm.getVirtualFileSystem(); for (vfs::recursive_directory_iterator i(fs, path, ec), ie; i != ie; i.increment(ec)) { - auto headerPath = i->getName(); + auto headerPath = i->path(); // Skip files that not exist. This usually happens for broken symlinks. if (ec == std::errc::no_such_file_or_directory) { @@ -265,10 +264,10 @@ bool DirectoryScanner::scanModules(Framework &framework, StringRef path) const { std::error_code ec; - auto &fs = *_fm.getVirtualFileSystem(); + auto &fs = _fm.getVirtualFileSystem(); for (vfs::recursive_directory_iterator i(fs, path, ec), ie; i != ie; i.increment(ec)) { - auto path = i->getName(); + auto path = i->path(); // Skip files that not exist. This usually happens for broken symlinks. if (ec == std::errc::no_such_file_or_directory) { @@ -293,10 +292,10 @@ bool DirectoryScanner::scanFrameworkVersionsDirectory(Framework &framework, StringRef path) const { std::error_code ec; - auto &fs = *_fm.getVirtualFileSystem(); + auto &fs = _fm.getVirtualFileSystem(); for (vfs::directory_iterator i = fs.dir_begin(path, ec), ie; i != ie; i.increment(ec)) { - auto path = i->getName(); + auto path = i->path(); // Skip files that not exist. This usually happens for broken symlinks. if (ec == std::errc::no_such_file_or_directory) { @@ -327,10 +326,10 @@ bool DirectoryScanner::scanLibraryDirectory(Framework &framework, StringRef path) const { std::error_code ec; - auto &fs = *_fm.getVirtualFileSystem(); + auto &fs = _fm.getVirtualFileSystem(); for (vfs::recursive_directory_iterator i(fs, path, ec), ie; i != ie; i.increment(ec)) { - auto path = i->getName(); + auto path = i->path(); // Skip files that not exist. This usually happens for broken symlinks. if (ec == std::errc::no_such_file_or_directory) { @@ -456,10 +455,10 @@ // Scan the bundles and extensions in /System/Library. std::error_code ec; - auto &fs = *_fm.getVirtualFileSystem(); + auto &fs = _fm.getVirtualFileSystem(); for (auto i = fs.dir_begin(getDirectory("System/Library"), ec); i != vfs::directory_iterator(); i.increment(ec)) { - auto path = i->getName(); + auto path = i->path(); // Skip files that not exist. This usually happens for broken symlinks. if (ec == std::errc::no_such_file_or_directory) { diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/DriverUtils.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/DriverUtils.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/DriverUtils.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/DriverUtils.cpp 2019-12-12 11:38:49.000000000 -1000 @@ -15,9 +15,9 @@ #include "tapi/Core/FileManager.h" #include "tapi/Core/Utils.h" #include "tapi/Diagnostics/Diagnostics.h" -#include "clang/Basic/VirtualFileSystem.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Path.h" +#include "llvm/Support/VirtualFileSystem.h" using namespace llvm; using namespace clang; @@ -28,10 +28,10 @@ DiagnosticsEngine &diag, StringRef path, HeaderType type) { std::error_code ec; - auto &fs = *fm.getVirtualFileSystem(); + auto &fs = fm.getVirtualFileSystem(); for (vfs::directory_iterator i = fs.dir_begin(path, ec), ie; i != ie; i.increment(ec)) { - auto path = i->getName(); + auto path = i->path(); // Skip files that not exist. This usually happens for broken symlinks. if (ec == std::errc::no_such_file_or_directory) { diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/HeaderGlob.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/HeaderGlob.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/HeaderGlob.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/HeaderGlob.cpp 2019-12-12 11:39:08.000000000 -1000 @@ -77,7 +77,7 @@ auto regex = Regex(regexString); std::string error; if (regex.isValid(error)) - return make_unique(globString, std::move(regex), type); + return std::make_unique(globString, std::move(regex), type); return make_error(error, inconvertibleErrorCode()); } diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/InstallAPIDriver.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/InstallAPIDriver.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/InstallAPIDriver.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/InstallAPIDriver.cpp 2019-12-15 00:11:29.000000000 -1000 @@ -357,10 +357,11 @@ /*STDOUT=*/llvm::None, /*STDERR=*/StringRef(stderrFile)}; - bool failed = sys::ExecuteAndWait(clangBinary.get(), clangArgs, - /*env=*/nullptr, redirects); + std::string *ErrMsg=nullptr; + bool *ExecutionFailed; + sys::ExecuteAndWait(clangBinary.get(), llvm::toStringRefArray(clangArgs), /*env=*/NoneType::None, redirects, 0, 0, ErrMsg, ExecutionFailed); - if (failed) { + if (ExecutionFailed) { auto bufferOr = MemoryBuffer::getFile(stderrFile); if (auto ec = bufferOr.getError()) return make_error("unable to read file", ec); @@ -498,7 +499,7 @@ FrontendJob job; job.workingDirectory = globalSnapshot->getWorkingDirectory(); job.cacheFactory = newFileSystemStatCacheFactory(); - job.vfs = fm.getVirtualFileSystem(); + job.vfs = &fm.getVirtualFileSystem(); job.language = opts.frontendOptions.language; job.language_std = opts.frontendOptions.language_std; job.useRTTI = opts.frontendOptions.useRTTI; @@ -522,11 +523,12 @@ return false; } - const FileEntry *jsonFile = nullptr; + const clang::FileEntry *jsonFile = nullptr; + //const FileEntry *jsonFile = nullptr; for (const auto &path : opts.driverOptions.inputs) { if (sys::path::extension(path) == ".json") { - if (auto *file = fm.getFile(path)) { - jsonFile = file; + if (auto file = fm.getFile(path)) { + jsonFile = file.get(); break; } } @@ -545,7 +547,7 @@ for (const auto &path : opts.driverOptions.inputs) { if (fm.isDirectory(path, /*CacheFailure=*/false)) { SmallString normalizedPath(path); - fm.getVirtualFileSystem()->makeAbsolute(normalizedPath); + fm.getVirtualFileSystem().makeAbsolute(normalizedPath); sys::path::remove_dots(normalizedPath, /*remove_dot_dot=*/true); if (!scanner.scan(normalizedPath, frameworks)) return false; @@ -578,7 +580,7 @@ frameworkName = sys::path::stem(framework->getName()); for (const auto &header : framework->_headerFiles) { - auto *file = fm.getFile(header.fullPath); + auto file = fm.getFile(header.fullPath); if (!file) { if (header.type == HeaderType::Public) diag.report(diag::err_no_such_public_header_file) << header.fullPath; @@ -598,7 +600,7 @@ } } else { Registry registry; - auto reader = make_unique(); + auto reader = std::make_unique(); reader->add(std::unique_ptr( new json_file::v1::YAMLDocumentHandler)); registry.add(std::move(reader)); @@ -665,8 +667,8 @@ excludeHeaderGlobs.emplace_back(std::move(glob.get())); else { consumeError(glob.takeError()); - if (auto file = fm.getFile(str)) - excludeHeaderFiles.emplace(file); + if (auto fileOrErr = fm.getFile(str)) + excludeHeaderFiles.emplace(fileOrErr.get()); else { diag.report(diagID) << str; return false; @@ -692,9 +694,13 @@ if (!excludeHeaderFiles.empty()) { for (auto &header : headerFiles) { - const auto *file = fm.getFile(header.fullPath); - if (excludeHeaderFiles.count(file)) - header.isExcluded = true; + const auto fileOrError = fm.getFile(header.fullPath); + if (fileOrError) { + const auto file = fileOrError.get(); + + if (excludeHeaderFiles.count(file)) + header.isExcluded = true; + } } } @@ -806,13 +812,13 @@ } } - auto headerSymbols = make_unique(); + auto headerSymbols = std::make_unique(); for (auto &result : frontendResults) { API2XPIConverter converter(headerSymbols.get(), result.target); result.visit(converter); } - auto scanFile = make_unique(std::move(headerSymbols)); + auto scanFile = std::make_unique(std::move(headerSymbols)); if (opts.tapiOptions.printAfter == "xpi") scanFile->printSymbols(ArchitectureSet::All()); @@ -911,7 +917,7 @@ return false; } - auto interface = make_unique(std::move(*scanFile.get())); + auto interface = std::make_unique(std::move(*scanFile.get())); auto result = manager.writeFile(interface.get(), opts.driverOptions.outputPath); if (result) { diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/Options.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/Options.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/Options.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/Options.cpp 2019-12-15 00:12:16.000000000 -1000 @@ -18,13 +18,13 @@ #include "tapi/Driver/StatRecorder.h" #include "tapi/LinkerInterfaceFile.h" #include "clang/Basic/Version.inc" -#include "clang/Basic/VirtualFileSystem.h" #include "clang/Config/config.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include "llvm/Option/ArgList.h" #include "llvm/Option/OptSpecifier.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/VirtualFileSystem.h" #include #include @@ -706,14 +706,14 @@ // Handle language option. if (auto *arg = args.getLastArg(OPT_x)) { frontendOptions.language = - StringSwitch(arg->getValue()) - .Case("c", clang::InputKind::C) - .Case("c++", clang::InputKind::CXX) - .Case("objective-c", clang::InputKind::ObjC) - .Case("objective-c++", clang::InputKind::ObjCXX) - .Default(clang::InputKind::Unknown); + StringSwitch(arg->getValue()) + .Case("c", clang::Language::C) + .Case("c++", clang::Language::CXX) + .Case("objective-c", clang::Language::ObjC) + .Case("objective-c++", clang::Language::ObjCXX) + .Default(clang::Language::Unknown); - if (frontendOptions.language == clang::InputKind::Unknown) { + if (frontendOptions.language == clang::Language::Unknown) { diag.report(clang::diag::err_drv_invalid_value) << arg->getAsString(args) << arg->getValue(); return false; @@ -723,9 +723,9 @@ // Handle ObjC/ObjC++ switch. for (auto *arg : args.filtered(OPT_ObjC, OPT_ObjCXX)) { if (arg->getOption().matches(OPT_ObjC)) - frontendOptions.language = clang::InputKind::ObjC; + frontendOptions.language = clang::Language::ObjC; else - frontendOptions.language = clang::InputKind::ObjCXX; + frontendOptions.language = clang::Language::ObjCXX; } // Handle language std. @@ -983,7 +983,7 @@ SmallString srcPath(header); // Normalize path. - if (fm.getVirtualFileSystem()->makeAbsolute(externalPath)) + if (fm.getVirtualFileSystem().makeAbsolute(externalPath)) return; sys::path::remove_dots(externalPath, /*remove_dot_dot=*/true); sys::path::replace_path_prefix(srcPath, clangResourcePath, @@ -1052,7 +1052,7 @@ globalSnapshot->requestSnapshot(); globalSnapshot->setWorkingDirectory( - fm->getVirtualFileSystem()->getCurrentWorkingDirectory().get()); + fm->getVirtualFileSystem().getCurrentWorkingDirectory().get()); } // This has to happen after processing the snapshot options, but before all diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/ReexportDriver.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/ReexportDriver.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/ReexportDriver.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/ReexportDriver.cpp 2019-12-15 00:12:54.000000000 -1000 @@ -95,13 +95,13 @@ frontendResults.emplace_back(std::move(result.getValue())); } - auto headerSymbols = make_unique(); + auto headerSymbols = std::make_unique(); for (auto &result : frontendResults) { API2XPIConverter converter(headerSymbols.get(), result.target); result.visit(converter); } - auto scanFile = make_unique(std::move(headerSymbols)); + auto scanFile = std::make_unique(std::move(headerSymbols)); scanFile->setFileType(FileType::ReexportFile); scanFile->setArchitectures( mapToArchitectureSet(opts.frontendOptions.targets)); diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/Snapshot.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/Snapshot.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/Snapshot.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/Snapshot.cpp 2019-12-15 22:10:42.000000000 -1000 @@ -22,7 +22,6 @@ using namespace llvm; using namespace TAPI_INTERNAL; -using clang::InputKind; using Mapping = std::pair; using Reexports = std::pair; @@ -125,7 +124,7 @@ static void mapping(IO &io, DriverOptions &opts) { io.mapOptional("print-version", opts.printVersion, false); io.mapOptional("print-help", opts.printHelp, false); - io.mapOptional("inputs", opts.inputs, {}); + io.mapOptional("inputs", opts.inputs, (PathSeq){}); io.mapOptional("output-path", opts.outputPath, std::string()); } }; @@ -147,11 +146,11 @@ io.mapOptional("compatibility-version", opts.compatibilityVersion, PackedVersion()); io.mapOptional("is-dynamic-library", opts.isDynamicLibrary, false); - io.mapOptional("allowable-clients", opts.allowableClients, {}); - io.mapOptional("reexported-libraries", opts.reexportInstallNames, {}); - io.mapOptional("reexported-libraries2", opts.reexportedLibraries, {}); - io.mapOptional("reexported-library-paths", opts.reexportedLibraryPaths, {}); - io.mapOptional("reexported-frameworks", opts.reexportedFrameworks, {}); + io.mapOptional("allowable-clients", opts.allowableClients, (__typeof__(opts.allowableClients)){}); + io.mapOptional("reexported-libraries", opts.reexportInstallNames, (__typeof__(opts.reexportInstallNames)){}); + io.mapOptional("reexported-libraries2", opts.reexportedLibraries, (__typeof__(opts.reexportedLibraries)){}); + io.mapOptional("reexported-library-paths", opts.reexportedLibraryPaths, (__typeof__(opts.reexportedLibraryPaths)){}); + io.mapOptional("reexported-frameworks", opts.reexportedFrameworks, (__typeof__(opts.reexportedFrameworks)){}); io.mapOptional("is-application-extension-safe", opts.isApplicationExtensionSafe, false); } @@ -164,17 +163,17 @@ Snapshot::MappingContext &ctx) { io.mapOptional("platform", ctx.platform, Platform::unknown); io.mapOptional("os-version", ctx.osVersion, std::string()); - io.mapOptional("targets", opts.targets, {}); - io.mapOptional("language", opts.language, InputKind::ObjC); + io.mapOptional("targets", opts.targets, (__typeof__(opts.targets)){}); + io.mapOptional("language", opts.language, clang::Language::ObjC); io.mapOptional("language-std", opts.language_std, std::string()); io.mapOptional("isysroot", opts.isysroot, std::string()); io.mapOptional("umbrella", opts.umbrella, std::string()); - io.mapOptional("system-framework-paths", opts.systemFrameworkPaths, {}); - io.mapOptional("system-include-paths", opts.systemIncludePaths, {}); - io.mapOptional("framework-paths", opts.frameworkPaths, {}); - io.mapOptional("library-paths", opts.libraryPaths, {}); - io.mapOptional("include-paths", opts.includePaths, {}); - io.mapOptional("macros", opts.macros, {}); + io.mapOptional("system-framework-paths", opts.systemFrameworkPaths, (__typeof__(opts.systemFrameworkPaths)){}); + io.mapOptional("system-include-paths", opts.systemIncludePaths, (__typeof__(opts.systemIncludePaths)){}); + io.mapOptional("framework-paths", opts.frameworkPaths, (__typeof__(opts.frameworkPaths)){}); + io.mapOptional("library-paths", opts.libraryPaths, (__typeof__(opts.libraryPaths)){}); + io.mapOptional("include-paths", opts.includePaths, (__typeof__(opts.includePaths)){}); + io.mapOptional("macros", opts.macros, (__typeof__(opts.macros)){}); io.mapOptional("use-rtti", opts.useRTTI, true); io.mapOptional("visibility", opts.visibility, std::string()); io.mapOptional("enable-modules", opts.enableModules, false); @@ -183,7 +182,7 @@ false); io.mapOptional("use-objc-arc", opts.useObjectiveCARC, false); io.mapOptional("use-objc-weak", opts.useObjectiveCWeakARC, false); - io.mapOptional("clang-extra-args", opts.clangExtraArgs, {}); + io.mapOptional("clang-extra-args", opts.clangExtraArgs, (__typeof__(opts.clangExtraArgs)){}); io.mapOptional("clang-resource-path", opts.clangResourcePath, std::string()); } @@ -205,10 +204,10 @@ std::string()); io.mapOptional("private-umbrella-header-path", opts.privateUmbrellaHeaderPath, std::string()); - io.mapOptional("extra-public-headers", opts.extraPublicHeaders, {}); - io.mapOptional("extra-private-headers", opts.extraPrivateHeaders, {}); - io.mapOptional("exclude-public-headers", opts.excludePublicHeaders, {}); - io.mapOptional("exclude-private-headers", opts.excludePrivateHeaders, {}); + io.mapOptional("extra-public-headers", opts.extraPublicHeaders, (__typeof__(opts.extraPublicHeaders)){}); + io.mapOptional("extra-private-headers", opts.extraPrivateHeaders, (__typeof__(opts.extraPrivateHeaders)){}); + io.mapOptional("exclude-public-headers", opts.excludePublicHeaders, (__typeof__(opts.excludePublicHeaders)){}); + io.mapOptional("exclude-private-headers", opts.excludePrivateHeaders, (__typeof__(opts.excludePrivateHeaders)){}); io.mapOptional("verify-against", opts.verifyAgainst, std::string()); io.mapOptional("verification-mode", opts.verificationMode, VerificationMode::ErrorsOnly); diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/SnapshotFileSystem.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/SnapshotFileSystem.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/SnapshotFileSystem.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/SnapshotFileSystem.cpp 2019-12-15 23:44:31.000000000 -1000 @@ -79,7 +79,7 @@ return status; } // directory auto *directory = cast(entry); - return Status::copyWithNewName(directory->getStatus(), path.str()); + return Status::copyWithNewName(directory->getStatus(), path); } ErrorOr SnapshotFileSystem::status(const Twine &path) { @@ -125,7 +125,7 @@ }; } // end anonymous namespace -ErrorOr> +ErrorOr> SnapshotFileSystem::openFileForRead(const Twine &path) { auto result = lookupPath(path); if (auto ec = result.getError()) @@ -145,10 +145,10 @@ auto status = getFileStatus(path, *externalStatus); return std::unique_ptr( - make_unique(std::move(*result2), status)); + std::make_unique(std::move(*result2), status)); } -class SnapshotDirIterImpl : public clang::vfs::detail::DirIterImpl { +class SnapshotDirIterImpl : public llvm::vfs::detail::DirIterImpl { std::string dir; SnapshotFileSystem &fs; SnapshotFileSystem::DirectoryEntry::iterator current, end; @@ -169,13 +169,29 @@ if ((ec = result.getError())) return; - CurrentEntry = *result; + sys::fs::file_type Type; + switch ((*current)->getKind()) { + case SnapshotFileSystem::EntryKind::Directory: + Type = sys::fs::file_type::directory_file; + break; + case SnapshotFileSystem::EntryKind::File: + Type = sys::fs::file_type::regular_file; + break; + } + + CurrentEntry = llvm::vfs::directory_entry(path.str(), Type); } std::error_code increment() override { + sys::fs::file_type Type; if (++current == end) { - CurrentEntry = Status(); - return {}; + if (Status().isDirectory()) + Type = sys::fs::file_type::directory_file; + else + Type = sys::fs::file_type::regular_file; + + CurrentEntry = llvm::vfs::directory_entry(Status().getName().str(), Type); + return {}; } SmallString path(dir); @@ -184,7 +200,16 @@ if (auto ec = result.getError()) return ec; - CurrentEntry = *result; + switch ((*current)->getKind()) { + case SnapshotFileSystem::EntryKind::Directory: + Type = sys::fs::file_type::directory_file; + break; + case SnapshotFileSystem::EntryKind::File: + Type = sys::fs::file_type::regular_file; + break; + } + + CurrentEntry = llvm::vfs::directory_entry(path.str(), Type); return {}; } }; @@ -236,7 +261,7 @@ if (auto ec = directory.getError()) return ec; return cast(directory.get()->addContent( - make_unique(filename, externalPath))); + std::make_unique(filename, externalPath))); } ErrorOr @@ -252,7 +277,7 @@ return cast(entry.get()); } return cast( - current->addContent(make_unique(name))); + current->addContent(std::make_unique(name))); } ErrorOr diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/StubDriver.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/StubDriver.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Driver/StubDriver.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Driver/StubDriver.cpp 2019-12-15 00:18:30.000000000 -1000 @@ -142,7 +142,7 @@ std::shared_ptr reexportedDylib; auto *file2 = file.get().release(); if (auto *extended = dyn_cast(file2)) - reexportedDylib = make_unique(std::move(*extended)); + reexportedDylib = std::make_unique(std::move(*extended)); else reexportedDylib = std::unique_ptr(cast(file2)); @@ -232,11 +232,13 @@ } static bool stubifyDynamicLibrary(Context &ctx) { - const auto *inputFile = ctx.fm.getFile(ctx.inputPath); - if (!inputFile) { - ctx.diag.report(clang::diag::err_drv_no_such_file) << ctx.inputPath; + const auto inputFileOrErr = ctx.fm.getFile(ctx.inputPath); + if (auto ec = inputFileOrErr.getError()) { + ctx.diag.report(clang::diag::err_drv_no_such_file) + << ctx.inputPath << ec.message();; return false; } + const auto *inputFile = inputFileOrErr.get(); auto bufferOrErr = ctx.fm.getBufferForFile(inputFile); if (auto ec = bufferOrErr.getError()) { ctx.diag.report(diag::err_cannot_read_file) @@ -264,7 +266,7 @@ std::unique_ptr interface; auto *file2 = file.get().release(); if (auto *extended = dyn_cast(file2)) - interface = make_unique(std::move(*extended)); + interface = std::make_unique(std::move(*extended)); else interface = std::unique_ptr(cast(file2)); @@ -422,9 +424,10 @@ } // We only have to look at files. - auto *file = ctx.fm.getFile(path); - if (!file) + auto fileOrErr = ctx.fm.getFile(path); + if (!fileOrErr) continue; + auto *file = fileOrErr.get(); if (ctx.deletePrivateFrameworks && isPrivatePath(path.drop_front(ctx.inputPath.size()))) { @@ -458,7 +461,7 @@ std::unique_ptr interface; auto *file3 = file2.get().release(); if (auto *extended = dyn_cast(file3)) - interface = make_unique(std::move(*extended)); + interface = std::make_unique(std::move(*extended)); else interface = std::unique_ptr(cast(file3)); diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Frontend/APIVisitor.h llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Frontend/APIVisitor.h --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Frontend/APIVisitor.h 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Frontend/APIVisitor.h 2019-12-12 10:08:30.000000000 -1000 @@ -96,7 +96,7 @@ context.ast = &compiler.getASTContext(); context.sourceMgr = &compiler.getSourceManager(); context.pp = compiler.getPreprocessorPtr(); - return llvm::make_unique(context); + return std::make_unique(context); } FrontendContext &context; diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Frontend/Frontend.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Frontend/Frontend.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Frontend/Frontend.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Frontend/Frontend.cpp 2019-12-12 10:54:15.000000000 -1000 @@ -35,32 +35,32 @@ TAPI_NAMESPACE_INTERNAL_BEGIN -static StringRef getLanguageOptions(clang::InputKind::Language lang) { +static StringRef getLanguageOptions(clang::Language lang) { switch (lang) { default: return ""; - case clang::InputKind::C: + case clang::Language::C: return "-xc"; - case clang::InputKind::CXX: + case clang::Language::CXX: return "-xc++"; - case clang::InputKind::ObjC: + case clang::Language::ObjC: return "-xobjective-c"; - case clang::InputKind::ObjCXX: + case clang::Language::ObjCXX: return "-xobjective-c++"; } } -static StringRef getFileExtension(clang::InputKind::Language lang) { +static StringRef getFileExtension(clang::Language lang) { switch (lang) { default: llvm_unreachable("Unexpected language option."); - case clang::InputKind::C: + case clang::Language::C: return ".c"; - case clang::InputKind::CXX: + case clang::Language::CXX: return ".cpp"; - case clang::InputKind::ObjC: + case clang::Language::ObjC: return ".m"; - case clang::InputKind::ObjCXX: + case clang::Language::ObjCXX: return ".mm"; } } @@ -72,7 +72,7 @@ } static void addHeaderInclude(StringRef headerName, - clang::InputKind::Language lang, + clang::Language lang, SmallVectorImpl &includes) { SmallString name; if (!(headerName.startswith("\"") && headerName.endswith("\"")) && @@ -83,7 +83,7 @@ } else name += headerName; - if (lang == clang::InputKind::C || lang == clang::InputKind::CXX) + if (lang == clang::Language::C || lang == clang::Language::CXX) includes += "#include "; else includes += "#import "; @@ -118,9 +118,7 @@ const opt::ArgStringList &cc1Args) { assert(!cc1Args.empty() && "Must at least contain the program name!"); CompilerInvocation *invocation = new CompilerInvocation; - CompilerInvocation::CreateFromArgs(*invocation, cc1Args.data() + 1, - cc1Args.data() + cc1Args.size(), - *diagnostics); + CompilerInvocation::CreateFromArgs(*invocation, cc1Args, *diagnostics); invocation->getFrontendOpts().DisableFree = false; invocation->getCodeGenOpts().DisableFree = false; return invocation; @@ -128,10 +126,10 @@ static bool runClang(FrontendContext &context, ArrayRef options, std::unique_ptr input) { - context.compiler = make_unique(); + context.compiler = std::make_unique(); IntrusiveRefCntPtr diagID(new DiagnosticIDs()); IntrusiveRefCntPtr diagOpts(new DiagnosticOptions()); - std::unique_ptr opts = driver::createDriverOptTable(); + const llvm::opt::OptTable *opts = &driver::getDriverOptTable(); std::vector argv; for (const std::string &str : options) @@ -146,9 +144,10 @@ DiagnosticsEngine diagnosticsEngine(diagID, &*diagOpts, &diagnosticPrinter, false); + IntrusiveRefCntPtr VFS(&(context.fileManager->getVirtualFileSystem())); const std::unique_ptr driver(new clang::driver::Driver( binaryName, llvm::sys::getDefaultTargetTriple(), diagnosticsEngine, - context.fileManager->getVirtualFileSystem())); + VFS)); driver->setTitle("tapi"); // Since the input might only be virtual, don't check whether it exists. driver->setCheckInputsExist(false); @@ -178,7 +177,7 @@ // Create a compiler instance to handle the actual work. context.compiler->setInvocation(std::move(invocation)); context.compiler->setFileManager(&*(context.fileManager)); - auto action = make_unique(context); + auto action = std::make_unique(context); // Create the compiler's actual diagnostics engine. context.compiler->createDiagnostics(); @@ -210,8 +209,11 @@ : header.includeName, job.language, headerContents); - const auto *file = context.fileManager->getFile(header.fullPath); - context.files.emplace(file, header.type); + auto fileOrError = context.fileManager->getFile(header.fullPath); + if (fileOrError) { + const auto *file = fileOrError.get(); + context.files.emplace(file, header.type); + } } inputFilePath = @@ -219,8 +221,11 @@ input = llvm::MemoryBuffer::getMemBufferCopy(headerContents, inputFilePath); } else { inputFilePath = inputFilename; - const auto *file = context.fileManager->getFile(inputFilename); - context.files.emplace(file, HeaderType::Public); + auto fileOrErr = context.fileManager->getFile(inputFilename); + if (fileOrErr) { + const auto *file = fileOrErr.get(); + context.files.emplace(file, HeaderType::Public); + } } std::vector args; @@ -300,8 +305,8 @@ } // For c++ and objective-c++, add default stdlib to be libc++. - if (job.language == clang::InputKind::CXX || - job.language == clang::InputKind::ObjCXX) + if (job.language == clang::Language::CXX || + job.language == clang::Language::ObjCXX) args.emplace_back("-stdlib=libc++"); // Add extra clang arguments. diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Frontend/FrontendContext.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Frontend/FrontendContext.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/lib/Frontend/FrontendContext.cpp 2019-03-22 10:58:37.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/lib/Frontend/FrontendContext.cpp 2019-12-12 10:55:00.000000000 -1000 @@ -19,7 +19,7 @@ FrontendContext::FrontendContext( StringRef workingDirectory, IntrusiveRefCntPtr cacheFactory, - IntrusiveRefCntPtr vfs) { + IntrusiveRefCntPtr vfs) { fileManager = new FileManager(clang::FileSystemOptions{workingDirectory}, cacheFactory, vfs); } diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/tools/CMakeLists.txt llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/tools/CMakeLists.txt --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/tools/CMakeLists.txt 2019-12-16 00:04:41.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/tools/CMakeLists.txt 2019-12-12 10:57:11.000000000 -1000 @@ -1,4 +1,4 @@ add_subdirectory(libtapi) add_subdirectory(tapi) -add_subdirectory(tapi-run) +#add_subdirectory(tapi-run) add_subdirectory(tapi-frontend) diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/tools/libtapi/CMakeLists.txt llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/tools/libtapi/CMakeLists.txt --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/tools/libtapi/CMakeLists.txt 2019-12-16 00:04:41.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/tools/libtapi/CMakeLists.txt 2019-05-30 08:01:05.000000000 -1000 @@ -20,10 +20,12 @@ OUTPUT_NAME "tapi" ) +if(APPLE) + set(DYLIB_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}") set_property(TARGET libtapi APPEND_STRING PROPERTY - LINK_FLAGS " -current_version ${DYLIB_VERSION} -compatibility_version 1 -allowable_client ld" + LINK_FLAGS " -current_version ${DYLIB_VERSION} -compatibility_version 1 " #-allowable_client ld" ) if(LINKER_SUPPORTS_NO_INITS) @@ -32,3 +34,6 @@ LINK_FLAGS " -Wl,-no_inits" ) endif() + +endif() + diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/tools/libtapi/LinkerInterfaceFile.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/tools/libtapi/LinkerInterfaceFile.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/tools/libtapi/LinkerInterfaceFile.cpp 2019-12-16 00:04:41.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/tools/libtapi/LinkerInterfaceFile.cpp 2019-12-12 09:56:14.000000000 -1000 @@ -298,6 +298,10 @@ return Platform::tvOS; case tapi::internal::Platform::bridgeOS: return Platform::bridgeOS; + case tapi::internal::Platform::iOSMac: + return Platform::iOSMac; + case tapi::internal::Platform::zippered: + return Platform::zippered; } } diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/tools/libtapi/libtapi.cpp llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/tools/libtapi/libtapi.cpp --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/tools/libtapi/libtapi.cpp 2019-12-16 00:04:41.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/tools/libtapi/libtapi.cpp 2019-05-30 08:01:05.000000000 -1000 @@ -47,12 +47,16 @@ namespace sys { +#ifdef __APPLE__ + bool RemoveFileOnSignal(StringRef Filename, std::string *ErrMsg) { abort(); } void DontRemoveFileOnSignal(StringRef Filename) { abort(); } void AddSignalHandler(void (*)(void *), void *) { abort(); } +#endif + } // end namespace sys. } // end namespace llvm. diff -ur llvm-project-apple-stable-20191106/llvm/projects/libtapi/tools/tapi/CMakeLists.txt llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/tools/tapi/CMakeLists.txt --- llvm-project-apple-stable-20191106/llvm/projects/libtapi/tools/tapi/CMakeLists.txt 2019-12-16 00:04:41.000000000 -1000 +++ llvm-project-apple-stable-20191106+arm64e/llvm/projects/libtapi/tools/tapi/CMakeLists.txt 2019-12-12 11:05:56.000000000 -1000 @@ -15,9 +15,9 @@ tapi.cpp ) -target_link_libraries(tapi +target_link_libraries(tapi PRIVATE tapiDriver ) add_dependencies(tapi tapi-clang-headers)