Skip to content

Commit f95562d

Browse files
committed
Merge branch 'main' into temp_new
2 parents 1a73ca6 + 3e64f8a commit f95562d

File tree

901 files changed

+24004
-13036
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

901 files changed

+24004
-13036
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function add-dependencies() {
108108
compiler-rt|libc|openmp)
109109
echo clang lld
110110
;;
111-
flang|lldb)
111+
flang|lldb|libclc)
112112
for p in llvm clang; do
113113
echo $p
114114
done

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ clang/test/AST/Interp/ @tbaederr
113113

114114
# MLIR NVVM Dialect in MLIR
115115
/mlir/**/LLVMIR/**/BasicPtxBuilderInterface* @grypp
116-
/mlir/**/NVVM*/ @grypp
116+
/mlir/**/NVVM* @grypp
117117

118118
# MLIR Python Bindings
119119
/mlir/test/python/ @makslevental @stellaraccident

.github/new-prs-labeler.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
ClangIR:
2+
- clang/include/clang/CIR/**/*
3+
- clang/lib/CIR/**/*
4+
- clang/tools/cir-*/**/*
5+
- clang/test/CIR/**/*
6+
17
clang:dataflow:
28
- clang/include/clang/Analysis/FlowSensitive/**/*
39
- clang/lib/Analysis/FlowSensitive/**/*
@@ -938,3 +944,6 @@ openmp:libomptarget:
938944

