Skip to content

Commit 9b25fca

Browse files
authored
merge main into amd-staging (#3227)
2 parents 0757ea3 + 23f7b68 commit 9b25fca

194 files changed

Lines changed: 8815 additions & 3081 deletions

File tree

Some content is hidden

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

.github/workflows/libcxx-run-benchmarks.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,13 @@ jobs:
9999
cc: clang
100100
cxx: clang++
101101
install-python: false
102+
install-macos-dependencies: true
102103
- platform: Linux x86_64
103104
runner: llvm-premerge-libcxx-next-runners
104105
cc: clang-22
105106
cxx: clang++-22
106107
install-python: true
108+
install-macos-dependencies: false
107109
fail-fast: false
108110
permissions:
109111
pull-requests: write
@@ -127,6 +129,11 @@ jobs:
127129
with:
128130
python-version: '3.14'
129131

132+
- name: Install Ninja and CMake
133+
if: ${{ matrix.install-macos-dependencies }}
134+
run: |
135+
brew install ninja cmake
136+
130137
- name: Setup virtual environment
131138
run: |
132139
python3 -m venv .venv

clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void DefinitionsInHeadersCheck::check(const MatchFinder::MatchResult &Result) {
106106
return;
107107
diag(FD->getLocation(), "mark the definition as 'inline'",
108108
DiagnosticIDs::Note)
109-
<< FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
109+
<< FixItHint::CreateInsertion(FD->getFunctionLocStart(), "inline ");
110110
} else if (const auto *VD = dyn_cast<VarDecl>(ND)) {
111111
// C++14 variable templates are allowed.
112112
if (VD->getDescribedVarTemplate())

clang-tools-extra/clangd/SemanticHighlighting.cpp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -590,28 +590,28 @@ class CollectExtraHighlightings
590590

591591
bool
592592
VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D) {
593-
if (auto *Args = D->getTemplateArgsAsWritten())
594-
H.addAngleBracketTokens(Args->getLAngleLoc(), Args->getRAngleLoc());
595-
return true;
596-
}
597-
598-
bool VisitClassTemplatePartialSpecializationDecl(
599-
ClassTemplatePartialSpecializationDecl *D) {
600-
if (auto *TPL = D->getTemplateParameters())
601-
H.addAngleBracketTokens(TPL->getLAngleLoc(), TPL->getRAngleLoc());
593+
if (const auto *Info = D->getExplicitInstantiationInfo()) {
594+
H.addAngleBracketTokens(Info->TemplateArgsAsWritten->getLAngleLoc(),
595+
Info->TemplateArgsAsWritten->getRAngleLoc());
596+
} else if (const auto *Info = D->getExplicitSpecializationInfo()) {
597+
H.addAngleBracketTokens(Info->TemplateParams->getLAngleLoc(),
598+
Info->TemplateParams->getRAngleLoc());
599+
H.addAngleBracketTokens(Info->TemplateArgsAsWritten->getLAngleLoc(),
600+
Info->TemplateArgsAsWritten->getRAngleLoc());
601+
}
602602
return true;
603603
}
604604

605605
bool VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D) {
606-
if (auto *Args = D->getTemplateArgsAsWritten())
607-
H.addAngleBracketTokens(Args->getLAngleLoc(), Args->getRAngleLoc());
608-
return true;
609-
}
610-
611-
bool VisitVarTemplatePartialSpecializationDecl(
612-
VarTemplatePartialSpecializationDecl *D) {
613-
if (auto *TPL = D->getTemplateParameters())
614-
H.addAngleBracketTokens(TPL->getLAngleLoc(), TPL->getRAngleLoc());
606+
if (const auto *Info = D->getExplicitInstantiationInfo()) {
607+
H.addAngleBracketTokens(Info->TemplateArgsAsWritten->getLAngleLoc(),
608+
Info->TemplateArgsAsWritten->getRAngleLoc());
609+
} else if (const auto *Info = D->getExplicitSpecializationInfo()) {
610+
H.addAngleBracketTokens(Info->TemplateParams->getLAngleLoc(),
611+
Info->TemplateParams->getRAngleLoc());
612+
H.addAngleBracketTokens(Info->TemplateArgsAsWritten->getLAngleLoc(),
613+
Info->TemplateArgsAsWritten->getRAngleLoc());
614+
}
615615
return true;
616616
}
617617

@@ -625,6 +625,9 @@ class CollectExtraHighlightings
625625
}
626626

