Skip to content

[rebranch] Push stable/20240408 changes to next #8819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/include/clang/AST/StmtIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ struct StmtIterator : public StmtIteratorImpl<StmtIterator, Stmt*&> {
StmtIterator(const VariableArrayType *t)
: StmtIteratorImpl<StmtIterator, Stmt*&>(t) {}

private:
StmtIterator(const StmtIteratorBase &RHS)
: StmtIteratorImpl<StmtIterator, Stmt *&>(RHS) {}

private:
inline friend StmtIterator
cast_away_const(const ConstStmtIterator &RHS);
};
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ def all__load : Flag<["-"], "all_load">;
def allowable__client : Separate<["-"], "allowable_client">;
def ansi : Flag<["-", "--"], "ansi">, Group<CompileOnly_Group>;
def arch__errors__fatal : Flag<["-"], "arch_errors_fatal">;
def arch : Separate<["-"], "arch">, Flags<[NoXarchOption,TargetSpecific]>;
def arch : Separate<["-"], "arch">, Flags<[NoXarchOption]>;
def arch__only : Separate<["-"], "arch_only">;
def autocomplete : Joined<["--"], "autocomplete=">;
def bind__at__load : Flag<["-"], "bind_at_load">;
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/arc-exceptions.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang -### -x objective-c --target=x86_64-apple-macos10.6 -fobjc-arc -fsyntax-only %s 2> %t.log
// RUN: %clang -### -x objective-c -arch x86_64 -fobjc-arc -fsyntax-only %s 2> %t.log
// RUN: grep objective-c %t.log
// RUN: not grep "fobjc-arc-exceptions" %t.log
// RUN: %clang -### -x objective-c++ --target=x86_64-apple-macos10.6 -fobjc-arc -fsyntax-only %s 2> %t.log
// RUN: %clang -### -x objective-c++ -arch x86_64 -fobjc-arc -fsyntax-only %s 2> %t.log
// RUN: grep "fobjc-arc-exceptions" %t.log
8 changes: 2 additions & 6 deletions clang/test/Driver/arm-arch-darwin.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// On Darwin, arch should override CPU for triple purposes
// RUN: %clang -target armv7m-apple-darwin -arch armv7m -mcpu=cortex-m4 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V7M-DARWIN %s
// CHECK-V7M-DARWIN: "-cc1"{{.*}} "-triple" "thumbv7m-{{.*}} "-target-cpu" "cortex-m4"
// RUN: %clang -target armv7m -arch armv7m -mcpu=cortex-m4 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V7M-OVERRIDDEN %s
// CHECK-V7M-OVERRIDDEN: "-cc1"{{.*}} "-triple" "thumbv7em-{{.*}} "-target-cpu" "cortex-m4"

/// -arch is unsupported for non-Darwin targets.
// RUN: not %clang --target=armv7m -arch armv7m -mcpu=cortex-m4 -### -c %s 2>&1 | FileCheck -check-prefix=ERR %s
// ERR: unsupported option '-arch' for target 'armv7m'

// RUN: not %clang --target=aarch64-linux-gnu -arch arm64 -### -c %s 2>&1 | FileCheck -check-prefix=ERR2 %s
// ERR2: unsupported option '-arch' for target 'aarch64-linux-gnu'
6 changes: 3 additions & 3 deletions clang/test/Frontend/darwin-eabi.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clang --target=armv6m-apple-darwin -dM -E %s | FileCheck %s
// RUN: %clang --target=armv7m-apple-darwin -dM -E %s | FileCheck %s
// RUN: %clang --target=armv7em-apple-darwin -dM -E %s | FileCheck %s
// RUN: %clang -arch armv6m -dM -E %s | FileCheck %s
// RUN: %clang -arch armv7m -dM -E %s | FileCheck %s
// RUN: %clang -arch armv7em -dM -E %s | FileCheck %s
// RUN: %clang_cc1 -triple thumbv7m-apple-unknown-macho -dM -E %s | FileCheck %s

// CHECK-NOT: __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/ExpressionParser/Swift/SwiftREPL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/DataFormatters/ValueObjectPrinter.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/StreamFile.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Symbol/ObjectFile.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ SwiftMetadataCache::generateHashTableBlob(
}

