Skip to content

Commit

Permalink
merge main into amd-staging
Browse files Browse the repository at this point in the history
5 mlir tests xfailed due to flang-new entry point spellings
  • Loading branch information
ronlieb committed Jan 14, 2025
2 parents 228cef1 + 60dc450 commit c1723a6
Show file tree
Hide file tree
Showing 532 changed files with 13,560 additions and 5,054 deletions.
2 changes: 1 addition & 1 deletion .ci/metrics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"https://influx-prod-13-prod-us-east-0.grafana.net/api/v1/push/influx/write"
)
GITHUB_PROJECT = "llvm/llvm-project"
WORKFLOWS_TO_TRACK = ["Check code formatting", "LLVM Premerge Checks"]
WORKFLOWS_TO_TRACK = ["LLVM Premerge Checks"]
SCRAPE_INTERVAL_SECONDS = 5 * 60


Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ static void ignoreTypeLocClasses(
Loc = Loc.getNextTypeLoc();
}

static bool isMutliLevelPointerToTypeLocClasses(
static bool isMultiLevelPointerToTypeLocClasses(
TypeLoc Loc,
std::initializer_list<TypeLoc::TypeLocClass> const &LocClasses) {
ignoreTypeLocClasses(Loc, {TypeLoc::Paren, TypeLoc::Qualified});
Expand Down Expand Up @@ -424,7 +424,7 @@ void UseAutoCheck::replaceExpr(

auto Diag = diag(Range.getBegin(), Message);

bool ShouldReplenishVariableName = isMutliLevelPointerToTypeLocClasses(
bool ShouldReplenishVariableName = isMultiLevelPointerToTypeLocClasses(
TSI->getTypeLoc(), {TypeLoc::FunctionProto, TypeLoc::ConstantArray});

// Space after 'auto' to handle cases where the '*' in the pointer type is
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ Changes in existing checks
<clang-tidy/checks/performance/move-const-arg>` check to fix a crash when
an argument type is declared but not defined.

- Improved :doc:`performance-unnecessary-copy-initialization`
<clang-tidy/checks/performance/unnecessary-copy-initialization> check
- Improved :doc:`performance-unnecessary-copy-initialization
<clang-tidy/checks/performance/unnecessary-copy-initialization>` check
to consider static member functions the same way as free functions.

- Improved :doc:`readability-container-contains
Expand Down
12 changes: 12 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1102,11 +1102,23 @@ X86 Support
Arm and AArch64 Support
^^^^^^^^^^^^^^^^^^^^^^^

- Implementation of SVE2.1 and SME2.1 in accordance with the Arm C Language
Extensions (ACLE) is now available.

- In the ARM Target, the frame pointer (FP) of a leaf function can be retained
by using the ``-fno-omit-frame-pointer`` option. If you want to eliminate the FP
in leaf functions after enabling ``-fno-omit-frame-pointer``, you can do so by adding
the ``-momit-leaf-frame-pointer`` option.

- SME keyword attributes which apply to function types are now represented in the
mangling of the type. This means that ``void foo(void (*f)() __arm_streaming);``
now has a different mangling from ``void foo(void (*f)());``.

- The ``__arm_agnostic`` keyword attribute was added to let users describe
a function that preserves SME state enabled by PSTATE.ZA without having to share
this state with its callers and without making the assumption that this state
exists.

- Support has been added for the following processors (-mcpu identifiers in parenthesis):

For AArch64:
Expand Down
8 changes: 8 additions & 0 deletions clang/include/clang/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4285,6 +4285,14 @@ class RecordDecl : public TagDecl {
RecordDeclBits.HasNonTrivialToPrimitiveCopyCUnion = V;
}

bool hasUninitializedExplicitInitFields() const {
return RecordDeclBits.HasUninitializedExplicitInitFields;
}

void setHasUninitializedExplicitInitFields(bool V) {
RecordDeclBits.HasUninitializedExplicitInitFields = V;
}

/// Determine whether this class can be passed in registers. In C++ mode,
/// it must have at least one trivial, non-deleted copy or move constructor.
/// FIXME: This should be set as part of completeDefinition.
Expand Down
13 changes: 12 additions & 1 deletion clang/include/clang/AST/DeclBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,9 @@ class DeclContext {
/// hasLazyLocalLexicalLookups, hasLazyExternalLexicalLookups
friend class ASTWriter;

protected:
enum { NumOdrHashBits = 25 };

// We use uint64_t in the bit-fields below since some bit-fields
// cross the unsigned boundary and this breaks the packing.

Expand Down Expand Up @@ -1667,6 +1670,14 @@ class DeclContext {
LLVM_PREFERRED_TYPE(bool)
uint64_t HasNonTrivialToPrimitiveCopyCUnion : 1;

/// True if any field is marked as requiring explicit initialization with
/// [[clang::require_explicit_initialization]].
/// In C++, this is also set for types without a user-provided default
/// constructor, and is propagated from any base classes and/or member
/// variables whose types are aggregates.
LLVM_PREFERRED_TYPE(bool)
uint64_t HasUninitializedExplicitInitFields : 1;

/// Indicates whether this struct is destroyed in the callee.
LLVM_PREFERRED_TYPE(bool)
uint64_t ParamDestroyedInCallee : 1;
Expand All @@ -1681,7 +1692,7 @@ class DeclContext {

/// True if a valid hash is stored in ODRHash. This should shave off some
/// extra storage and prevent CXXRecordDecl to store unused bits.
uint64_t ODRHash : 26;
uint64_t ODRHash : NumOdrHashBits;
};

/// Number of inherited and non-inherited bits in RecordDeclBitfields.
Expand Down
7 changes: 7 additions & 0 deletions clang/include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -1902,6 +1902,13 @@ def Leaf : InheritableAttr {
let SimpleHandler = 1;
}

def ExplicitInit : InheritableAttr {
let Spellings = [Clang<"require_explicit_initialization">];
let Subjects = SubjectList<[Field], ErrorDiag>;
let Documentation = [ExplicitInitDocs];
let SimpleHandler = 1;
}

def LifetimeBound : DeclOrTypeAttr {
let Spellings = [Clang<"lifetimebound", 0>];
let Subjects = SubjectList<[ParmVar, ImplicitObjectParameter], ErrorDiag>;
Expand Down
49 changes: 49 additions & 0 deletions clang/include/clang/Basic/AttrDocs.td
Original file line number Diff line number Diff line change
Expand Up @@ -1684,6 +1684,55 @@ is not specified.
}];
}

def ExplicitInitDocs : Documentation {
let Category = DocCatField;
let Content = [{
The ``clang::require_explicit_initialization`` attribute indicates that a
field of an aggregate must be initialized explicitly by the user when an object
of the aggregate type is constructed. The attribute supports both C and C++,
but its usage is invalid on non-aggregates.

Note that this attribute is *not* a memory safety feature, and is *not* intended
to guard against use of uninitialized memory.

Rather, it is intended for use in "parameter-objects", used to simulate,
for example, the passing of named parameters.
The attribute generates a warning when explicit initializers for such
variables are not provided (this occurs regardless of whether any in-class field
initializers exist):

.. code-block:: c++

struct Buffer {
void *address [[clang::require_explicit_initialization]];
size_t length [[clang::require_explicit_initialization]] = 0;
};

struct ArrayIOParams {
size_t count [[clang::require_explicit_initialization]];
size_t element_size [[clang::require_explicit_initialization]];
int flags = 0;
};

size_t ReadArray(FILE *file, struct Buffer buffer,
struct ArrayIOParams params);

int main() {
unsigned int buf[512];
ReadArray(stdin, {
buf
// warning: field 'length' is not explicitly initialized
}, {
.count = sizeof(buf) / sizeof(*buf),
// warning: field 'element_size' is not explicitly initialized
// (Note that a missing initializer for 'flags' is not diagnosed, because
// the field is not marked as requiring explicit initialization.)
});
}

}];
}

def NoUniqueAddressDocs : Documentation {
let Category = DocCatField;
let Content = [{
Expand Down
8 changes: 5 additions & 3 deletions clang/include/clang/Basic/Builtins.td
Original file line number Diff line number Diff line change
Expand Up @@ -3347,10 +3347,12 @@ def VFork : LibBuiltin<"unistd.h"> {
}

// POSIX pthread.h
// FIXME: This should be a GNULibBuiltin, but it's currently missing the prototype.

def PthreadCreate : CustomEntry {
let Entry = "LIBBUILTIN(pthread_create, \"\", \"fC<2,3>\", PTHREAD_H, ALL_GNU_LANGUAGES)";
def PthreadCreate : GNULibBuiltin<"pthread.h"> {
let Spellings = ["pthread_create"];
let Attributes = [FunctionWithoutBuiltinPrefix, Callback<[2, 3]>];
// Note that we don't have an expressable prototype so we leave it empty.
let Prototype = "";
}

def SigSetJmp : LibBuiltin<"setjmp.h"> {
Expand Down
13 changes: 9 additions & 4 deletions clang/include/clang/Basic/BuiltinsBase.td
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class IndexedAttribute<string baseMangling, int I> : Attribute<baseMangling> {
int Index = I;
}

class MultiIndexAttribute<string baseMangling, list<int> Is>
: Attribute<baseMangling> {
list<int> Indices = Is;
}

// Standard Attributes
// -------------------
def NoReturn : Attribute<"r">;
Expand Down Expand Up @@ -77,6 +82,10 @@ def Constexpr : Attribute<"E">;
// Builtin is immediate and must be constant evaluated. Implies Constexpr, and will only be supported in C++20 mode.
def Consteval : Attribute<"EG">;

// Callback behavior: the first index argument is called with the arguments
// indicated by the remaining indices.
class Callback<list<int> ArgIndices> : MultiIndexAttribute<"C", ArgIndices>;

// Builtin kinds
// =============

Expand All @@ -92,10 +101,6 @@ class Builtin {
bit EnableOpenCLLong = 0;
}

class CustomEntry {
string Entry;
}

class AtomicBuiltin : Builtin;

class LibBuiltin<string header, string languages = "ALL_LANGUAGES"> : Builtin {
Expand Down
45 changes: 45 additions & 0 deletions clang/include/clang/Basic/BuiltinsHexagonDep.def
Original file line number Diff line number Diff line change
Expand Up @@ -1923,3 +1923,48 @@ TARGET_BUILTIN(__builtin_HEXAGON_V6_vmpy_sf_bf_acc, "V32iV32iV16iV16i", "", HVXV
TARGET_BUILTIN(__builtin_HEXAGON_V6_vmpy_sf_bf_acc_128B, "V64iV64iV32iV32i", "", HVXV73)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vsub_sf_bf, "V32iV16iV16i", "", HVXV73)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vsub_sf_bf_128B, "V64iV32iV32i", "", HVXV73)

// V79 HVX Instructions.

TARGET_BUILTIN(__builtin_HEXAGON_V6_get_qfext, "V16iV16ii", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_get_qfext_128B, "V32iV32ii", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_get_qfext_oracc, "V16iV16iV16ii", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_get_qfext_oracc_128B, "V32iV32iV32ii", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_set_qfext, "V16iV16ii", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_set_qfext_128B, "V32iV32ii", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vabs_f8, "V16iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vabs_f8_128B, "V32iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vadd_hf_f8, "V32iV16iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vadd_hf_f8_128B, "V64iV32iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vcvt2_b_hf, "V16iV16iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vcvt2_b_hf_128B, "V32iV32iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vcvt2_hf_b, "V32iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vcvt2_hf_b_128B, "V64iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vcvt2_hf_ub, "V32iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vcvt2_hf_ub_128B, "V64iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vcvt2_ub_hf, "V16iV16iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vcvt2_ub_hf_128B, "V32iV32iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vcvt_f8_hf, "V16iV16iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vcvt_f8_hf_128B, "V32iV32iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vcvt_hf_f8, "V32iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vcvt_hf_f8_128B, "V64iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vfmax_f8, "V16iV16iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vfmax_f8_128B, "V32iV32iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vfmin_f8, "V16iV16iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vfmin_f8_128B, "V32iV32iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vfneg_f8, "V16iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vfneg_f8_128B, "V32iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vmerge_qf, "V16iV16iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vmerge_qf_128B, "V32iV32iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vmpy_hf_f8, "V32iV16iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vmpy_hf_f8_128B, "V64iV32iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vmpy_hf_f8_acc, "V32iV32iV16iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vmpy_hf_f8_acc_128B, "V64iV64iV32iV32i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vmpy_rt_hf, "V16iV16ii", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vmpy_rt_hf_128B, "V32iV32ii", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vmpy_rt_qf16, "V16iV16ii", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vmpy_rt_qf16_128B, "V32iV32ii", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vmpy_rt_sf, "V16iV16ii", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vmpy_rt_sf_128B, "V32iV32ii", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vsub_hf_f8, "V32iV16iV16i", "", HVXV79)
TARGET_BUILTIN(__builtin_HEXAGON_V6_vsub_hf_f8_128B, "V64iV32iV32i", "", HVXV79)
10 changes: 10 additions & 0 deletions clang/include/clang/Basic/DiagnosticASTKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,16 @@ def note_constexpr_assumption_failed : Note<
def err_experimental_clang_interp_failed : Error<
"the experimental clang interpreter failed to evaluate an expression">;

def warn_attribute_needs_aggregate : Warning<
"%0 attribute is ignored in non-aggregate type %1">,
InGroup<IgnoredAttributes>;

def warn_cxx20_compat_requires_explicit_init_non_aggregate : Warning<
"explicit initialization of field %1 will not be enforced in C++20 and later "
"because %2 has a user-declared constructor, making the type no longer an "
"aggregate">,
DefaultIgnore, InGroup<CXX20Compat>;

def warn_integer_constant_overflow : Warning<
"overflow in expression; result is %0 with type %1">,
InGroup<DiagGroup<"integer-overflow">>;
Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/Basic/DiagnosticGroups.td
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ def Trigraphs : DiagGroup<"trigraphs">;
def UndefinedReinterpretCast : DiagGroup<"undefined-reinterpret-cast">;
def ReinterpretBaseClass : DiagGroup<"reinterpret-base-class">;
def Unicode : DiagGroup<"unicode">;
def UninitializedExplicitInit : DiagGroup<"uninitialized-explicit-init">;
def UninitializedMaybe : DiagGroup<"conditional-uninitialized">;
def UninitializedSometimes : DiagGroup<"sometimes-uninitialized">;
def UninitializedStaticSelfInit : DiagGroup<"static-self-init">;
Expand Down
3 changes: 3 additions & 0 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -2347,6 +2347,9 @@ def err_init_reference_member_uninitialized : Error<
"reference member of type %0 uninitialized">;
def note_uninit_reference_member : Note<
"uninitialized reference member is here">;
def warn_field_requires_explicit_init : Warning<
"field %select{%1|in %1}0 requires explicit initialization but is not "
"explicitly initialized">, InGroup<UninitializedExplicitInit>;
def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
InGroup<Uninitialized>;
def warn_base_class_is_uninit : Warning<
Expand Down
4 changes: 2 additions & 2 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -4212,7 +4212,7 @@ defm ms_tls_guards : BoolFOption<"ms-tls-guards",
"Do not emit code to perform on-demand initialization of thread-local variables">,
PosFlag<SetTrue>>;
def ftime_report : Flag<["-"], "ftime-report">, Group<f_Group>,
Visibility<[ClangOption, CC1Option]>,
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
MarshallingInfoFlag<CodeGenOpts<"TimePasses">>;
def ftime_report_EQ: Joined<["-"], "ftime-report=">, Group<f_Group>,
Visibility<[ClangOption, CC1Option]>, Values<"per-pass,per-pass-run">,
Expand Down Expand Up @@ -4468,7 +4468,7 @@ defm split_machine_functions: BoolFOption<"split-machine-functions",
CodeGenOpts<"SplitMachineFunctions">, DefaultFalse,
PosFlag<SetTrue, [], [ClangOption, CC1Option], "Enable">,
NegFlag<SetFalse, [], [ClangOption], "Disable">,
BothFlags<[], [ClangOption], " late function splitting using profile information (x86 ELF)">>;
BothFlags<[], [ClangOption], " late function splitting using profile information (x86 and aarch64 ELF)">>;

defm strict_return : BoolFOption<"strict-return",
CodeGenOpts<"StrictReturn">, DefaultTrue,
Expand Down
Loading

0 comments on commit c1723a6

Please sign in to comment.