627627
bool VisitFunctionDecl(FunctionDecl *D) {
628+
if (const TemplateParameterList *TPL =
629+
D->getTemplateSpecializationParameters())
630+
H.addAngleBracketTokens(TPL->getLAngleLoc(), TPL->getRAngleLoc());
628631
if (D->isOverloadedOperator()) {
629632
const auto AddOpDeclToken = [&](SourceLocation Loc) {
630633
auto &Token = H.addToken(Loc, HighlightingKind::Operator)

clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ addInlineIfInHeader(const FunctionDecl *FD) {
364364
if (!isHeaderFile(FileName, FD->getASTContext().getLangOpts()))
365365
return std::nullopt;
366366

367-
return tooling::Replacement(SM, FD->getInnerLocStart(), 0, "inline ");
367+
return tooling::Replacement(SM, FD->getFunctionLocStart(), 0, "inline ");
368368
}
369369

370370
/// Moves definition of a function/method to its declaration location.

clang/docs/LibASTMatchersReference.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4301,6 +4301,11 @@ <h2 id="narrowing-matchers">Narrowing Matchers</h2>
43014301
</pre></td></tr>
43024302

43034303

4304+
<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('declaresSameEntityAsNode0')"><a name="declaresSameEntityAsNode0Anchor">declaresSameEntityAsNode</a></td><td>const Decl * Other</td></tr>
4305+
<tr><td colspan="4" class="doc" id="declaresSameEntityAsNode0"><pre>Matches a declaration if it declares the same entity as the node.
4306+
</pre></td></tr>
4307+
4308+
43044309
<tr><td>Matcher&lt;<a href="https://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>&gt;</td><td class="name" onclick="toggle('equalsBoundNode1')"><a name="equalsBoundNode1Anchor">equalsBoundNode</a></td><td>std::string ID</td></tr>
43054310
<tr><td colspan="4" class="doc" id="equalsBoundNode1"><pre>Matches if a node equals a previously bound node.
43064311

clang/docs/ReleaseNotes.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ latest release, please see the [Clang Web Site](https://clang.llvm.org) or the
145145
break on i686, MIPS O32, PowerPC64 ELFv1, and Lanai.
146146
- Fixed incorrect struct return when single large vector (256/512-bit) used on
147147
x86-64 targets. (#GH203760) The bug was introduced since Clang 21. (#GH120670)
148+
- Clang now applies MSVC's MD5 shortening to over-long Microsoft C++ RTTI type
149+
descriptor name strings, matching the behavior already used for the RTTI
150+
symbol names. Previously the full name string was always emitted, so deeply
151+
nested template types (for example, ones containing local lambdas) could
152+
produce very large writable `.data` sections. Emitted RTTI name strings
153+
change only for types whose name exceeds the length limit. (#GH206313)
148154

149155
### AST Dumping Potentially Breaking Changes
150156

@@ -678,9 +684,6 @@ latest release, please see the [Clang Web Site](https://clang.llvm.org) or the
678684
- Clang now rejects inline asm constraints and clobbers that contain an
679685
embedded null character, instead of silently truncating them. (#GH173900)
680686

681-
- Added `-Wstringop-overread` to warn when `memcpy`, `memmove`, `memcmp`,
682-
and related builtins read more bytes than the source buffer size (#GH83728).
683-
684687
- Diagnostics for the C++11 range-based for statement now report the correct
685688
iterator type in notes for invalid iterator types.
686689

@@ -807,6 +810,7 @@ latest release, please see the [Clang Web Site](https://clang.llvm.org) or the
807810
- Fixed an alias template CTAD crash.
808811
- Correctly diagnose uses of `co_await` / `co_yield` in the default argument of nested function declarations. (#GH98923)
809812
- Fixed a crash when diagnosing an invalid static member function with an explicit object parameter (#GH177741)
813+
- Fixed clang incorrectly rejecting several cases of out-of-line definitions. (#GH101330)
810814
- Clang incorrectly instantiated variable specializations outside of the immediate context. (#GH54439)
811815
- Fixed a crash when pack expansions are used as arguments for non-pack parameters of built-in templates. (#GH180307)
812816
- Fixed crash instantiating class member specializations.

clang/include/clang/AST/Decl.h

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,34 +2131,6 @@ class FunctionDecl : public DeclaratorDecl,
21312131
/// the DeclaratorDecl base class.
21322132
DeclarationNameLoc DNLoc;
21332133

2134-
/// Specify that this function declaration is actually a function
2135-
/// template specialization.
2136-
///
2137-
/// \param C the ASTContext.
2138-
///
2139-
/// \param Template the function template that this function template
2140-
/// specialization specializes.
2141-
///
2142-
/// \param TemplateArgs the template arguments that produced this
2143-
/// function template specialization from the template.
2144-
///
2145-
/// \param InsertPos If non-NULL, the position in the function template
2146-
/// specialization set where the function template specialization data will
2147-
/// be inserted.
2148-
///
2149-
/// \param TSK the kind of template specialization this is.
2150-
///
2151-
/// \param TemplateArgsAsWritten location info of template arguments.
2152-
///
2153-
/// \param PointOfInstantiation point at which the function template
2154-
/// specialization was first instantiated.
2155-
void setFunctionTemplateSpecialization(
2156-
ASTContext &C, FunctionTemplateDecl *Template,
2157-
TemplateArgumentList *TemplateArgs, void *InsertPos,
2158-
TemplateSpecializationKind TSK,
2159-
const TemplateArgumentListInfo *TemplateArgsAsWritten,
2160-
SourceLocation PointOfInstantiation);
2161-
21622134
/// Specify that this record is an instantiation of the
21632135
/// member function FD.
21642136
void setInstantiationOfMemberFunction(ASTContext &C, FunctionDecl *FD,
@@ -2254,6 +2226,8 @@ class FunctionDecl : public DeclaratorDecl,
22542226
return SourceLocation();
22552227
}
22562228

2229+
SourceLocation getFunctionLocStart() const;
2230+
22572231
SourceRange getSourceRange() const override LLVM_READONLY;
22582232

22592233
// Function definitions.
@@ -3083,9 +3057,14 @@ class FunctionDecl : public DeclaratorDecl,
30833057
const ASTTemplateArgumentListInfo*
30843058
getTemplateSpecializationArgsAsWritten() const;
30853059

3060+
/// Returns the template parameter list for an explicit specialization.
3061+
const TemplateParameterList *getTemplateSpecializationParameters() const;
3062+
30863063
/// Specify that this function declaration is actually a function
30873064
/// template specialization.
30883065
///
3066+
/// \param C the ASTContext.
3067+
///
30893068
/// \param Template the function template that this function template
30903069
/// specialization specializes.
30913070
///
@@ -3098,25 +3077,30 @@ class FunctionDecl : public DeclaratorDecl,
30983077
///
30993078
/// \param TSK the kind of template specialization this is.
31003079
///
3080+
/// \param TemplateParams the template parameters if this is an explicit
3081+
/// specialization.
3082+
///
31013083
/// \param TemplateArgsAsWritten location info of template arguments.
31023084
///
31033085
/// \param PointOfInstantiation point at which the function template
31043086
/// specialization was first instantiated.
3087+
///
3088+
/// \param AddSpecialization whether to add this specialization to the
3089+
/// template's specialization set.
3090+
///
31053091
void setFunctionTemplateSpecialization(
3106-
FunctionTemplateDecl *Template, TemplateArgumentList *TemplateArgs,
3107-
void *InsertPos,
3108-
TemplateSpecializationKind TSK = TSK_ImplicitInstantiation,
3109-
TemplateArgumentListInfo *TemplateArgsAsWritten = nullptr,
3110-
SourceLocation PointOfInstantiation = SourceLocation()) {
3111-
setFunctionTemplateSpecialization(getASTContext(), Template, TemplateArgs,
3112-
InsertPos, TSK, TemplateArgsAsWritten,
3113-
PointOfInstantiation);
3114-
}
3092+
ASTContext &C, FunctionTemplateDecl *Template,
3093+
TemplateArgumentList *TemplateArgs, void *InsertPos,
3094+
TemplateSpecializationKind TSK,
3095+
const TemplateParameterList *TemplateParams,
3096+
const TemplateArgumentListInfo *TemplateArgsAsWritten,
3097+
SourceLocation PointOfInstantiation, bool AddSpecialization);
31153098

31163099
/// Specifies that this function declaration is actually a
31173100
/// dependent function template specialization.
31183101
void setDependentTemplateSpecialization(
31193102
ASTContext &Context, const UnresolvedSetImpl &Templates,
3103+
const TemplateParameterList *TemplateParams,
31203104
const TemplateArgumentListInfo *TemplateArgs);
31213105

31223106
DependentFunctionTemplateSpecializationInfo *

0 commit comments

Comments
 (0)