Skip to content

Commit a9865ce

Browse files
committed
Merge remote-tracking branch 'upstream/release/20.x' into rustc/20.1-2025-02-13
2 parents acaea3d + 58df0ef commit a9865ce

File tree

106 files changed

+2876
-1102
lines changed

Some content is hidden

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

106 files changed

+2876
-1102
lines changed

.github/workflows/libclang-abi-tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ jobs:
103103
uses: llvm/actions/install-ninja@main
104104
- name: Install abi-compliance-checker
105105
run: |
106-
sudo apt-get install abi-dumper autoconf pkg-config
106+
sudo apt-get update
107+
sudo apt-get install -y abi-dumper autoconf pkg-config
107108
- name: Install universal-ctags
108109
run: |
109110
git clone https://github.com/universal-ctags/ctags.git
@@ -154,7 +155,9 @@ jobs:
154155
path: build-latest
155156

156157
- name: Install abi-compliance-checker
157-
run: sudo apt-get install abi-compliance-checker
158+
run: |
159+
sudo apt-get update
160+
sudo apt-get install -y abi-compliance-checker
158161
- name: Compare ABI
159162
run: |
160163
for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do

.github/workflows/llvm-tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ jobs:
9191
uses: llvm/actions/install-ninja@main
9292
- name: Install abi-compliance-checker
9393
run: |
94-
sudo apt-get install abi-dumper autoconf pkg-config
94+
sudo apt-get update
95+
sudo apt-get -y install abi-dumper autoconf pkg-config
9596
- name: Install universal-ctags
9697
run: |
9798
git clone https://github.com/universal-ctags/ctags.git
@@ -163,7 +164,9 @@ jobs:
163164
path: symbol-list
164165

165166
- name: Install abi-compliance-checker
166-
run: sudo apt-get install abi-compliance-checker
167+
run: |
168+
sudo apt-get update
169+
sudo apt-get -y install abi-compliance-checker
167170
- name: Compare ABI
168171
run: |
169172
if [ -s symbol-list/llvm.symbols ]; then

clang/docs/ReleaseNotes.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,11 @@ New Compiler Flags
545545
- The ``-Warray-compare-cxx26`` warning has been added to warn about array comparison
546546
starting from C++26, this warning is enabled as an error by default.
547547

548+
- The ``-Wnontrivial-memcall`` warning has been added to warn about
549+
passing non-trivially-copyable destination parameter to ``memcpy``,
550+
``memset`` and similar functions for which it is a documented undefined
551+
behavior. It is implied by ``-Wnontrivial-memaccess``
552+
548553
- clang-cl and clang-dxc now support ``-fdiagnostics-color=[auto|never|always]``
549554
in addition to ``-f[no-]color-diagnostics``.
550555

@@ -576,11 +581,6 @@ Modified Compiler Flags
576581
to utilize these vector libraries. The behavior for all other vector function
577582
libraries remains unchanged.
578583

