Skip to content

Commit

Permalink
Merge llvm-project release/17.x llvmorg-17.0.6-0-g6009708b4367
Browse files Browse the repository at this point in the history
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-17.0.6-0-g6009708b4367.

PR:		273753
MFC after:	1 month
  • Loading branch information
DimitryAndric committed Dec 8, 2023
2 parents b121cb0 + 703029d commit 5c16e71
Show file tree
Hide file tree
Showing 23 changed files with 94 additions and 106 deletions.
3 changes: 0 additions & 3 deletions contrib/llvm-project/clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -6079,9 +6079,6 @@ let Flags = [CC1Option, NoDriverOption] in {
def sys_header_deps : Flag<["-"], "sys-header-deps">,
HelpText<"Include system headers in dependency output">,
MarshallingInfoFlag<DependencyOutputOpts<"IncludeSystemHeaders">>;
def canonical_system_headers : Flag<["-"], "canonical-system-headers">,
HelpText<"Canonicalize system headers in dependency output">,
MarshallingInfoFlag<DependencyOutputOpts<"CanonicalSystemHeaders">>;
def module_file_deps : Flag<["-"], "module-file-deps">,
HelpText<"Include module files in dependency output">,
MarshallingInfoFlag<DependencyOutputOpts<"IncludeModuleFiles">>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ enum ExtraDepKind {
class DependencyOutputOptions {
public:
unsigned IncludeSystemHeaders : 1; ///< Include system header dependencies.
unsigned
CanonicalSystemHeaders : 1; ///< canonicalize system header dependencies.
unsigned ShowHeaderIncludes : 1; ///< Show header inclusions (-H).
unsigned UsePhonyTargets : 1; ///< Include phony targets for each
/// dependency, which can avoid some 'make'
Expand Down Expand Up @@ -84,11 +82,10 @@ class DependencyOutputOptions {

public:
DependencyOutputOptions()
: IncludeSystemHeaders(0), CanonicalSystemHeaders(0),
ShowHeaderIncludes(0), UsePhonyTargets(0), AddMissingHeaderDeps(0),
IncludeModuleFiles(0), ShowSkippedHeaderIncludes(0),
HeaderIncludeFormat(HIFMT_Textual), HeaderIncludeFiltering(HIFIL_None) {
}
: IncludeSystemHeaders(0), ShowHeaderIncludes(0), UsePhonyTargets(0),
AddMissingHeaderDeps(0), IncludeModuleFiles(0),
ShowSkippedHeaderIncludes(0), HeaderIncludeFormat(HIFMT_Textual),
HeaderIncludeFiltering(HIFIL_None) {}
};

} // end namespace clang
Expand Down
11 changes: 1 addition & 10 deletions contrib/llvm-project/clang/include/clang/Frontend/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class ExternalSemaSource;
class FrontendOptions;
class PCHContainerReader;
class Preprocessor;
class FileManager;
class PreprocessorOptions;
class PreprocessorOutputOptions;

Expand Down Expand Up @@ -80,14 +79,11 @@ class DependencyCollector {
/// Return true if system files should be passed to sawDependency().
virtual bool needSystemDependencies() { return false; }

/// Return true if system files should be canonicalized.
virtual bool shouldCanonicalizeSystemDependencies() { return false; }

/// Add a dependency \p Filename if it has not been seen before and
/// sawDependency() returns true.
virtual void maybeAddDependency(StringRef Filename, bool FromModule,
bool IsSystem, bool IsModuleFile,
FileManager *FileMgr, bool IsMissing);
bool IsMissing);

protected:
/// Return true if the filename was added to the list of dependencies, false
Expand Down Expand Up @@ -116,10 +112,6 @@ class DependencyFileGenerator : public DependencyCollector {
bool sawDependency(StringRef Filename, bool FromModule, bool IsSystem,
bool IsModuleFile, bool IsMissing) final;

bool shouldCanonicalizeSystemDependencies() override {
return CanonicalSystemHeaders;
}

protected:
void outputDependencyFile(llvm::raw_ostream &OS);

Expand All @@ -129,7 +121,6 @@ class DependencyFileGenerator : public DependencyCollector {
std::string OutputFile;
std::vector<std::string> Targets;
bool IncludeSystemHeaders;
bool CanonicalSystemHeaders;
bool PhonyTarget;
bool AddMissingHeaderDeps;
bool SeenMissingHeader;
Expand Down
16 changes: 15 additions & 1 deletion contrib/llvm-project/clang/lib/Basic/Targets/OSTargets.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ class LLVM_LIBRARY_VISIBILITY FreeBSDTargetInfo : public OSTargetInfo<Target> {
Builder.defineMacro("__FreeBSD_cc_version", Twine(CCVersion));
Builder.defineMacro("__KPRINTF_ATTRIBUTE__");
DefineStd(Builder, "unix", Opts);
if (this->HasFloat128)
Builder.defineMacro("__FLOAT128__");

// On FreeBSD, wchar_t contains the number of the code point as
// used by the character set of the locale. These character sets are
Expand All @@ -234,9 +236,11 @@ class LLVM_LIBRARY_VISIBILITY FreeBSDTargetInfo : public OSTargetInfo<Target> {
FreeBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: OSTargetInfo<Target>(Triple, Opts) {
switch (Triple.getArch()) {
default:
case llvm::Triple::x86:
case llvm::Triple::x86_64:
this->HasFloat128 = true;
[[fallthrough]];
default:
this->MCountName = ".mcount";
break;
case llvm::Triple::mips:
Expand Down Expand Up @@ -425,12 +429,22 @@ class LLVM_LIBRARY_VISIBILITY NetBSDTargetInfo : public OSTargetInfo<Target> {
Builder.defineMacro("__unix__");
if (Opts.POSIXThreads)
Builder.defineMacro("_REENTRANT");
if (this->HasFloat128)
Builder.defineMacro("__FLOAT128__");
}

public:
NetBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: OSTargetInfo<Target>(Triple, Opts) {
this->MCountName = "__mcount";
switch (Triple.getArch()) {
default:
break;
case llvm::Triple::x86:
case llvm::Triple::x86_64:
this->HasFloat128 = true;
break;
}
}
};

Expand Down
3 changes: 0 additions & 3 deletions contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,9 +1152,6 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
if (ArgM->getOption().matches(options::OPT_M) ||
ArgM->getOption().matches(options::OPT_MD))
CmdArgs.push_back("-sys-header-deps");
if (Args.hasFlag(options::OPT_canonical_prefixes,
options::OPT_no_canonical_prefixes, true))
CmdArgs.push_back("-canonical-system-headers");
if ((isa<PrecompileJobAction>(JA) &&
!Args.hasArg(options::OPT_fno_module_file_deps)) ||
Args.hasArg(options::OPT_fmodule_file_deps))
Expand Down
38 changes: 25 additions & 13 deletions contrib/llvm-project/clang/lib/Driver/ToolChains/WebAssembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,31 +77,43 @@ void wasm::Linker::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddAllArgs(CmdArgs, options::OPT_u);
ToolChain.AddFilePathLibArgs(Args, CmdArgs);

const char *Crt1 = "crt1.o";
bool IsCommand = true;
const char *Crt1;
const char *Entry = nullptr;

// If crt1-command.o exists, it supports new-style commands, so use it.
// Otherwise, use the old crt1.o. This is a temporary transition measure.
// Once WASI libc no longer needs to support LLVM versions which lack
// support for new-style command, it can make crt1.o the same as
// crt1-command.o. And once LLVM no longer needs to support WASI libc
// versions before that, it can switch to using crt1-command.o.
if (ToolChain.GetFilePath("crt1-command.o") != "crt1-command.o")
Crt1 = "crt1-command.o";
// When -shared is specified, use the reactor exec model unless
// specified otherwise.
if (Args.hasArg(options::OPT_shared))
IsCommand = false;

if (const Arg *A = Args.getLastArg(options::OPT_mexec_model_EQ)) {
StringRef CM = A->getValue();
if (CM == "command") {
// Use default values.
IsCommand = true;
} else if (CM == "reactor") {
Crt1 = "crt1-reactor.o";
Entry = "_initialize";
IsCommand = false;
} else {
ToolChain.getDriver().Diag(diag::err_drv_invalid_argument_to_option)
<< CM << A->getOption().getName();
}
}
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles, options::OPT_shared))

if (IsCommand) {
// If crt1-command.o exists, it supports new-style commands, so use it.
// Otherwise, use the old crt1.o. This is a temporary transition measure.
// Once WASI libc no longer needs to support LLVM versions which lack
// support for new-style command, it can make crt1.o the same as
// crt1-command.o. And once LLVM no longer needs to support WASI libc
// versions before that, it can switch to using crt1-command.o.
Crt1 = "crt1.o";
if (ToolChain.GetFilePath("crt1-command.o") != "crt1-command.o")
Crt1 = "crt1-command.o";
} else {
Crt1 = "crt1-reactor.o";
Entry = "_initialize";
}

if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles))
CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(Crt1)));
if (Entry) {
CmdArgs.push_back(Args.MakeArgString("--entry"));
Expand Down
4 changes: 2 additions & 2 deletions contrib/llvm-project/clang/lib/Format/TokenAnnotator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3065,8 +3065,8 @@ void TokenAnnotator::setCommentLineLevels(

// If the comment is currently aligned with the line immediately following
// it, that's probably intentional and we should keep it.
if (NextNonCommentLine && !NextNonCommentLine->First->Finalized &&
Line->isComment() && NextNonCommentLine->First->NewlinesBefore <= 1 &&
if (NextNonCommentLine && NextNonCommentLine->First->NewlinesBefore < 2 &&
Line->isComment() && !isClangFormatOff(Line->First->TokenText) &&
NextNonCommentLine->First->OriginalColumn ==
Line->First->OriginalColumn) {
const bool PPDirectiveOrImportStmt =
Expand Down
4 changes: 3 additions & 1 deletion contrib/llvm-project/clang/lib/Format/WhitespaceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,8 @@ void WhitespaceManager::alignArrayInitializersRightJustified(
auto Offset = std::distance(Cells.begin(), CellIter);
for (const auto *Next = CellIter->NextColumnElement; Next;
Next = Next->NextColumnElement) {
if (RowCount >= CellDescs.CellCounts.size())
break;
auto *Start = (Cells.begin() + RowCount * CellDescs.CellCounts[0]);
auto *End = Start + Offset;
ThisNetWidth = getNetWidth(Start, End, CellDescs.InitialSpaces);
Expand Down Expand Up @@ -1324,7 +1326,7 @@ void WhitespaceManager::alignArrayInitializersLeftJustified(
auto Offset = std::distance(Cells.begin(), CellIter);
for (const auto *Next = CellIter->NextColumnElement; Next;
Next = Next->NextColumnElement) {
if (RowCount > CellDescs.CellCounts.size())
if (RowCount >= CellDescs.CellCounts.size())
break;
auto *Start = (Cells.begin() + RowCount * CellDescs.CellCounts[0]);
auto *End = Start + Offset;
Expand Down
2 changes: 1 addition & 1 deletion contrib/llvm-project/clang/lib/Format/WhitespaceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class WhitespaceManager {
auto Offset = std::distance(CellStart, CellStop);
for (const auto *Next = CellStop->NextColumnElement; Next;
Next = Next->NextColumnElement) {
if (RowCount > MaxRowCount)
if (RowCount >= MaxRowCount)
break;
auto Start = (CellStart + RowCount * CellCount);
auto End = Start + Offset;
Expand Down
32 changes: 7 additions & 25 deletions contrib/llvm-project/clang/lib/Frontend/DependencyFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,16 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
DepCollector.maybeAddDependency(
llvm::sys::path::remove_leading_dotslash(*Filename),
/*FromModule*/ false, isSystem(FileType), /*IsModuleFile*/ false,
&PP.getFileManager(),
/*IsMissing*/ false);
}

void FileSkipped(const FileEntryRef &SkippedFile, const Token &FilenameTok,
SrcMgr::CharacteristicKind FileType) override {
StringRef Filename =
llvm::sys::path::remove_leading_dotslash(SkippedFile.getName());
DepCollector.maybeAddDependency(Filename,
/*FromModule=*/false,
DepCollector.maybeAddDependency(Filename, /*FromModule=*/false,
/*IsSystem=*/isSystem(FileType),
/*IsModuleFile=*/false,
&PP.getFileManager(),
/*IsMissing=*/false);
}

Expand All @@ -72,11 +69,9 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
StringRef RelativePath, const Module *Imported,
SrcMgr::CharacteristicKind FileType) override {
if (!File)
DepCollector.maybeAddDependency(FileName,
/*FromModule*/ false,
DepCollector.maybeAddDependency(FileName, /*FromModule*/ false,
/*IsSystem*/ false,
/*IsModuleFile*/ false,
&PP.getFileManager(),
/*IsMissing*/ true);
// Files that actually exist are handled by FileChanged.
}
Expand All @@ -88,11 +83,9 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
return;
StringRef Filename =
llvm::sys::path::remove_leading_dotslash(File->getName());
DepCollector.maybeAddDependency(Filename,
/*FromModule=*/false,
DepCollector.maybeAddDependency(Filename, /*FromModule=*/false,
/*IsSystem=*/isSystem(FileType),
/*IsModuleFile=*/false,
&PP.getFileManager(),
/*IsMissing=*/false);
}

Expand All @@ -108,11 +101,9 @@ struct DepCollectorMMCallbacks : public ModuleMapCallbacks {
void moduleMapFileRead(SourceLocation Loc, const FileEntry &Entry,
bool IsSystem) override {
StringRef Filename = Entry.getName();
DepCollector.maybeAddDependency(Filename,
/*FromModule*/ false,
DepCollector.maybeAddDependency(Filename, /*FromModule*/ false,
/*IsSystem*/ IsSystem,
/*IsModuleFile*/ false,
/*FileMgr*/ nullptr,
/*IsMissing*/ false);
}
};
Expand All @@ -128,10 +119,8 @@ struct DepCollectorASTListener : public ASTReaderListener {
}
void visitModuleFile(StringRef Filename,
serialization::ModuleKind Kind) override {
DepCollector.maybeAddDependency(Filename,
/*FromModule*/ true,
DepCollector.maybeAddDependency(Filename, /*FromModule*/ true,
/*IsSystem*/ false, /*IsModuleFile*/ true,
/*FileMgr*/ nullptr,
/*IsMissing*/ false);
}
bool visitInputFile(StringRef Filename, bool IsSystem,
Expand All @@ -145,7 +134,7 @@ struct DepCollectorASTListener : public ASTReaderListener {
Filename = FE->getName();

DepCollector.maybeAddDependency(Filename, /*FromModule*/ true, IsSystem,
/*IsModuleFile*/ false, /*FileMgr*/ nullptr,
/*IsModuleFile*/ false,
/*IsMissing*/ false);
return true;
}
Expand All @@ -155,15 +144,9 @@ struct DepCollectorASTListener : public ASTReaderListener {
void DependencyCollector::maybeAddDependency(StringRef Filename,
bool FromModule, bool IsSystem,
bool IsModuleFile,
FileManager *FileMgr,
bool IsMissing) {
if (sawDependency(Filename, FromModule, IsSystem, IsModuleFile, IsMissing)) {
if (IsSystem && FileMgr && shouldCanonicalizeSystemDependencies()) {
if (auto F = FileMgr->getFile(Filename))
Filename = FileMgr->getCanonicalName(*F);
}
if (sawDependency(Filename, FromModule, IsSystem, IsModuleFile, IsMissing))
addDependency(Filename);
}
}

bool DependencyCollector::addDependency(StringRef Filename) {
Expand Down Expand Up @@ -211,7 +194,6 @@ DependencyFileGenerator::DependencyFileGenerator(
const DependencyOutputOptions &Opts)
: OutputFile(Opts.OutputFile), Targets(Opts.Targets),
IncludeSystemHeaders(Opts.IncludeSystemHeaders),
CanonicalSystemHeaders(Opts.CanonicalSystemHeaders),
PhonyTarget(Opts.UsePhonyTargets),
AddMissingHeaderDeps(Opts.AddMissingHeaderDeps), SeenMissingHeader(false),
IncludeModuleFiles(Opts.IncludeModuleFiles),
Expand Down
8 changes: 4 additions & 4 deletions contrib/llvm-project/clang/lib/Lex/ModuleMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2481,9 +2481,9 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken,
<< FixItHint::CreateReplacement(CurrModuleDeclLoc, "framework module");
}

static int compareModuleHeaders(const Module::Header *A,
const Module::Header *B) {
return A->NameAsWritten.compare(B->NameAsWritten);
static bool compareModuleHeaders(const Module::Header &A,
const Module::Header &B) {
return A.NameAsWritten < B.NameAsWritten;
}

/// Parse an umbrella directory declaration.
Expand Down Expand Up @@ -2546,7 +2546,7 @@ void ModuleMapParser::parseUmbrellaDirDecl(SourceLocation UmbrellaLoc) {
}

// Sort header paths so that the pcm doesn't depend on iteration order.
llvm::array_pod_sort(Headers.begin(), Headers.end(), compareModuleHeaders);
std::stable_sort(Headers.begin(), Headers.end(), compareModuleHeaders);

for (auto &Header : Headers)
Map.addHeader(ActiveModule, std::move(Header), ModuleMap::TextualHeader);
Expand Down
19 changes: 7 additions & 12 deletions contrib/llvm-project/clang/lib/Sema/SemaOverload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -957,18 +957,13 @@ static bool shouldAddReversedEqEq(Sema &S, SourceLocation OpLoc,
return true;
}
// Otherwise the search scope is the namespace scope of which F is a member.
LookupResult NonMembers(S, NotEqOp, OpLoc,
Sema::LookupNameKind::LookupOperatorName);
S.LookupName(NonMembers,
S.getScopeForContext(EqFD->getEnclosingNamespaceContext()));
NonMembers.suppressDiagnostics();
for (NamedDecl *Op : NonMembers) {
auto *FD = Op->getAsFunction();
if(auto* UD = dyn_cast<UsingShadowDecl>(Op))
FD = UD->getUnderlyingDecl()->getAsFunction();
if (FunctionsCorrespond(S.Context, EqFD, FD) &&
declaresSameEntity(cast<Decl>(EqFD->getDeclContext()),
cast<Decl>(Op->getDeclContext())))
for (NamedDecl *Op : EqFD->getEnclosingNamespaceContext()->lookup(NotEqOp)) {
auto *NotEqFD = Op->getAsFunction();
if (auto *UD = dyn_cast<UsingShadowDecl>(Op))
NotEqFD = UD->getUnderlyingDecl()->getAsFunction();
if (FunctionsCorrespond(S.Context, EqFD, NotEqFD) && S.isVisible(NotEqFD) &&
declaresSameEntity(cast<Decl>(EqFD->getEnclosingNamespaceContext()),
cast<Decl>(Op->getLexicalDeclContext())))
return false;
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion contrib/llvm-project/libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
// _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM.
// Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is
// defined to XXYYZZ.
# define _LIBCPP_VERSION 170005
# define _LIBCPP_VERSION 170006

# define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
# define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)
Expand Down
Loading

0 comments on commit 5c16e71

Please sign in to comment.