Skip to content

Commit a2ba00a

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-update-iv-exit-users
2 parents 4b3ff63 + df4a615 commit a2ba00a

File tree

116 files changed

+2572
-953
lines changed

Some content is hidden

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

116 files changed

+2572
-953
lines changed

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
include "clang/Basic/BuiltinsBase.td"
14-
15-
class X86Builtin<string prototype> : TargetBuiltin {
16-
let Spellings = ["__builtin_ia32_" # NAME];
17-
let Prototype = prototype;
18-
let EnableOpenCLLong = 1;
19-
}
20-
21-
class X86NoPrefixBuiltin<string prototype> : TargetBuiltin {
22-
let Spellings = [NAME];
23-
let Prototype = prototype;
24-
}
25-
26-
class X86LibBuiltin<string prototype> : TargetLibBuiltin {
27-
let Spellings = [NAME];
28-
let Prototype = prototype;
29-
}
13+
include "clang/Basic/BuiltinsX86Base.td"
3014

3115
def rdpmc : X86Builtin<"unsigned long long int(int)">;
3216
def rdtsc : X86Builtin<"unsigned long long int()">;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//===--- BuiltinsX86Base.td - X86 Builtin function classes ------*- 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 the X86-specific builtin function classes.
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
include "clang/Basic/BuiltinsBase.td"
14+
15+
class X86Builtin<string prototype> : TargetBuiltin {
16+
let Spellings = ["__builtin_ia32_" # NAME];
17+
let Prototype = prototype;
18+
let EnableOpenCLLong = 1;
19+
}
20+
21+
class X86NoPrefixBuiltin<string prototype> : TargetBuiltin {
22+
let Spellings = [NAME];
23+
let Prototype = prototype;
24+
}
25+
26+
class X86LibBuiltin<string prototype> : TargetLibBuiltin {
27+
let Spellings = [NAME];
28+
let Prototype = prototype;
29+
}

clang/include/clang/Basic/BuiltinsX86_64.def

Lines changed: 0 additions & 253 deletions
This file was deleted.

clang/include/clang/Basic/BuiltinsX86_64.td

Lines changed: 485 additions & 0 deletions
Large diffs are not rendered by default.

clang/include/clang/Basic/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ clang_tablegen(BuiltinsX86.inc -gen-clang-builtins
6464
SOURCE BuiltinsX86.td
6565
TARGET ClangBuiltinsX86)
6666

67+
clang_tablegen(BuiltinsX86_64.inc -gen-clang-builtins
68+
SOURCE BuiltinsX86_64.td
69+
TARGET ClangBuiltinsX86_64)
70+
6771
# ARM NEON and MVE
6872
clang_tablegen(arm_neon.inc -gen-arm-neon-sema
6973
SOURCE arm_neon.td

clang/include/clang/Basic/TargetBuiltins.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ namespace clang {
128128
FirstX86_64Builtin,
129129
LastX86CommonBuiltin = FirstX86_64Builtin - 1,
130130
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
131-
#include "clang/Basic/BuiltinsX86_64.def"
131+
#include "clang/Basic/BuiltinsX86_64.inc"
132132
LastTSBuiltin
133133
};
134134
}

clang/include/clang/Sema/Sema.h

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13055,6 +13055,7 @@ class Sema final : public SemaBase {
1305513055
///
1305613056
/// \param SkipForSpecialization when specified, any template specializations
1305713057
/// in a traversal would be ignored.
13058+
///
1305813059
/// \param ForDefaultArgumentSubstitution indicates we should continue looking
1305913060
/// when encountering a specialized member function template, rather than
1306013061
/// returning immediately.
@@ -13066,6 +13067,17 @@ class Sema final : public SemaBase {
1306613067
bool SkipForSpecialization = false,
1306713068
bool ForDefaultArgumentSubstitution = false);
1306813069

13070+
/// Apart from storing the result to \p Result, this behaves the same as
13071+
/// another overload.
13072+
void getTemplateInstantiationArgs(
13073+
MultiLevelTemplateArgumentList &Result, const NamedDecl *D,
13074+
const DeclContext *DC = nullptr, bool Final = false,
13075+
std::optional<ArrayRef<TemplateArgument>> Innermost = std::nullopt,
13076+
bool RelativeToPrimary = false, const FunctionDecl *Pattern = nullptr,
13077+
bool ForConstraintInstantiation = false,
13078+
bool SkipForSpecialization = false,
13079+
bool ForDefaultArgumentSubstitution = false);
13080+
1306913081
/// RAII object to handle the state changes required to synthesize
1307013082
/// a function body.
1307113083
class SynthesizedFunctionScope {
@@ -13335,7 +13347,7 @@ class Sema final : public SemaBase {
1333513347
ExprResult
1333613348
SubstConstraintExpr(Expr *E,
1333713349
const MultiLevelTemplateArgumentList &TemplateArgs);
13338-
// Unlike the above, this does not evaluates constraints.
13350+
// Unlike the above, this does not evaluate constraints.
1333913351
ExprResult SubstConstraintExprWithoutSatisfaction(
1334013352
Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs);
1334113353

@@ -14456,10 +14468,10 @@ class Sema final : public SemaBase {
1445614468
const MultiLevelTemplateArgumentList &TemplateArgs,
1445714469
SourceRange TemplateIDRange);
1445814470

14459-
bool CheckInstantiatedFunctionTemplateConstraints(
14460-
SourceLocation PointOfInstantiation, FunctionDecl *Decl,
14461-
ArrayRef<TemplateArgument> TemplateArgs,
14462-
ConstraintSatisfaction &Satisfaction);
14471+
bool CheckFunctionTemplateConstraints(SourceLocation PointOfInstantiation,
14472+
FunctionDecl *Decl,
14473+
ArrayRef<TemplateArgument> TemplateArgs,
14474+
ConstraintSatisfaction &Satisfaction);
1446314475

1446414476
/// \brief Emit diagnostics explaining why a constraint expression was deemed
1446514477
/// unsatisfied.

clang/include/clang/Sema/Template.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,12 @@ enum class TemplateSubstitutionKind : char {
522522
llvm::PointerUnion<Decl *, DeclArgumentPack *> *
523523
findInstantiationOf(const Decl *D);
524524

525+
/// Similar to \p findInstantiationOf(), but it wouldn't assert if the
526+
/// instantiation was not found within the current instantiation scope. This
527+
/// is helpful for on-demand declaration instantiation.
528+
llvm::PointerUnion<Decl *, DeclArgumentPack *> *
529+
findInstantiationUnsafe(const Decl *D);
530+
525531
void InstantiatedLocal(const Decl *D, Decl *Inst);
526532
void InstantiatedLocalPackArg(const Decl *D, VarDecl *Inst);
527533
void MakeInstantiatedLocalArgPack(const Decl *D);

clang/lib/Basic/Targets/X86.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static constexpr Builtin::Info BuiltinInfoX86[] = {
3838
{#ID, TYPE, ATTRS, FEATURE, HeaderDesc::NO_HEADER, ALL_LANGUAGES},
3939
#define TARGET_HEADER_BUILTIN(ID, TYPE, ATTRS, HEADER, LANGS, FEATURE) \
4040
{#ID, TYPE, ATTRS, FEATURE, HeaderDesc::HEADER, LANGS},
41-
#include "clang/Basic/BuiltinsX86_64.def"
41+
#include "clang/Basic/BuiltinsX86_64.inc"
4242
};
4343

4444
static const char *const GCCRegNames[] = {

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ llvm::Value *CGHLSLRuntime::emitInputSemantic(IRBuilder<> &B,
395395
return buildVectorInput(B, GroupThreadIDIntrinsic, Ty);
396396
}
397397
if (D.hasAttr<HLSLSV_GroupIDAttr>()) {
398-
llvm::Function *GroupIDIntrinsic = CGM.getIntrinsic(Intrinsic::dx_group_id);
398+
llvm::Function *GroupIDIntrinsic = CGM.getIntrinsic(getGroupIdIntrinsic());
399399
return buildVectorInput(B, GroupIDIntrinsic, Ty);
400400
}
401401
assert(false && "Unhandled parameter attribute");

clang/lib/CodeGen/CGHLSLRuntime.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class CGHLSLRuntime {
8787
GENERATE_HLSL_INTRINSIC_FUNCTION(Radians, radians)
8888
GENERATE_HLSL_INTRINSIC_FUNCTION(ThreadId, thread_id)
8989
GENERATE_HLSL_INTRINSIC_FUNCTION(GroupThreadId, thread_id_in_group)
90+
GENERATE_HLSL_INTRINSIC_FUNCTION(GroupId, group_id)
9091
GENERATE_HLSL_INTRINSIC_FUNCTION(FDot, fdot)
9192
GENERATE_HLSL_INTRINSIC_FUNCTION(SDot, sdot)
9293
GENERATE_HLSL_INTRINSIC_FUNCTION(UDot, udot)

clang/lib/Driver/ToolChains/MinGW.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ void tools::MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
138138
else
139139
CmdArgs.push_back("arm64pe");
140140
break;
141+
case llvm::Triple::mipsel:
142+
CmdArgs.push_back("mipspe");
143+
break;
141144
default:
142145
D.Diag(diag::err_target_unknown_triple) << TC.getEffectiveTriple().str();
143146
}

clang/lib/Format/AffectedRangeManager.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ namespace format {
2121

2222
bool AffectedRangeManager::computeAffectedLines(
2323
SmallVectorImpl<AnnotatedLine *> &Lines) {
24-
SmallVectorImpl<AnnotatedLine *>::iterator I = Lines.begin();
25-
SmallVectorImpl<AnnotatedLine *>::iterator E = Lines.end();
24+
ArrayRef<AnnotatedLine *>::iterator I = Lines.begin();
25+
ArrayRef<AnnotatedLine *>::iterator E = Lines.end();
2626
bool SomeLineAffected = false;
2727
const AnnotatedLine *PreviousLine = nullptr;
2828
while (I != E) {
@@ -34,7 +34,7 @@ bool AffectedRangeManager::computeAffectedLines(
3434
// if any token within the directive is affected.
3535
if (Line->InPPDirective) {
3636
FormatToken *Last = Line->Last;
37-
SmallVectorImpl<AnnotatedLine *>::iterator PPEnd = I + 1;
37+
const auto *PPEnd = I + 1;
3838
while (PPEnd != E && !(*PPEnd)->First->HasUnescapedNewline) {
3939
Last = (*PPEnd)->Last;
4040
++PPEnd;
@@ -89,8 +89,8 @@ bool AffectedRangeManager::affectsLeadingEmptyLines(const FormatToken &Tok) {
8989
}
9090

9191
void AffectedRangeManager::markAllAsAffected(
92-
SmallVectorImpl<AnnotatedLine *>::iterator I,
93-
SmallVectorImpl<AnnotatedLine *>::iterator E) {
92+
ArrayRef<AnnotatedLine *>::iterator I,
93+
ArrayRef<AnnotatedLine *>::iterator E) {
9494
while (I != E) {
9595
(*I)->Affected = true;
9696
markAllAsAffected((*I)->Children.begin(), (*I)->Children.end());

clang/lib/Format/AffectedRangeManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class AffectedRangeManager {
4747
bool affectsLeadingEmptyLines(const FormatToken &Tok);
4848

4949
// Marks all lines between I and E as well as all their children as affected.
50-
void markAllAsAffected(SmallVectorImpl<AnnotatedLine *>::iterator I,
51-
SmallVectorImpl<AnnotatedLine *>::iterator E);
50+
void markAllAsAffected(ArrayRef<AnnotatedLine *>::iterator I,
51+
ArrayRef<AnnotatedLine *>::iterator E);
5252

5353
// Determines whether 'Line' is affected by the SourceRanges given as input.
5454
// Returns \c true if line or one if its children is affected.

clang/lib/Format/Format.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3085,8 +3085,8 @@ static bool affectsRange(ArrayRef<tooling::Range> Ranges, unsigned Start,
30853085
// its current line.
30863086
// If `Cursor` is not on any #include, `Index` will be UINT_MAX.
30873087
static std::pair<unsigned, unsigned>
3088-
FindCursorIndex(const SmallVectorImpl<IncludeDirective> &Includes,
3089-
const SmallVectorImpl<unsigned> &Indices, unsigned Cursor) {
3088+
FindCursorIndex(const ArrayRef<IncludeDirective> &Includes,
3089+
const ArrayRef<unsigned> &Indices, unsigned Cursor) {
30903090
unsigned CursorIndex = UINT_MAX;
30913091
unsigned OffsetToEOL = 0;
30923092
for (int i = 0, e = Includes.size(); i != e; ++i) {
@@ -3135,7 +3135,7 @@ std::string replaceCRLF(const std::string &Code) {
31353135
// provided and put on a deleted #include, it will be moved to the remaining
31363136
// #include in the duplicate #includes.
31373137
static void sortCppIncludes(const FormatStyle &Style,
3138-
const SmallVectorImpl<IncludeDirective> &Includes,
3138+
const ArrayRef<IncludeDirective> &Includes,
31393139
ArrayRef<tooling::Range> Ranges, StringRef FileName,
31403140
StringRef Code, tooling::Replacements &Replaces,
31413141
unsigned *Cursor) {
@@ -3378,7 +3378,7 @@ static unsigned findJavaImportGroup(const FormatStyle &Style,
33783378
// import group, a newline is inserted, and within each import group, a
33793379
// lexicographic sort based on ASCII value is performed.
33803380
static void sortJavaImports(const FormatStyle &Style,
3381-
const SmallVectorImpl<JavaImportDirective> &Imports,
3381+
const ArrayRef<JavaImportDirective> &Imports,
33823382
ArrayRef<tooling::Range> Ranges, StringRef FileName,
33833383
StringRef Code, tooling::Replacements &Replaces) {
33843384
unsigned ImportsBeginOffset = Imports.front().Offset;

clang/lib/Format/FormatToken.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace clang {
2525
namespace format {
2626

2727
#define LIST_TOKEN_TYPES \
28+
TYPE(AfterPPDirective) \
2829
TYPE(ArrayInitializerLSquare) \
2930
TYPE(ArraySubscriptLSquare) \
3031
TYPE(AttributeColon) \
@@ -44,6 +45,7 @@ namespace format {
4445
TYPE(CastRParen) \
4546
TYPE(ClassLBrace) \
4647
TYPE(ClassRBrace) \
48+
TYPE(CompoundRequirementLBrace) \
4749
/* ternary ?: expression */ \
4850
TYPE(ConditionalExpr) \
4951
/* the condition in an if statement */ \

clang/lib/Format/FormatTokenLexer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,7 @@ bool FormatTokenLexer::tryMergeTokens(ArrayRef<tok::TokenKind> Kinds,
564564
if (Tokens.size() < Kinds.size())
565565
return false;
566566

567-
SmallVectorImpl<FormatToken *>::const_iterator First =
568-
Tokens.end() - Kinds.size();
567+
const auto *First = Tokens.end() - Kinds.size();
569568
for (unsigned i = 0; i < Kinds.size(); ++i)
570569
if (First[i]->isNot(Kinds[i]))
571570
return false;
@@ -577,7 +576,7 @@ bool FormatTokenLexer::tryMergeTokens(size_t Count, TokenType NewType) {
577576
if (Tokens.size() < Count)
578577
return false;
579578

580-
SmallVectorImpl<FormatToken *>::const_iterator First = Tokens.end() - Count;
579+
const auto *First = Tokens.end() - Count;
581580
unsigned AddLength = 0;
582581
for (size_t i = 1; i < Count; ++i) {
583582
// If there is whitespace separating the token and the previous one,

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ class AnnotatingParser {
143143
case TT_StructLBrace:
144144
case TT_UnionLBrace:
145145
return ST_Class;
146+
case TT_CompoundRequirementLBrace:
147+
return ST_CompoundRequirement;
146148
default:
147149
return ST_Other;
148150
}
@@ -2076,7 +2078,7 @@ class AnnotatingParser {
20762078
TT_RecordLBrace, TT_StructLBrace, TT_UnionLBrace, TT_RequiresClause,
20772079
TT_RequiresClauseInARequiresExpression, TT_RequiresExpression,
20782080
TT_RequiresExpressionLParen, TT_RequiresExpressionLBrace,
2079-
TT_BracedListLBrace)) {
2081+
TT_CompoundRequirementLBrace, TT_BracedListLBrace)) {
20802082
CurrentToken->setType(TT_Unknown);
20812083
}
20822084
CurrentToken->Role.reset();
@@ -3100,6 +3102,9 @@ class AnnotatingParser {
31003102
}
31013103
}
31023104

3105+
if (!Scopes.empty() && Scopes.back() == ST_CompoundRequirement)
3106+
return TT_BinaryOperator;
3107+
31033108
return TT_PointerOrReference;
31043109
}
31053110

@@ -4941,6 +4946,10 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
49414946
Right.is(TT_ModulePartitionColon)) {
49424947
return true;
49434948
}
4949+
4950+
if (Right.is(TT_AfterPPDirective))
4951+
return true;
4952+
49444953
// No space between import foo:bar but keep a space between import :bar;
49454954
if (Left.is(tok::identifier) && Right.is(TT_ModulePartitionColon))
49464955
return false;

clang/lib/Format/TokenAnnotator.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ enum ScopeType {
4040
ST_ChildBlock,
4141
// Contained in class declaration/definition.
4242
ST_Class,
43+
// Contained in compound requirement.
44+
ST_CompoundRequirement,
4345
// Contained within other scope block (function, loop, if/else, etc).
4446
ST_Other,
4547
};

0 commit comments

Comments
 (0)