579-
- The ``-Wnontrivial-memcall`` warning has been added to warn about
580-
passing non-trivially-copyable destination parameter to ``memcpy``,
581-
``memset`` and similar functions for which it is a documented undefined
582-
behavior. It is implied by ``-Wnontrivial-memaccess``
583-
584584
- Added ``-fmodules-reduced-bmi`` flag corresponding to
585585
``-fexperimental-modules-reduced-bmi`` flag. The ``-fmodules-reduced-bmi`` flag
586586
is intended to be enabled by default in the future.
@@ -1058,8 +1058,13 @@ Bug Fixes to C++ Support
10581058
- Fixed a substitution bug in transforming CTAD aliases when the type alias contains a non-pack template argument
10591059
corresponding to a pack parameter (#GH124715)
10601060
- Clang is now better at keeping track of friend function template instance contexts. (#GH55509)
1061+
- Fixes matching of nested template template parameters. (#GH130362)
1062+
- Correctly diagnoses template template paramters which have a pack parameter
1063+
not in the last position.
10611064
- Fixed an integer overflow bug in computing template parameter depths when synthesizing CTAD guides. (#GH128691)
10621065
- Fixed an incorrect pointer access when checking access-control on concepts. (#GH131530)
1066+
- Fixed various alias CTAD bugs involving variadic template arguments. (#GH123591), (#GH127539), (#GH129077),
1067+
(#GH129620), and (#GH129998).
10631068

10641069
Bug Fixes to AST Handling
10651070
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Sema/Sema.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11279,14 +11279,16 @@ class Sema final : public SemaBase {
1127911279

1128011280
/// The context in which we are checking a template parameter list.
1128111281
enum TemplateParamListContext {
11282-
TPC_ClassTemplate,
11283-
TPC_VarTemplate,
11282+
// For this context, Class, Variable, TypeAlias, and non-pack Template
11283+
// Template Parameters are treated uniformly.
11284+
TPC_Other,
11285+
1128411286
TPC_FunctionTemplate,
1128511287
TPC_ClassTemplateMember,
1128611288
TPC_FriendClassTemplate,
1128711289
TPC_FriendFunctionTemplate,
1128811290
TPC_FriendFunctionTemplateDefinition,
11289-
TPC_TypeAliasTemplate
11291+
TPC_TemplateTemplateParameterPack,
1129011292
};
1129111293

1129211294
/// Checks the validity of a template parameter list, possibly

clang/include/clang/Support/Compiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#define CLANG_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
5555
#define CLANG_TEMPLATE_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
5656
#define CLANG_EXPORT_TEMPLATE
57-
#elif defined(__MACH__) || defined(__WASM__)
57+
#elif defined(__MACH__) || defined(__WASM__) || defined(__EMSCRIPTEN__)
5858
#define CLANG_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
5959
#define CLANG_TEMPLATE_ABI
6060
#define CLANG_EXPORT_TEMPLATE

clang/lib/Driver/ToolChains/Hexagon.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
313313
// handled somewhere else.
314314
Args.ClaimAllArgs(options::OPT_static_libgcc);
315315

316+
CmdArgs.push_back("--eh-frame-hdr");
316317
//----------------------------------------------------------------------------
317318
//
318319
//----------------------------------------------------------------------------
@@ -802,9 +803,7 @@ bool HexagonToolChain::isAutoHVXEnabled(const llvm::opt::ArgList &Args) {
802803
// Returns the default CPU for Hexagon. This is the default compilation target
803804
// if no Hexagon processor is selected at the command-line.
804805
//
805-
StringRef HexagonToolChain::GetDefaultCPU() {
806-
return "hexagonv60";
807-
}
806+
StringRef HexagonToolChain::GetDefaultCPU() { return "hexagonv68"; }
808807

809808
StringRef HexagonToolChain::GetTargetCPUVersion(const ArgList &Args) {
810809
Arg *CpuArg = nullptr;

clang/lib/Format/Format.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,10 +2114,14 @@ std::error_code parseConfiguration(llvm::MemoryBufferRef Config,
21142114
FormatStyle::FormatStyleSet StyleSet;
21152115
bool LanguageFound = false;
21162116
for (const FormatStyle &Style : llvm::reverse(Styles)) {
2117-
if (Style.Language != FormatStyle::LK_None)
2117+
const auto Lang = Style.Language;
2118+
if (Lang != FormatStyle::LK_None)
21182119
StyleSet.Add(Style);
2119-
if (Style.Language == Language)
2120+
if (Lang == Language ||
2121+
// For backward compatibility.
2122+
(Lang == FormatStyle::LK_Cpp && Language == FormatStyle::LK_C)) {
21202123
LanguageFound = true;
2124+
}
21212125
}
21222126
if (!LanguageFound) {
21232127
if (Styles.empty() || Styles[0].Language != FormatStyle::LK_None)
@@ -2157,8 +2161,14 @@ FormatStyle::FormatStyleSet::Get(FormatStyle::LanguageKind Language) const {
21572161
if (!Styles)
21582162
return std::nullopt;
21592163
auto It = Styles->find(Language);
2160-
if (It == Styles->end())
2161-
return std::nullopt;
2164+
if (It == Styles->end()) {
2165+
if (Language != FormatStyle::LK_C)
2166+
return std::nullopt;
2167+
// For backward compatibility.
2168+
It = Styles->find(FormatStyle::LK_Cpp);
2169+
if (It == Styles->end())
2170+
return std::nullopt;
2171+
}
21622172
FormatStyle Style = It->second;
21632173
Style.StyleSet = *this;
21642174
return Style;

clang/lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8145,7 +8145,7 @@ NamedDecl *Sema::ActOnVariableDeclarator(
81458145
(D.getCXXScopeSpec().isSet() && DC && DC->isRecord() &&
81468146
DC->isDependentContext())
81478147
? TPC_ClassTemplateMember
8148-
: TPC_VarTemplate))
8148+
: TPC_Other))
81498149
NewVD->setInvalidDecl();
81508150

81518151
// If we are providing an explicit specialization of a static variable

clang/lib/Sema/SemaDeclCXX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13533,7 +13533,7 @@ Decl *Sema::ActOnAliasDeclaration(Scope *S, AccessSpecifier AS,
1353313533
// Merge any previous default template arguments into our parameters,
1353413534
// and check the parameter list.
1353513535
if (CheckTemplateParameterList(TemplateParams, OldTemplateParams,
13536-
TPC_TypeAliasTemplate))
13536+
TPC_Other))
1353713537
return nullptr;
1353813538

1353913539
TypeAliasTemplateDecl *NewDecl =

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,8 +1591,16 @@ NamedDecl *Sema::ActOnTemplateTemplateParameter(
15911591
assert(S->isTemplateParamScope() &&
15921592
"Template template parameter not in template parameter scope!");
15931593

1594-
// Construct the parameter object.
15951594
bool IsParameterPack = EllipsisLoc.isValid();
1595+
1596+
bool Invalid = false;
1597+
if (CheckTemplateParameterList(
1598+
Params,
1599+
/*OldParams=*/nullptr,
1600+
IsParameterPack ? TPC_TemplateTemplateParameterPack : TPC_Other))
1601+
Invalid = true;
1602+
1603+
// Construct the parameter object.
15961604
TemplateTemplateParmDecl *Param = TemplateTemplateParmDecl::Create(
15971605
Context, Context.getTranslationUnitDecl(),
15981606
NameLoc.isInvalid() ? TmpLoc : NameLoc, Depth, Position, IsParameterPack,
@@ -1615,9 +1623,12 @@ NamedDecl *Sema::ActOnTemplateTemplateParameter(
16151623
if (Params->size() == 0) {
16161624
Diag(Param->getLocation(), diag::err_template_template_parm_no_parms)
16171625
<< SourceRange(Params->getLAngleLoc(), Params->getRAngleLoc());
1618-
Param->setInvalidDecl();
1626+
Invalid = true;
16191627
}
16201628

1629+
if (Invalid)
1630+
Param->setInvalidDecl();
1631+
16211632
// C++0x [temp.param]p9:
16221633
// A default template-argument may be specified for any kind of
16231634
// template-parameter that is not a template parameter pack.
@@ -2066,7 +2077,7 @@ DeclResult Sema::CheckClassTemplate(
20662077
SemanticContext->isDependentContext())
20672078
? TPC_ClassTemplateMember
20682079
: TUK == TagUseKind::Friend ? TPC_FriendClassTemplate
2069-
: TPC_ClassTemplate,
2080+
: TPC_Other,
20702081
SkipBody))
20712082
Invalid = true;
20722083

@@ -2208,9 +2219,8 @@ static bool DiagnoseDefaultTemplateArgument(Sema &S,
22082219
SourceLocation ParamLoc,
22092220
SourceRange DefArgRange) {
22102221
switch (TPC) {
2211-
case Sema::TPC_ClassTemplate:
2212-
case Sema::TPC_VarTemplate:
2213-
case Sema::TPC_TypeAliasTemplate:
2222+
case Sema::TPC_Other:
2223+
case Sema::TPC_TemplateTemplateParameterPack:
22142224
return false;
22152225

22162226
case Sema::TPC_FunctionTemplate:
@@ -2383,8 +2393,11 @@ bool Sema::CheckTemplateParameterList(TemplateParameterList *NewParams,
23832393
MissingDefaultArg = true;
23842394
} else if (NonTypeTemplateParmDecl *NewNonTypeParm
23852395
= dyn_cast<NonTypeTemplateParmDecl>(*NewParam)) {
2386-
// Check for unexpanded parameter packs.
2387-
if (!NewNonTypeParm->isParameterPack() &&
2396+
// Check for unexpanded parameter packs, except in a template template
2397+
// parameter pack, as in those any unexpanded packs should be expanded
2398+
// along with the parameter itself.
2399+
if (TPC != TPC_TemplateTemplateParameterPack &&
2400+
!NewNonTypeParm->isParameterPack() &&
23882401
DiagnoseUnexpandedParameterPack(NewNonTypeParm->getLocation(),
23892402
NewNonTypeParm->getTypeSourceInfo(),
23902403
UPPC_NonTypeTemplateParameterType)) {
@@ -2492,8 +2505,7 @@ bool Sema::CheckTemplateParameterList(TemplateParameterList *NewParams,
24922505
// If a template parameter of a primary class template or alias template
24932506
// is a template parameter pack, it shall be the last template parameter.
24942507
if (SawParameterPack && (NewParam + 1) != NewParamEnd &&
2495-
(TPC == TPC_ClassTemplate || TPC == TPC_VarTemplate ||
2496-
TPC == TPC_TypeAliasTemplate)) {
2508+
(TPC == TPC_Other || TPC == TPC_TemplateTemplateParameterPack)) {
24972509
Diag((*NewParam)->getLocation(),
24982510
diag::err_template_param_pack_must_be_last_template_parameter);
24992511
Invalid = true;
@@ -2526,8 +2538,8 @@ bool Sema::CheckTemplateParameterList(TemplateParameterList *NewParams,
25262538
<< PrevModuleName;
25272539
Invalid = true;
25282540
} else if (MissingDefaultArg &&
2529-
(TPC == TPC_ClassTemplate || TPC == TPC_FriendClassTemplate ||
2530-
TPC == TPC_VarTemplate || TPC == TPC_TypeAliasTemplate)) {
2541+
(TPC == TPC_Other || TPC == TPC_TemplateTemplateParameterPack ||
2542+
TPC == TPC_FriendClassTemplate)) {
25312543
// C++ 23[temp.param]p14:
25322544
// If a template-parameter of a class template, variable template, or
25332545
// alias template has a default template argument, each subsequent

0 commit comments

Comments
 (0)