// Make sure that no bucket is at offset 0.
llvm::support::endian::write<uint32_t>(blobStream, 0, llvm::support::little);
llvm::support::endian::write<uint32_t>(blobStream, 0, llvm::endianness::little);
uint32_t table_control_offset = table_generator.Emit(blobStream, m_info);
return {{std::move(table_control_offset), std::move(hash_table_blob)}};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class TypeRefInfo {
offset_type key_len = key.size();
// Write the key length so we don't have to traverse it later.
llvm::support::endian::write<offset_type>(out, key_len,
llvm::support::little);
llvm::endianness::little);
// Since the data type is always a constant size there's no need to write
// it.
offset_type data_len = sizeof(data_type);
Expand All @@ -80,7 +80,7 @@ class TypeRefInfo {

void EmitData(llvm::raw_ostream &out, key_type_ref key, data_type_ref data,
unsigned len) {
llvm::support::endian::write<data_type>(out, data, llvm::support::little);
llvm::support::endian::write<data_type>(out, data, llvm::endianness::little);
}

// Decoder functions.
Expand All @@ -92,7 +92,7 @@ class TypeRefInfo {
static std::pair<offset_type, offset_type>
ReadKeyDataLength(const unsigned char *&data) {
offset_type key_len =
llvm::support::endian::readNext<offset_type, llvm::support::little,
llvm::support::endian::readNext<offset_type, llvm::endianness::little,
llvm::support::unaligned>(data);
offset_type data_len = sizeof(data_type);
return std::make_pair(key_len, data_len);
Expand All @@ -105,7 +105,7 @@ class TypeRefInfo {
static data_type ReadData(internal_key_type key, const uint8_t *data,
unsigned length) {
data_type result =
llvm::support::endian::readNext<uint32_t, llvm::support::little,
llvm::support::endian::readNext<uint32_t, llvm::endianness::little,
llvm::support::unaligned>(data);
return result;
}
Expand Down
1 change: 1 addition & 0 deletions lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "UniqueDWARFASTType.h"

class DWARFASTParserClang;
class DWARFASTParserSwift;

namespace llvm {
class DWARFDebugAbbrev;
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/Progress.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Expression/DiagnosticManager.h"
#include "lldb/Expression/IRExecutionUnit.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/StreamFile.h"
#include "lldb/Host/XML.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/ObjectFile.h"
Expand Down Expand Up @@ -1600,7 +1600,7 @@ void SwiftASTContext::AddExtraClangArgs(const std::vector<std::string> &source,
continue;
}
// Drop -Werror; it would only cause trouble in the debugger.
if (clang_argument.startswith("-Werror"))
if (clang_argument.starts_with("-Werror"))
continue;

// Drop `--`. This might be coming from the user-provided setting
Expand Down Expand Up @@ -5242,7 +5242,7 @@ swift::irgen::IRGenModule &SwiftASTContext::GetIRGenModule() {
const llvm::Target *llvm_target =
llvm::TargetRegistry::lookupTarget(llvm_triple.str(), error_str);

llvm::CodeGenOpt::Level optimization_level = llvm::CodeGenOpt::Level::None;
llvm::CodeGenOptLevel optimization_level = llvm::CodeGenOptLevel::None;

// Create a target machine.
llvm::TargetMachine *target_machine = llvm_target->createTargetMachine(
Expand Down Expand Up @@ -9221,7 +9221,7 @@ bool SwiftASTContext::GetCompileUnitImportsImpl(
}

std::string category = "Importing Swift module dependencies for ";
category += compile_unit->GetPrimaryFile().GetFilename();
category += compile_unit->GetPrimaryFile().GetFilename().GetString();
Progress progress(category, "", cu_imports.size());
size_t completion = 0;
for (const SourceModule &module : cu_imports) {
Expand Down
9 changes: 7 additions & 2 deletions lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,16 @@ namespace llvm {
class LLVMContext;
}

class DWARFASTParser;
class SwiftEnumDescriptor;

namespace lldb_private {

namespace plugin {
namespace dwarf {
class DWARFASTParser;
} // namespace dwarf
} // namespace plugin

struct SourceModule;
class SwiftASTContext;
class ClangExternalASTSourceCallbacks;
Expand Down Expand Up @@ -549,7 +554,7 @@ class SwiftASTContext : public TypeSystemSwift {

bool IsFixedSize(CompilerType compiler_type);

DWARFASTParser *GetDWARFParser() override;
plugin::dwarf::DWARFASTParser *GetDWARFParser() override;

// CompilerDecl functions
ConstString DeclGetName(void *opaque_decl) override {
Expand Down
7 changes: 0 additions & 7 deletions lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ void TypeSystemSwift::Terminate() {

/// \}

void TypeSystemSwift::DumpValue(
lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream &s,
lldb::Format format, const DataExtractor &data, lldb::offset_t data_offset,
size_t data_byte_size, uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset, bool show_types, bool show_summary,
bool verbose, uint32_t depth) {}

void TypeSystemSwift::Dump(llvm::raw_ostream &output) {
// TODO: What to dump?
}
Expand Down
17 changes: 0 additions & 17 deletions lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwift.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,6 @@ class TypeSystemSwift : public TypeSystem {
/// For example, int is converted to Int32.
virtual CompilerType ConvertClangTypeToSwiftType(CompilerType clang_type) = 0;

void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
Stream &s, lldb::Format format, const DataExtractor &data,
lldb::offset_t data_offset, size_t data_byte_size,
uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
bool show_types, bool show_summary, bool verbose,
uint32_t depth) override;

/// \see lldb_private::TypeSystem::Dump
void Dump(llvm::raw_ostream &output) override;

Expand Down Expand Up @@ -231,10 +224,6 @@ class TypeSystemSwift : public TypeSystem {
return {};
}
bool IsScalarType(lldb::opaque_compiler_type_t type) override;
bool IsCStringType(lldb::opaque_compiler_type_t type,
uint32_t &length) override {
return false;
}
bool IsVectorType(lldb::opaque_compiler_type_t type,
CompilerType *element_type, uint64_t *size) override {
return false;
Expand Down Expand Up @@ -323,12 +312,6 @@ class TypeSystemSwift : public TypeSystem {
CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type) override {
return {};
}

// TODO: This method appear unused. Should they be removed?
void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
Stream &s, const DataExtractor &data,
lldb::offset_t data_offset, size_t data_byte_size) override {
}
/// \}
protected:
/// Used in the logs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Host/StreamFile.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/TypeList.h"
#include "lldb/Symbol/TypeMap.h"
Expand Down Expand Up @@ -1980,8 +1980,6 @@ void TypeSystemSwiftTypeRef::SetTriple(const llvm::Triple triple) {
// This function appears to be only called via Module::SetArchitecture(ArchSpec).
if (auto *swift_ast_context = GetSwiftASTContextOrNull(nullptr))
swift_ast_context->SetTriple(triple);
else
m_swift_ast_context_triple = triple;
}

void TypeSystemSwiftTypeRef::ClearModuleDependentCaches() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class TypeSystemSwiftTypeRef : public TypeSystemSwift {
Status IsCompatible() override;

void DiagnoseWarnings(Process &process, Module &module) const override;
DWARFASTParser *GetDWARFParser() override;
plugin::dwarf::DWARFASTParser *GetDWARFParser() override;
// CompilerDecl functions
ConstString DeclGetName(void *opaque_decl) override {
return ConstString("");
Expand Down Expand Up @@ -496,7 +496,7 @@ class TypeSystemSwiftTypeRef : public TypeSystemSwift {
mutable std::unique_ptr<SwiftDWARFImporterForClangTypes>
m_dwarf_importer_for_clang_types_up;
mutable std::unique_ptr<ClangNameImporter> m_name_importer_up;
std::unique_ptr<DWARFASTParser> m_dwarf_ast_parser_up;
std::unique_ptr<plugin::dwarf::DWARFASTParser> m_dwarf_ast_parser_up;

/// The APINotesManager responsible for each Clang module.
llvm::DenseMap<clang::Module *,
Expand Down
4 changes: 0 additions & 4 deletions lldb/source/Symbol/Symtab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,6 @@ static bool lldb_skip_name(llvm::StringRef mangled,
case Mangled::eManglingSchemeSwift:
return false;

#ifdef LLDB_ENABLE_SWIFT
case Mangled::eManglingSchemeSwift:
// This is handled separately.
#endif // LLDB_ENABLE_SWIFT
// Don't try and demangle things we can't categorize.
case Mangled::eManglingSchemeNone:
return true;
Expand Down
17 changes: 16 additions & 1 deletion llvm/include/llvm/CodeGen/MachineFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,10 @@ class LLVM_EXTERNAL_VISIBILITY MachineFunction {
/// Find or create an LandingPadInfo for the specified MachineBasicBlock.
LandingPadInfo &getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad);

/// Remap landing pad labels and remove any deleted landing pads.
void tidyLandingPads(DenseMap<MCSymbol *, uintptr_t> *LPMap = nullptr,
bool TidyIfNoBeginLabels = true);

/// Return a reference to the landing pad info for the current function.
const std::vector<LandingPadInfo> &getLandingPads() const {
return LandingPads;
Expand All @@ -1215,11 +1219,22 @@ class LLVM_EXTERNAL_VISIBILITY MachineFunction {
/// entry.
MCSymbol *addLandingPad(MachineBasicBlock *LandingPad);

/// Provide the catch typeinfo for a landing pad.
void addCatchTypeInfo(MachineBasicBlock *LandingPad,
ArrayRef<const GlobalValue *> TyInfo);

/// Provide the filter typeinfo for a landing pad.
void addFilterTypeInfo(MachineBasicBlock *LandingPad,
ArrayRef<const GlobalValue *> TyInfo);

/// Add a cleanup action for a landing pad.
void addCleanup(MachineBasicBlock *LandingPad);

/// Return the type id for the specified typeinfo. This is function wide.
unsigned getTypeIDFor(const GlobalValue *TI);

/// Return the id of the filter encoded by TyIds. This is function wide.
int getFilterIDFor(ArrayRef<unsigned> TyIds);
int getFilterIDFor(std::vector<unsigned> &TyIds);

/// Map the landing pad's EH symbol to the call site indexes.
void setCallSiteLandingPad(MCSymbol *Sym, ArrayRef<unsigned> Sites);
Expand Down
5 changes: 4 additions & 1 deletion llvm/include/llvm/Support/GenericLoopInfoImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ BlockT *LoopBase<BlockT, LoopT>::getLoopPreheader() const {
return nullptr;

// Make sure there is only one exit out of the preheader.
if (llvm::size(llvm::children<BlockT *>(Out)) != 1)
typedef GraphTraits<BlockT *> BlockTraits;
typename BlockTraits::ChildIteratorType SI = BlockTraits::child_begin(Out);
++SI;
if (SI != BlockTraits::child_end(Out))
return nullptr; // Multiple exits from the block, must not be a preheader.

// The predecessor has exactly one successor, so it is a preheader.
Expand Down
3 changes: 2 additions & 1 deletion llvm/include/llvm/TargetParser/Triple.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ class Triple {
Mesa,
SUSE,
OpenEmbedded,
LastVendorType = OpenEmbedded
Swift,
LastVendorType = Swift
};
enum OSType {
UnknownOS,
Expand Down
11 changes: 10 additions & 1 deletion llvm/lib/CodeGen/AsmPrinter/AIXException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@

namespace llvm {

AIXException::AIXException(AsmPrinter *A) : EHStreamer(A) {}
AIXException::AIXException(AsmPrinter *A) : DwarfCFIExceptionBase(A) {}

// This overrides 'DwarfCFIExceptionBase::markFunctionEnd', to avoid the call to
// tidyLandingPads. This is necessary, because the
// 'PPCAIXAsmPrinter::emitFunctionBodyEnd' function already checked whether we
// need ehinfo, and emitted a traceback table with the bits set to indicate that
// we will be emitting it, if so. Thus, if we remove it now -- so late in the
// process -- we'll end up having emitted a reference to __ehinfo.N symbol, but
// not emitting a definition for said symbol.
void AIXException::markFunctionEnd() {}

void AIXException::emitExceptionInfoTable(const MCSymbol *LSDA,
const MCSymbol *PerSym) {
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/CodeGen/AsmPrinter/ARMException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "llvm/MC/MCStreamer.h"
using namespace llvm;

ARMException::ARMException(AsmPrinter *A) : EHStreamer(A) {}
ARMException::ARMException(AsmPrinter *A) : DwarfCFIExceptionBase(A) {}

ARMException::~ARMException() = default;

Expand Down Expand Up @@ -51,6 +51,7 @@ void ARMException::beginFunction(const MachineFunction *MF) {
void ARMException::markFunctionEnd() {
if (shouldEmitCFI)
Asm->OutStreamer->emitCFIEndProc();
DwarfCFIExceptionBase::markFunctionEnd();
}

/// endFunction - Gather and emit post-function exception information.
Expand Down
13 changes: 12 additions & 1 deletion llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,18 @@
#include "llvm/Target/TargetOptions.h"
using namespace llvm;

DwarfCFIException::DwarfCFIException(AsmPrinter *A) : EHStreamer(A) {}
DwarfCFIExceptionBase::DwarfCFIExceptionBase(AsmPrinter *A) : EHStreamer(A) {}

void DwarfCFIExceptionBase::markFunctionEnd() {
// Map all labels and get rid of any dead landing pads.
if (!Asm->MF->getLandingPads().empty()) {
MachineFunction *NonConstMF = const_cast<MachineFunction*>(Asm->MF);
NonConstMF->tidyLandingPads();
}
}

DwarfCFIException::DwarfCFIException(AsmPrinter *A)
: DwarfCFIExceptionBase(A) {}

DwarfCFIException::~DwarfCFIException() = default;

Expand Down
Loading