Skip to content

Commit fa3a347

Browse files
authored
chore: update to llvm 22 at a1b6e7ff39
This brings our llvm to current development head.
1 parent 629f184 commit fa3a347

File tree

20 files changed

+116
-197
lines changed

20 files changed

+116
-197
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
clang: git build-essential pkg-config python3 curl openjdk-11-jdk pkg-config libncurses-dev libxml2-utils libxml2-dev g++-14=14.2.0-4ubuntu2~24.04
6767
msvc: ''
6868
extra-values: |
69-
llvm-hash: dd7a3d4d798e30dfe53b5bbbbcd9a23c24ea1af9
69+
llvm-hash: a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b
7070
llvm-build-preset-prefix: {{#if optimized-debug}}debwithopt{{else}}{{{lowercase build-type}}}{{/if}}
7171
llvm-build-preset-os: {{#if (ieq os 'windows') }}win{{else}}unix{{/if}}
7272
llvm-sanitizer: {{#if (eq compiler 'gcc')}}{{else if ubsan}}-UBSan{{else if asan}}-ASan{{else if msan}}-MSan{{/if}}

bootstrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class InstallOptions:
9797
llvm_build_dir: str = "<llvm-src-dir>/build/<llvm-build-type:lower><\"-\":if(cc)><cc:basename><\"-\":if(sanitizer)><sanitizer:lower>"
9898
llvm_install_dir: str = "<llvm-src-dir>/install/<llvm-build-type:lower><\"-\":if(cc)><cc:basename><\"-\":if(sanitizer)><sanitizer:lower>"
9999
llvm_repo: str = "https://github.com/llvm/llvm-project.git"
100-
llvm_commit: str = "dd7a3d4d798e30dfe53b5bbbbcd9a23c24ea1af9"
100+
llvm_commit: str = "a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b"
101101

102102
# Libxml2
103103
libxml2_src_dir: str = "<third-party-src-dir>/libxml2"

docs/modules/ROOT/pages/install.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ cd ..
259259
=== LLVM
260260
261261
MrDocs uses LLVM to parse C++ code and extract documentation from it.
262-
It depends on a recent version of LLVM: https://github.com/llvm/llvm-project/tree/dd7a3d4d798e30dfe53b5bbbbcd9a23c24ea1af9[dd7a3d4]
262+
It depends on a recent version of LLVM: https://github.com/llvm/llvm-project/tree/a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b[a1b6e7f]
263263
264264
**Download**:
265265
@@ -272,7 +272,7 @@ mkdir -p llvm-project <.>
272272
cd llvm-project
273273
git init <.>
274274
git remote add origin https://github.com/llvm/llvm-project.git <.>
275-
git fetch --depth 1 origin dd7a3d4d798e30dfe53b5bbbbcd9a23c24ea1af9 <.>
275+
git fetch --depth 1 origin a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b <.>
276276
git checkout FETCH_HEAD <.>
277277
----
278278

src/lib/AST/ASTVisitor.cpp

Lines changed: 29 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ ASTVisitor(
6767
// ASTContext::setTraversalScope is being (erroneously)
6868
// used somewhere
6969
MRDOCS_ASSERT(context_.getTraversalScope() ==
70-
std::vector<Decl*>{context_.getTranslationUnitDecl()});
70+
ArrayRef<Decl *>{context_.getTranslationUnitDecl()});
7171
}
7272

7373
void
@@ -466,7 +466,7 @@ generateUSR(Decl const* D) const
466466
if(auto* FD = dyn_cast<FunctionDecl>(Templated);
467467
FD && FD->getTrailingRequiresClause())
468468
{
469-
Expr const* RC = FD->getTrailingRequiresClause();
469+
Expr const* RC = FD->getTrailingRequiresClause().ConstraintExpr;
470470
RC = SubstituteConstraintExpressionWithoutSatisfaction(
471471
sema_, cast<NamedDecl>(Described ? Described : Templated), RC);
472472
if (!RC)
@@ -897,7 +897,7 @@ populate(
897897
MRDOCS_SYMBOL_TRACE(RT, context_);
898898
I.ReturnType = toTypeInfo(RT);
899899

900-
if (auto* TRC = D->getTrailingRequiresClause())
900+
if (auto* TRC = D->getTrailingRequiresClause().ConstraintExpr)
901901
{
902902
populate(I.Requires, TRC);
903903
}
@@ -1214,7 +1214,7 @@ populate(
12141214
NamespaceAliasDecl const* D)
12151215
{
12161216
NamedDecl const* Aliased = D->getAliasedNamespace();
1217-
NestedNameSpecifier const* NNS = D->getQualifier();
1217+
NestedNameSpecifier NNS = D->getQualifier();
12181218
I.AliasedSymbol = toNameInfo(Aliased, {}, NNS);
12191219
}
12201220

@@ -1478,7 +1478,7 @@ populate(
14781478
}
14791479
if(TypeConstraint const* TC = P->getTypeConstraint())
14801480
{
1481-
NestedNameSpecifier const* NNS =
1481+
NestedNameSpecifier NNS =
14821482
TC->getNestedNameSpecifierLoc().getNestedNameSpecifier();
14831483
std::optional<ASTTemplateArgumentListInfo const*> TArgs;
14841484
if (TC->hasExplicitTemplateArgs())
@@ -2009,63 +2009,45 @@ toTypeInfo(QualType const qt, TraversalMode const mode)
20092009
return Builder.result();
20102010
}
20112011

2012-
Polymorphic<NameInfo>
2013-
ASTVisitor::
2014-
toNameInfo(
2015-
NestedNameSpecifier const* NNS)
2012+
Polymorphic<NameInfo> ASTVisitor::toNameInfo(NestedNameSpecifier NNS)
20162013
{
2017-
if (!NNS)
2018-
{
2019-
return std::nullopt;
2020-
}
20212014
MRDOCS_SYMBOL_TRACE(NNS, context_);
2022-
20232015
ScopeExitRestore scope(mode_, Dependency);
2024-
Polymorphic<NameInfo> I = std::nullopt;
2025-
if (Type const* T = NNS->getAsType())
2026-
{
2027-
NameInfoBuilder Builder(*this, NNS->getPrefix());
2016+
switch(NNS.getKind()) {
2017+
case NestedNameSpecifier::Kind::Null:
2018+
return std::nullopt;
2019+
case NestedNameSpecifier::Kind::Type: {
2020+
const Type *T = NNS.getAsType();
2021+
NameInfoBuilder Builder(*this);
20282022
Builder.Visit(T);
2029-
I = Builder.result();
2023+
return Builder.result();
20302024
}
2031-
else if(IdentifierInfo const* II = NNS->getAsIdentifier())
2032-
{
2033-
I = Polymorphic<NameInfo>();
2034-
I->Name = II->getName();
2035-
I->Prefix = toNameInfo(NNS->getPrefix());
2036-
}
2037-
else if(NamespaceDecl const* ND = NNS->getAsNamespace())
2038-
{
2039-
I = Polymorphic<NameInfo>();
2025+
case NestedNameSpecifier::Kind::Namespace: {
2026+
auto I = Polymorphic<NameInfo>();
2027+
auto [ND, Prefix] = NNS.getAsNamespaceAndPrefix();
20402028
I->Name = ND->getIdentifier()->getName();
2041-
I->Prefix = toNameInfo(NNS->getPrefix());
2029+
I->Prefix = toNameInfo(Prefix);
20422030
Decl const* ID = getInstantiatedFrom(ND);
20432031
if (Info* info = findOrTraverse(const_cast<Decl*>(ID)))
20442032
{
20452033
I->id = info->id;
20462034
}
2035+
return I;
20472036
}
2048-
else if(NamespaceAliasDecl const* NAD = NNS->getAsNamespaceAlias())
2049-
{
2050-
I = Polymorphic<NameInfo>();
2051-
I->Name = NAD->getIdentifier()->getName();
2052-
I->Prefix = toNameInfo(NNS->getPrefix());
2053-
Decl const* ID = getInstantiatedFrom(NAD);
2054-
if (Info* info = findOrTraverse(const_cast<Decl*>(ID)))
2055-
{
2056-
I->id = info->id;
2057-
}
2037+
case NestedNameSpecifier::Kind::Global:
2038+
case NestedNameSpecifier::Kind::MicrosoftSuper:
2039+
// FIXME: Unimplemented.
2040+
return std::nullopt;
20582041
}
2059-
return I;
2042+
MRDOCS_UNREACHABLE();
20602043
}
20612044

20622045
template <class TArgRange>
20632046
Polymorphic<NameInfo>
20642047
ASTVisitor::
2065-
toNameInfo(
2066-
DeclarationName const Name,
2048+
toNameInfo(DeclarationName const Name,
20672049
std::optional<TArgRange> TArgs,
2068-
NestedNameSpecifier const* NNS)
2050+
NestedNameSpecifier NNS)
20692051
{
20702052
if (Name.isEmpty())
20712053
{
@@ -2082,10 +2064,7 @@ toNameInfo(
20822064
I = Polymorphic<NameInfo>();
20832065
}
20842066
I->Name = extractName(Name);
2085-
if (NNS)
2086-
{
2087-
I->Prefix = toNameInfo(NNS);
2088-
}
2067+
I->Prefix = toNameInfo(NNS);
20892068
return I;
20902069
}
20912070

@@ -2095,7 +2074,7 @@ ASTVisitor::
20952074
toNameInfo(
20962075
Decl const* D,
20972076
std::optional<TArgRange> TArgs,
2098-
NestedNameSpecifier const* NNS)
2077+
NestedNameSpecifier NNS)
20992078
{
21002079
auto const* ND = dyn_cast_if_present<NamedDecl>(D);
21012080
if (!ND)
@@ -2123,7 +2102,7 @@ ASTVisitor::
21232102
toNameInfo<llvm::ArrayRef<clang::TemplateArgument>>(
21242103
Decl const* D,
21252104
std::optional<llvm::ArrayRef<clang::TemplateArgument>> TArgs,
2126-
NestedNameSpecifier const* NNS);
2105+
NestedNameSpecifier NNS);
21272106

21282107
Polymorphic<TArg>
21292108
ASTVisitor::
@@ -2659,12 +2638,6 @@ ASTVisitor::getSFINAETemplateInfo(QualType T, bool const AllowDependentNames) co
26592638
MRDOCS_SYMBOL_TRACE(T, context_);
26602639
MRDOCS_ASSERT(!T.isNull());
26612640

2662-
// If the type is an elaborated type, get the named type
2663-
if (auto* ET = T->getAs<ElaboratedType>())
2664-
{
2665-
T = ET->getNamedType();
2666-
}
2667-
26682641
// If the type is a dependent name type and dependent names are allowed,
26692642
// extract the identifier and the qualifier's type
26702643
SFINAETemplateInfo SFINAE;
@@ -2673,7 +2646,7 @@ ASTVisitor::getSFINAETemplateInfo(QualType T, bool const AllowDependentNames) co
26732646
{
26742647
SFINAE.Member = DNT->getIdentifier();
26752648
MRDOCS_SYMBOL_TRACE(SFINAE.Member, context_);
2676-
T = QualType(DNT->getQualifier()->getAsType(), 0);
2649+
T = QualType(DNT->getQualifier().getAsType(), 0);
26772650
MRDOCS_SYMBOL_TRACE(T, context_);
26782651
}
26792652
if (!T.getTypePtrOrNull())

src/lib/AST/ASTVisitor.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -771,23 +771,21 @@ class ASTVisitor
771771
return toTypeInfo(qt, TraversalMode::Dependency);
772772
}
773773

774-
Polymorphic<NameInfo>
775-
toNameInfo(
776-
NestedNameSpecifier const* NNS);
774+
Polymorphic<NameInfo> toNameInfo(NestedNameSpecifier NNS);
777775

778776
template <class TArgRange = ArrayRef<TemplateArgument>>
779777
Polymorphic<NameInfo>
780778
toNameInfo(
781779
DeclarationName Name,
782780
std::optional<TArgRange> TArgs = std::nullopt,
783-
NestedNameSpecifier const* NNS = nullptr);
781+
NestedNameSpecifier NNS = std::nullopt);
784782

785783
template <class TArgRange = ArrayRef<TemplateArgument>>
786784
Polymorphic<NameInfo>
787785
toNameInfo(
788786
Decl const* D,
789787
std::optional<TArgRange> TArgs = std::nullopt,
790-
NestedNameSpecifier const* NNS = nullptr);
788+
NestedNameSpecifier NNS = std::nullopt);
791789

792790
Polymorphic<TArg>
793791
toTArg(TemplateArgument const& A);

src/lib/AST/NameInfoBuilder.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,18 @@ buildDecltype(
2929
void
3030
NameInfoBuilder::
3131
buildTerminal(
32-
NestedNameSpecifier const* NNS,
3332
Type const* T,
3433
unsigned,
3534
bool)
3635
{
3736
Result = Polymorphic<NameInfo>();
3837
Result->Name = getASTVisitor().toString(T);
39-
if (NNS)
40-
{
41-
Result->Prefix = getASTVisitor().toNameInfo(NNS);
42-
}
4338
}
4439

4540
void
4641
NameInfoBuilder::
4742
buildTerminal(
48-
NestedNameSpecifier const* NNS,
43+
NestedNameSpecifier NNS,
4944
IdentifierInfo const* II,
5045
std::optional<ArrayRef<TemplateArgument>> TArgs,
5146
unsigned,
@@ -79,7 +74,7 @@ buildTerminal(
7974
void
8075
NameInfoBuilder::
8176
buildTerminal(
82-
NestedNameSpecifier const* NNS,
77+
NestedNameSpecifier NNS,
8378
NamedDecl const* D,
8479
std::optional<ArrayRef<TemplateArgument>> const& TArgs,
8580
unsigned,

src/lib/AST/NameInfoBuilder.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,21 @@ class NameInfoBuilder
4242

4343
void
4444
buildTerminal(
45-
NestedNameSpecifier const* NNS,
4645
Type const* T,
4746
unsigned quals,
4847
bool pack);
4948

5049
void
5150
buildTerminal(
52-
NestedNameSpecifier const* NNS,
51+
NestedNameSpecifier NNS,
5352
IdentifierInfo const* II,
5453
std::optional<ArrayRef<TemplateArgument>> TArgs,
5554
unsigned quals,
5655
bool pack);
5756

5857
void
5958
buildTerminal(
60-
NestedNameSpecifier const* NNS,
59+
NestedNameSpecifier NNS,
6160
NamedDecl const* D,
6261
std::optional<ArrayRef<TemplateArgument>> const& TArgs,
6362
unsigned quals,

0 commit comments

Comments
 (0)