939945
bazel:
940946
- utils/bazel/**
947+
948+
offload:
949+
- offload/**

clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void ForwardingReferenceOverloadCheck::registerMatchers(MatchFinder *Finder) {
7272

7373
DeclarationMatcher FindOverload =
7474
cxxConstructorDecl(
75-
hasParameter(0, ForwardingRefParm),
75+
hasParameter(0, ForwardingRefParm), unless(isDeleted()),
7676
unless(hasAnyParameter(
7777
// No warning: enable_if as constructor parameter.
7878
parmVarDecl(hasType(isEnableIf())))),

clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ void ProTypeMemberInitCheck::checkMissingMemberInitializer(
444444
if (!F->hasInClassInitializer() &&
445445
utils::type_traits::isTriviallyDefaultConstructible(F->getType(),
446446
Context) &&
447-
!isEmpty(Context, F->getType()) && !F->isUnnamedBitfield() &&
447+
!isEmpty(Context, F->getType()) && !F->isUnnamedBitField() &&
448448
!AnyMemberHasInitPerUnion)
449449
FieldsToInit.insert(F);
450450
});

clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ getAllNamedFields(const CXXRecordDecl *Record) {
2626
std::set<const FieldDecl *> Result;
2727
for (const auto *Field : Record->fields()) {
2828
// Static data members are not in this range.
29-
if (Field->isUnnamedBitfield())
29+
if (Field->isUnnamedBitField())
3030
continue;
3131
Result.insert(Field);
3232
}

clang-tools-extra/clang-tidy/utils/ExceptionSpecAnalyzer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ ExceptionSpecAnalyzer::analyzeRecord(const CXXRecordDecl *RecordDecl,
9999
}
100100

101101
for (const auto *FDecl : RecordDecl->fields())
102-
if (!FDecl->isInvalidDecl() && !FDecl->isUnnamedBitfield()) {
102+
if (!FDecl->isInvalidDecl() && !FDecl->isUnnamedBitField()) {
103103
State Result = analyzeFieldDecl(FDecl, Kind);
104104
if (Result == State::Throwing || Result == State::Unknown)
105105
return Result;

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ Changes in existing checks
147147
<clang-tidy/checks/bugprone/assert-side-effect>` check by detecting side
148148
effect from calling a method with non-const reference parameters.
149149

150+
- Improved :doc:`bugprone-forwarding-reference-overload
151+
<clang-tidy/checks/bugprone/forwarding-reference-overload>`
152+
check to ignore deleted constructors which won't hide other overloads.
153+
150154
- Improved :doc:`bugprone-inc-dec-in-conditions
151155
<clang-tidy/checks/bugprone/inc-dec-in-conditions>` check to ignore code
152156
within unevaluated contexts, such as ``decltype``.

clang-tools-extra/docs/clang-tidy/checks/bugprone/sizeof-expression.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,6 @@ Options
190190

191191
.. option:: WarnOnSizeOfPointerToAggregate
192192

193-
When `true, the check will warn on an expression like
193+
When `true`, the check will warn on an expression like
194194
``sizeof(expr)`` where the expression is a pointer
195195
to aggregate. Default is `true`.

clang-tools-extra/test/clang-tidy/checkers/bugprone/forwarding-reference-overload.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,13 @@ class Test10 {
251251
Test10(T &&Item, E e)
252252
: e(e){}
253253
};
254+
255+
// A deleted ctor cannot hide anything
256+
class Test11 {
257+
public:
258+
template <typename T>
259+
Test11(T&&) = delete;
260+
261+
Test11(const Test11 &) = default;
262+
Test11(Test11 &&) = default;
263+
};

clang/docs/StandardCPlusPlusModules.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,13 @@ violations with the flag enabled.
483483
ABI Impacts
484484
-----------
485485

486+
This section describes the new ABI changes brought by modules.
487+
488+
Only Itanium C++ ABI related change are mentioned
489+
490+
Mangling Names
491+
~~~~~~~~~~~~~~
492+
486493
The declarations in a module unit which are not in the global module fragment have new linkage names.
487494

488495
For example,
@@ -520,6 +527,23 @@ is attached to the global module fragments. For example:
520527

521528
Now the linkage name of ``NS::foo()`` will be ``_ZN2NS3fooEv``.
522529

530+
Module Initializers
531+
~~~~~~~~~~~~~~~~~~~
532+
533+
All the importable module units are required to emit an initializer function.
534+
The initializer function should contain calls to importing modules first and
535+
all the dynamic-initializers in the current module unit then.
536+
537+
Translation units explicitly or implicitly importing named modules must call
538+
the initializer functions of the imported named modules within the sequence of
539+
the dynamic-initializers in the TU. Initializations of entities at namespace
540+
scope are appearance-ordered. This (recursively) extends into imported modules
541+
at the point of appearance of the import declaration.
542+
543+
It is allowed to omit calls to importing modules if it is known empty.
544+
545+
It is allowed to omit calls to importing modules for which is known to be called.
546+
523547
Reduced BMI
524548
-----------
525549

clang/include/clang/AST/ASTMutationListener.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace clang {
2727
class FunctionTemplateDecl;
2828
class Module;
2929
class NamedDecl;
30+
class NamespaceDecl;
3031
class ObjCCategoryDecl;
3132
class ObjCContainerDecl;
3233
class ObjCInterfaceDecl;
@@ -35,6 +36,7 @@ namespace clang {
3536
class QualType;
3637
class RecordDecl;
3738
class TagDecl;
39+
class TranslationUnitDecl;
3840
class ValueDecl;
3941
class VarDecl;
4042
class VarTemplateDecl;
@@ -147,6 +149,31 @@ class ASTMutationListener {
147149
virtual void AddedAttributeToRecord(const Attr *Attr,
148150
const RecordDecl *Record) {}
149151

152+
/// The parser find the named module declaration.
153+
virtual void EnteringModulePurview() {}
154+
155+
/// An mangling number was added to a Decl
156+
///
157+
/// \param D The decl that got a mangling number
158+
///
159+
/// \param Number The mangling number that was added to the Decl
160+
virtual void AddedManglingNumber(const Decl *D, unsigned Number) {}
161+
162+
/// An static local number was added to a Decl
163+
///
164+
/// \param D The decl that got a static local number
165+
///
166+
/// \param Number The static local number that was added to the Decl
167+
virtual void AddedStaticLocalNumbers(const Decl *D, unsigned Number) {}
168+
169+
/// An anonymous namespace was added the translation unit decl
170+
///
171+
/// \param TU The translation unit decl that got a new anonymous namespace
172+
///
173+
/// \param AnonNamespace The anonymous namespace that was added
174+
virtual void AddedAnonymousNamespace(const TranslationUnitDecl *TU,
175+
NamespaceDecl *AnonNamespace) {}
176+
150177
// NOTE: If new methods are added they should also be added to
151178
// MultiplexASTMutationListener.
152179
};

clang/include/clang/AST/Decl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class TranslationUnitDecl : public Decl,
120120
ASTContext &getASTContext() const { return Ctx; }
121121

122122
NamespaceDecl *getAnonymousNamespace() const { return AnonymousNamespace; }
123-
void setAnonymousNamespace(NamespaceDecl *D) { AnonymousNamespace = D; }
123+
void setAnonymousNamespace(NamespaceDecl *D);
124124

125125
static TranslationUnitDecl *Create(ASTContext &C);
126126

@@ -3149,7 +3149,7 @@ class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
31493149
bool isBitField() const { return BitField; }
31503150

31513151
/// Determines whether this is an unnamed bitfield.
3152-
bool isUnnamedBitfield() const { return isBitField() && !getDeclName(); }
3152+
bool isUnnamedBitField() const { return isBitField() && !getDeclName(); }
31533153

31543154
/// Determines whether this field is a
31553155
/// representative for an anonymous struct or union. Such fields are

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,9 +1412,6 @@ def MultiGPU: DiagGroup<"multi-gpu">;
14121412
// libc and the CRT to be skipped.
14131413
def AVRRtlibLinkingQuirks : DiagGroup<"avr-rtlib-linking-quirks">;
14141414

1415-
// A warning group related to AArch64 SME function attribues.
1416-
def AArch64SMEAttributes : DiagGroup<"aarch64-sme-attributes">;
1417-
14181415
// A warning group for things that will change semantics in the future.
14191416
def FutureCompat : DiagGroup<"future-compat">;
14201417

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,8 @@ def err_empty_requires_expr : Error<
863863
"a requires expression must contain at least one requirement">;
864864
def err_requires_expr_parameter_list_ellipsis : Error<
865865
"varargs not allowed in requires expression">;
866+
def err_requires_expr_explicit_object_parameter: Error<
867+
"a requires expression cannot have an explicit object parameter">;
866868
def err_expected_semi_requirement : Error<
867869
"expected ';' at end of requirement">;
868870
def err_requires_expr_missing_arrow : Error<

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3751,16 +3751,6 @@ def err_sme_definition_using_za_in_non_sme_target : Error<
37513751
"function using ZA state requires 'sme'">;
37523752
def err_sme_definition_using_zt0_in_non_sme2_target : Error<
37533753
"function using ZT0 state requires 'sme2'">;
3754-
def warn_sme_streaming_pass_return_vl_to_non_streaming : Warning<
3755-
"passing a VL-dependent argument to/from a function that has a different"
3756-
" streaming-mode. The streaming and non-streaming vector lengths may be"
3757-
" different">,
3758-
InGroup<AArch64SMEAttributes>, DefaultIgnore;
3759-
def warn_sme_locally_streaming_has_vl_args_returns : Warning<
3760-
"passing/returning a VL-dependent argument to/from a __arm_locally_streaming"
3761-
" function. The streaming and non-streaming vector"
3762-
" lengths may be different">,
3763-
InGroup<AArch64SMEAttributes>, DefaultIgnore;
37643754
def err_conflicting_attributes_arm_state : Error<
37653755
"conflicting attributes for state '%0'">;
37663756
def err_sme_streaming_cannot_be_multiversioned : Error<

clang/include/clang/Sema/Lookup.h

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -153,28 +153,30 @@ class LookupResult {
153153

154154
using iterator = UnresolvedSetImpl::iterator;
155155

156-
LookupResult(Sema &SemaRef, const DeclarationNameInfo &NameInfo,
157-
Sema::LookupNameKind LookupKind,
158-
Sema::RedeclarationKind Redecl = Sema::NotForRedeclaration)
156+
LookupResult(
157+
Sema &SemaRef, const DeclarationNameInfo &NameInfo,
158+
Sema::LookupNameKind LookupKind,
159+
RedeclarationKind Redecl = RedeclarationKind::NotForRedeclaration)
159160
: SemaPtr(&SemaRef), NameInfo(NameInfo), LookupKind(LookupKind),
160-
Redecl(Redecl != Sema::NotForRedeclaration),
161-
ExternalRedecl(Redecl == Sema::ForExternalRedeclaration),
162-
DiagnoseAccess(Redecl == Sema::NotForRedeclaration),
163-
DiagnoseAmbiguous(Redecl == Sema::NotForRedeclaration) {
161+
Redecl(Redecl != RedeclarationKind::NotForRedeclaration),
162+
ExternalRedecl(Redecl == RedeclarationKind::ForExternalRedeclaration),
163+
DiagnoseAccess(Redecl == RedeclarationKind::NotForRedeclaration),
164+
DiagnoseAmbiguous(Redecl == RedeclarationKind::NotForRedeclaration) {
164165
configure();
165166
}
166167

167168
// TODO: consider whether this constructor should be restricted to take
168169
// as input a const IdentifierInfo* (instead of Name),
169170
// forcing other cases towards the constructor taking a DNInfo.
170-
LookupResult(Sema &SemaRef, DeclarationName Name, SourceLocation NameLoc,
171-
Sema::LookupNameKind LookupKind,
172-
Sema::RedeclarationKind Redecl = Sema::NotForRedeclaration)
171+
LookupResult(
172+
Sema &SemaRef, DeclarationName Name, SourceLocation NameLoc,
173+
Sema::LookupNameKind LookupKind,
174+
RedeclarationKind Redecl = RedeclarationKind::NotForRedeclaration)
173175
: SemaPtr(&SemaRef), NameInfo(Name, NameLoc), LookupKind(LookupKind),
174-
Redecl(Redecl != Sema::NotForRedeclaration),
175-
ExternalRedecl(Redecl == Sema::ForExternalRedeclaration),
176-
DiagnoseAccess(Redecl == Sema::NotForRedeclaration),
177-
DiagnoseAmbiguous(Redecl == Sema::NotForRedeclaration) {
176+
Redecl(Redecl != RedeclarationKind::NotForRedeclaration),
177+
ExternalRedecl(Redecl == RedeclarationKind::ForExternalRedeclaration),
178+
DiagnoseAccess(Redecl == RedeclarationKind::NotForRedeclaration),
179+
DiagnoseAmbiguous(Redecl == RedeclarationKind::NotForRedeclaration) {
178180
configure();
179181
}
180182

@@ -285,9 +287,10 @@ class LookupResult {
285287
return ExternalRedecl;
286288
}
287289

288-
Sema::RedeclarationKind redeclarationKind() const {
289-
return ExternalRedecl ? Sema::ForExternalRedeclaration :
290-
Redecl ? Sema::ForVisibleRedeclaration : Sema::NotForRedeclaration;
290+
RedeclarationKind redeclarationKind() const {
291+
return ExternalRedecl ? RedeclarationKind::ForExternalRedeclaration
292+
: Redecl ? RedeclarationKind::ForVisibleRedeclaration
293+
: RedeclarationKind::NotForRedeclaration;
291294
}
292295

293296
/// Specify whether hidden declarations are visible, e.g.,
@@ -615,9 +618,9 @@ class LookupResult {
615618
}
616619

617620
/// Change this lookup's redeclaration kind.
618-
void setRedeclarationKind(Sema::RedeclarationKind RK) {
619-
Redecl = (RK != Sema::NotForRedeclaration);
620-
ExternalRedecl = (RK == Sema::ForExternalRedeclaration);
621+
void setRedeclarationKind(RedeclarationKind RK) {
622+
Redecl = (RK != RedeclarationKind::NotForRedeclaration);
623+
ExternalRedecl = (RK == RedeclarationKind::ForExternalRedeclaration);
621624
configure();
622625
}
623626

clang/include/clang/Sema/ParsedAttr.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ struct PropertyData {
9494
: GetterId(getterId), SetterId(setterId) {}
9595
};
9696

97-
} // namespace
97+
} // namespace detail
9898

9999
/// Wraps an identifier and optional source location for the identifier.
100100
struct IdentifierLoc {
@@ -743,11 +743,6 @@ class AttributePool {
743743
IdentifierInfo *scopeName, SourceLocation scopeLoc,
744744
ArgsUnion *args, unsigned numArgs, ParsedAttr::Form form,
745745
SourceLocation ellipsisLoc = SourceLocation()) {
746-
size_t temp =
747-
ParsedAttr::totalSizeToAlloc<ArgsUnion, detail::AvailabilityData,
748-
detail::TypeTagForDatatypeData, ParsedType,
749-
detail::PropertyData>(numArgs, 0, 0, 0, 0);
750-
(void)temp;
751746
void *memory = allocate(
752747
ParsedAttr::totalSizeToAlloc<ArgsUnion, detail::AvailabilityData,
753748
detail::TypeTagForDatatypeData, ParsedType,
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//===- Redeclaration.h - Redeclarations--------------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file defines RedeclarationKind enum.
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef LLVM_CLANG_SEMA_REDECLARATION_H
14+
#define LLVM_CLANG_SEMA_REDECLARATION_H
15+
16+
/// Specifies whether (or how) name lookup is being performed for a
17+
/// redeclaration (vs. a reference).
18+
enum class RedeclarationKind {
19+
/// The lookup is a reference to this name that is not for the
20+
/// purpose of redeclaring the name.
21+
NotForRedeclaration = 0,
22+
/// The lookup results will be used for redeclaration of a name,
23+
/// if an entity by that name already exists and is visible.
24+
ForVisibleRedeclaration,
25+
/// The lookup results will be used for redeclaration of a name
26+
/// with external linkage; non-visible lookup results with external linkage
27+
/// may also be found.
28+
ForExternalRedeclaration
29+
};
30+
31+
#endif // LLVM_CLANG_SEMA_REDECLARATION_H

clang/include/clang/Sema/Scope.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ class Scope {
156156
/// This is the scope of an OpenACC Compute Construct, which restricts
157157
/// jumping into/out of it.
158158
OpenACCComputeConstructScope = 0x10000000,
159+
160+
/// This is a scope of type alias declaration.
161+
TypeAliasScope = 0x20000000,
159162
};
160163

161164
private:
@@ -580,6 +583,9 @@ class Scope {
580583
/// if/switch/while/for statement.
581584
bool isControlScope() const { return getFlags() & Scope::ControlScope; }
582585

586+
/// Determine whether this scope is a type alias scope.
587+
bool isTypeAliasScope() const { return getFlags() & Scope::TypeAliasScope; }
588+
583589
/// Returns if rhs has a higher scope depth than this.
584590
///
585591
/// The caller is responsible for calling this only if one of the two scopes

0 commit comments

Comments
 (0)