From af732203b8f7f006927528db5497f5cbc4c4742a Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 13 Jun 2021 21:31:46 +0200 Subject: Merge llvm-project 12.0.1 release and follow-up fixes Merge llvm-project main llvmorg-12-init-17869-g8e464dd76bef This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12-init-17869-g8e464dd76bef, the last commit before the upstream release/12.x branch was created. PR: 255570 (cherry picked from commit e8d8bef961a50d4dc22501cde4fb9fb0be1b2532) Merge llvm-project 12.0.0 release This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12.0.0-0-gd28af7c654d8, a.k.a. 12.0.0 release. PR: 255570 (cherry picked from commit d409305fa3838fb39b38c26fc085fb729b8766d5) Disable strict-fp for powerpcspe, as it does not work properly yet Merge commit 5c18d1136665 from llvm git (by Qiu Chaofan) [SPE] Disable strict-fp for SPE by default As discussed in PR50385, strict-fp on PowerPC SPE has not been handled well. This patch disables it by default for SPE. Reviewed By: nemanjai, vit9696, jhibbits Differential Revision: https://reviews.llvm.org/D103235 PR: 255570 (cherry picked from commit 715df83abc049b23d9acddc81f2480bd4c056d64) Apply upstream libc++ fix to allow building with devel/xxx-xtoolchain-gcc Merge commit 52e9d80d5db2 from llvm git (by Jason Liu): [libc++] add `inline` for __open's definition in ifstream and ofstream Summary: When building with gcc on AIX, it seems that gcc does not like the `always_inline` without the `inline` keyword. So adding the inline keywords in for __open in ifstream and ofstream. That will also make it consistent with __open in basic_filebuf (it seems we added `inline` there before for gcc build as well). Differential Revision: https://reviews.llvm.org/D99422 PR: 255570 (cherry picked from commit d099db25464b826c5724cf2fb5b22292bbe15f6e) Undefine HAVE_(DE)REGISTER_FRAME in llvm's config.h on arm Otherwise, the lli tool (enable by WITH_CLANG_EXTRAS) won't link on arm, stating that __register_frame is undefined. This function is normally provided by libunwind, but explicitly not for the ARM Exception ABI. Reported by: oh PR: 255570 (cherry picked from commit f336b45e943c7f9a90ffcea1a6c4c7039e54c73c) Merge llvm-project 12.0.1 rc2 This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12.0.1-rc2-0-ge7dac564cd0e, a.k.a. 12.0.1 rc2. PR: 255570 (cherry picked from commit 23408297fbf3089f0388a8873b02fa75ab3f5bb9) Revert libunwind change to fix backtrace segfault on aarch64 Revert commit 22b615a96593 from llvm git (by Daniel Kiss): [libunwind] Support for leaf function unwinding. Unwinding leaf function is useful in cases when the backtrace finds a leaf function for example when it caused a signal. This patch also add the support for the DW_CFA_undefined because it marks the end of the frames. Ryan Prichard provided code for the tests. Reviewed By: #libunwind, mstorsjo Differential Revision: https://reviews.llvm.org/D83573 Reland with limit the test to the x86_64-linux target. Bisection has shown that this particular upstream commit causes programs using backtrace(3) on aarch64 to segfault. This affects the lang/rust port, for instance. Until we can upstream to fix this problem, revert the commit for now. Reported by: mikael PR: 256864 (cherry picked from commit 5866c369e4fd917c0d456f0f10b92ee354b82279) Merge llvm-project 12.0.1 release This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12.0.1-0-gfed41342a82f, a.k.a. 12.0.1 release. PR: 255570 (cherry picked from commit 4652422eb477731f284b1345afeefef7f269da50) compilert-rt: build out-of-line LSE atomics helpers for aarch64 Both clang >= 12 and gcc >= 10.1 now default to -moutline-atomics for aarch64. This requires a bunch of helper functions in libcompiler_rt.a, to avoid link errors like "undefined symbol: __aarch64_ldadd8_acq_rel". (Note: of course you can use -mno-outline-atomics as a workaround too, but this would negate the potential performance benefit of the faster LSE instructions.) Bump __FreeBSD_version so ports maintainers can easily detect this. PR: 257392 (cherry picked from commit cc55ee8009a550810d38777fd6ace9abf3a2f6b4) --- contrib/llvm-project/clang/lib/Lex/ModuleMap.cpp | 76 +++++++++++------------- 1 file changed, 36 insertions(+), 40 deletions(-) (limited to 'contrib/llvm-project/clang/lib/Lex/ModuleMap.cpp') diff --git a/contrib/llvm-project/clang/lib/Lex/ModuleMap.cpp b/contrib/llvm-project/clang/lib/Lex/ModuleMap.cpp index bcdc5b8062a0..bbda1f15a702 100644 --- a/contrib/llvm-project/clang/lib/Lex/ModuleMap.cpp +++ b/contrib/llvm-project/clang/lib/Lex/ModuleMap.cpp @@ -171,23 +171,23 @@ static void appendSubframeworkPaths(Module *Mod, llvm::sys::path::append(Path, "Frameworks", Paths[I-1] + ".framework"); } -const FileEntry *ModuleMap::findHeader( +Optional ModuleMap::findHeader( Module *M, const Module::UnresolvedHeaderDirective &Header, SmallVectorImpl &RelativePathName, bool &NeedsFramework) { // Search for the header file within the module's home directory. auto *Directory = M->Directory; SmallString<128> FullPathName(Directory->getName()); - auto GetFile = [&](StringRef Filename) -> const FileEntry * { - auto File = SourceMgr.getFileManager().getFile(Filename); - if (!File || - (Header.Size && (*File)->getSize() != *Header.Size) || - (Header.ModTime && (*File)->getModificationTime() != *Header.ModTime)) - return nullptr; + auto GetFile = [&](StringRef Filename) -> Optional { + auto File = + expectedToOptional(SourceMgr.getFileManager().getFileRef(Filename)); + if (!File || (Header.Size && File->getSize() != *Header.Size) || + (Header.ModTime && File->getModificationTime() != *Header.ModTime)) + return None; return *File; }; - auto GetFrameworkFile = [&]() -> const FileEntry * { + auto GetFrameworkFile = [&]() -> Optional { unsigned FullPathLength = FullPathName.size(); appendSubframeworkPaths(M, RelativePathName); unsigned RelativePathLength = RelativePathName.size(); @@ -195,7 +195,7 @@ const FileEntry *ModuleMap::findHeader( // Check whether this file is in the public headers. llvm::sys::path::append(RelativePathName, "Headers", Header.FileName); llvm::sys::path::append(FullPathName, RelativePathName); - if (auto *File = GetFile(FullPathName)) + if (auto File = GetFile(FullPathName)) return File; // Check whether this file is in the private headers. @@ -227,7 +227,7 @@ const FileEntry *ModuleMap::findHeader( // Lookup for normal headers. llvm::sys::path::append(RelativePathName, Header.FileName); llvm::sys::path::append(FullPathName, RelativePathName); - auto *NormalHdrFile = GetFile(FullPathName); + auto NormalHdrFile = GetFile(FullPathName); if (!NormalHdrFile && Directory->getName().endswith(".framework")) { // The lack of 'framework' keyword in a module declaration it's a simple @@ -241,7 +241,7 @@ const FileEntry *ModuleMap::findHeader( << Header.FileName << M->getFullModuleName(); NeedsFramework = true; } - return nullptr; + return None; } return NormalHdrFile; @@ -251,18 +251,18 @@ void ModuleMap::resolveHeader(Module *Mod, const Module::UnresolvedHeaderDirective &Header, bool &NeedsFramework) { SmallString<128> RelativePathName; - if (const FileEntry *File = + if (Optional File = findHeader(Mod, Header, RelativePathName, NeedsFramework)) { if (Header.IsUmbrella) { - const DirectoryEntry *UmbrellaDir = File->getDir(); + const DirectoryEntry *UmbrellaDir = &File->getDir().getDirEntry(); if (Module *UmbrellaMod = UmbrellaDirs[UmbrellaDir]) Diags.Report(Header.FileNameLoc, diag::err_mmap_umbrella_clash) << UmbrellaMod->getFullModuleName(); else // Record this umbrella header. - setUmbrellaHeader(Mod, File, RelativePathName.str()); + setUmbrellaHeader(Mod, *File, RelativePathName.str()); } else { - Module::Header H = {std::string(RelativePathName.str()), File}; + Module::Header H = {std::string(RelativePathName.str()), *File}; if (Header.Kind == Module::HK_Excluded) excludeHeader(Mod, H); else @@ -300,7 +300,7 @@ bool ModuleMap::resolveAsBuiltinHeader( // supplied by Clang. Find that builtin header. SmallString<128> Path; llvm::sys::path::append(Path, BuiltinIncludeDir->getName(), Header.FileName); - auto File = SourceMgr.getFileManager().getFile(Path); + auto File = SourceMgr.getFileManager().getOptionalFileRef(Path); if (!File) return false; @@ -1012,7 +1012,7 @@ Module *ModuleMap::inferFrameworkModule(const DirectoryEntry *FrameworkDir, // Look for an umbrella header. SmallString<128> UmbrellaName = StringRef(FrameworkDir->getName()); llvm::sys::path::append(UmbrellaName, "Headers", ModuleName + ".h"); - auto UmbrellaHeader = FileMgr.getFile(UmbrellaName); + auto UmbrellaHeader = FileMgr.getOptionalFileRef(UmbrellaName); // FIXME: If there's no umbrella header, we could probably scan the // framework to load *everything*. But, it's not clear that this is a good @@ -1121,23 +1121,21 @@ Module *ModuleMap::createShadowedModule(StringRef Name, bool IsFramework, return Result; } -void ModuleMap::setUmbrellaHeader(Module *Mod, const FileEntry *UmbrellaHeader, +void ModuleMap::setUmbrellaHeader(Module *Mod, FileEntryRef UmbrellaHeader, Twine NameAsWritten) { Headers[UmbrellaHeader].push_back(KnownHeader(Mod, NormalHeader)); - Mod->Umbrella = UmbrellaHeader; - Mod->HasUmbrellaDir = false; + Mod->Umbrella = &UmbrellaHeader.getMapEntry(); Mod->UmbrellaAsWritten = NameAsWritten.str(); - UmbrellaDirs[UmbrellaHeader->getDir()] = Mod; + UmbrellaDirs[UmbrellaHeader.getDir()] = Mod; // Notify callbacks that we just added a new header. for (const auto &Cb : Callbacks) Cb->moduleMapAddUmbrellaHeader(&SourceMgr.getFileManager(), UmbrellaHeader); } -void ModuleMap::setUmbrellaDir(Module *Mod, const DirectoryEntry *UmbrellaDir, +void ModuleMap::setUmbrellaDir(Module *Mod, DirectoryEntryRef UmbrellaDir, Twine NameAsWritten) { - Mod->Umbrella = UmbrellaDir; - Mod->HasUmbrellaDir = true; + Mod->Umbrella = &UmbrellaDir.getMapEntry(); Mod->UmbrellaAsWritten = NameAsWritten.str(); UmbrellaDirs[UmbrellaDir] = Mod; } @@ -1903,18 +1901,16 @@ void ModuleMapParser::parseModuleDecl() { continue; } - if (ActiveModule) { - Diags.Report(Id[I].second, diag::err_mmap_missing_module_qualified) - << Id[I].first - << ActiveModule->getTopLevelModule()->getFullModuleName(); - } else { - Diags.Report(Id[I].second, diag::err_mmap_expected_module_name); - } + Diags.Report(Id[I].second, diag::err_mmap_missing_parent_module) + << Id[I].first << (ActiveModule != nullptr) + << (ActiveModule + ? ActiveModule->getTopLevelModule()->getFullModuleName() + : ""); HadError = true; - return; } - if (ModuleMapFile != Map.getContainingModuleMapFile(TopLevelModule)) { + if (TopLevelModule && + ModuleMapFile != Map.getContainingModuleMapFile(TopLevelModule)) { assert(ModuleMapFile != Map.getModuleMapFileForUniquing(TopLevelModule) && "submodule defined in same file as 'module *' that allowed its " "top-level module"); @@ -2420,15 +2416,15 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) { } // Look for this file. - const DirectoryEntry *Dir = nullptr; + Optional Dir; if (llvm::sys::path::is_absolute(DirName)) { - if (auto D = SourceMgr.getFileManager().getDirectory(DirName)) + if (auto D = SourceMgr.getFileManager().getOptionalDirectoryRef(DirName)) Dir = *D; } else { SmallString<128> PathName; PathName = Directory->getName(); llvm::sys::path::append(PathName, DirName); - if (auto D = SourceMgr.getFileManager().getDirectory(PathName)) + if (auto D = SourceMgr.getFileManager().getOptionalDirectoryRef(PathName)) Dir = *D; } @@ -2449,7 +2445,7 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) { SourceMgr.getFileManager().getVirtualFileSystem(); for (llvm::vfs::recursive_directory_iterator I(FS, Dir->getName(), EC), E; I != E && !EC; I.increment(EC)) { - if (auto FE = SourceMgr.getFileManager().getFile(I->path())) { + if (auto FE = SourceMgr.getFileManager().getOptionalFileRef(I->path())) { Module::Header Header = {std::string(I->path()), *FE}; Headers.push_back(std::move(Header)); } @@ -2463,7 +2459,7 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) { return; } - if (Module *OwningModule = Map.UmbrellaDirs[Dir]) { + if (Module *OwningModule = Map.UmbrellaDirs[*Dir]) { Diags.Report(UmbrellaLoc, diag::err_mmap_umbrella_clash) << OwningModule->getFullModuleName(); HadError = true; @@ -2471,7 +2467,7 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) { } // Record this umbrella directory. - Map.setUmbrellaDir(ActiveModule, Dir, DirName); + Map.setUmbrellaDir(ActiveModule, *Dir, DirName); } /// Parse a module export declaration. @@ -3006,7 +3002,7 @@ bool ModuleMap::parseModuleMapFile(const FileEntry *File, bool IsSystem, } assert(Target && "Missing target information"); - const llvm::MemoryBuffer *Buffer = SourceMgr.getBuffer(ID); + llvm::Optional Buffer = SourceMgr.getBufferOrNone(ID); if (!Buffer) return ParsedModuleMap[File] = true; assert((!Offset || *Offset <= Buffer->getBufferSize()) && -- cgit v1.2.3