Skip to content

Commit f8a74d4

Browse files
authored
Merge branch 'main' into fix-up-for-vop3p-gisel
2 parents 814687e + d793168 commit f8a74d4

File tree

824 files changed

+20956
-11197
lines changed

Some content is hidden

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

824 files changed

+20956
-11197
lines changed

bolt/lib/Passes/RetpolineInsertion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ std::string createRetpolineFunctionTag(BinaryContext &BC,
195195

196196
TagOS << "+";
197197
if (MemRef.DispExpr)
198-
MemRef.DispExpr->print(TagOS, BC.AsmInfo.get());
198+
BC.AsmInfo->printExpr(TagOS, *MemRef.DispExpr);
199199
else
200200
TagOS << MemRef.DispImm;
201201

bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "MCTargetDesc/RISCVMCExpr.h"
13+
#include "MCTargetDesc/RISCVMCAsmInfo.h"
1414
#include "MCTargetDesc/RISCVMCTargetDesc.h"
1515
#include "bolt/Core/MCPlusBuilder.h"
1616
#include "llvm/BinaryFormat/ELF.h"
@@ -33,8 +33,8 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
3333

3434
bool equals(const MCSpecifierExpr &A, const MCSpecifierExpr &B,
3535
CompFuncTy Comp) const override {
36-
const auto &RISCVExprA = cast<RISCVMCExpr>(A);
37-
const auto &RISCVExprB = cast<RISCVMCExpr>(B);
36+
const auto &RISCVExprA = cast<MCSpecifierExpr>(A);
37+
const auto &RISCVExprB = cast<MCSpecifierExpr>(B);
3838
if (RISCVExprA.getSpecifier() != RISCVExprB.getSpecifier())
3939
return false;
4040

@@ -245,7 +245,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
245245
MCContext *Ctx) {
246246
Inst.setOpcode(Opcode);
247247
Inst.clear();
248-
Inst.addOperand(MCOperand::createExpr(RISCVMCExpr::create(
248+
Inst.addOperand(MCOperand::createExpr(MCSpecifierExpr::create(
249249
MCSymbolRefExpr::create(Target, MCSymbolRefExpr::VK_None, *Ctx),
250250
ELF::R_RISCV_CALL_PLT, *Ctx)));
251251
}
@@ -342,7 +342,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
342342
}
343343

344344
const MCSymbol *getTargetSymbol(const MCExpr *Expr) const override {
345-
auto *RISCVExpr = dyn_cast<RISCVMCExpr>(Expr);
345+
auto *RISCVExpr = dyn_cast<MCSpecifierExpr>(Expr);
346346
if (RISCVExpr && RISCVExpr->getSubExpr())
347347
return getTargetSymbol(RISCVExpr->getSubExpr());
348348

@@ -435,19 +435,19 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
435435
case ELF::R_RISCV_TLS_GD_HI20:
436436
// The GOT is reused so no need to create GOT relocations
437437
case ELF::R_RISCV_PCREL_HI20:
438-
return RISCVMCExpr::create(Expr, ELF::R_RISCV_PCREL_HI20, Ctx);
438+
return MCSpecifierExpr::create(Expr, ELF::R_RISCV_PCREL_HI20, Ctx);
439439
case ELF::R_RISCV_PCREL_LO12_I:
440440
case ELF::R_RISCV_PCREL_LO12_S:
441-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_PCREL_LO, Ctx);
441+
return MCSpecifierExpr::create(Expr, RISCV::S_PCREL_LO, Ctx);
442442
case ELF::R_RISCV_HI20:
443-
return RISCVMCExpr::create(Expr, ELF::R_RISCV_HI20, Ctx);
443+
return MCSpecifierExpr::create(Expr, ELF::R_RISCV_HI20, Ctx);
444444
case ELF::R_RISCV_LO12_I:
445445
case ELF::R_RISCV_LO12_S:
446-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_LO, Ctx);
446+
return MCSpecifierExpr::create(Expr, RISCV::S_LO, Ctx);
447447
case ELF::R_RISCV_CALL:
448-
return RISCVMCExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
448+
return MCSpecifierExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
449449
case ELF::R_RISCV_CALL_PLT:
450-
return RISCVMCExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
450+
return MCSpecifierExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
451451
}
452452
}
453453

@@ -466,10 +466,10 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
466466
return false;
467467

468468
const auto *ImmExpr = ImmOp.getExpr();
469-
if (!isa<RISCVMCExpr>(ImmExpr))
469+
if (!isa<MCSpecifierExpr>(ImmExpr))
470470
return false;
471471

472-
switch (cast<RISCVMCExpr>(ImmExpr)->getSpecifier()) {
472+
switch (cast<MCSpecifierExpr>(ImmExpr)->getSpecifier()) {
473473
default:
474474
return false;
475475
case ELF::R_RISCV_CALL_PLT:

clang-tools-extra/clang-doc/BitcodeReader.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@ static llvm::Error decodeRecord(const Record &R, AccessSpecifier &Field,
5454
case AS_none:
5555
Field = (AccessSpecifier)R[0];
5656
return llvm::Error::success();
57-
default:
58-
return llvm::createStringError(llvm::inconvertibleErrorCode(),
59-
"invalid value for AccessSpecifier");
6057
}
58+
llvm_unreachable("invalid value for AccessSpecifier");
6159
}
6260

6361
static llvm::Error decodeRecord(const Record &R, TagTypeKind &Field,

clang-tools-extra/clang-doc/BitcodeWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ bool ClangDocBitcodeWriter::dispatchInfoForWrite(Info *I) {
664664
case InfoType::IT_typedef:
665665
emitBlock(*static_cast<clang::doc::TypedefInfo *>(I));
666666
break;
667-
default:
667+
case InfoType::IT_default:
668668
llvm::errs() << "Unexpected info, unable to write.\n";
669669
return true;
670670
}

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ mergeInfos(std::vector<std::unique_ptr<Info>> &Values) {
143143
return reduce<FunctionInfo>(Values);
144144
case InfoType::IT_typedef:
145145
return reduce<TypedefInfo>(Values);
146-
default:
146+
case InfoType::IT_default:
147147
return llvm::createStringError(llvm::inconvertibleErrorCode(),
148148
"unexpected info type");
149149
}

clang-tools-extra/clang-doc/Serialize.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ std::string serialize(std::unique_ptr<Info> &I) {
388388
return serialize(*static_cast<EnumInfo *>(I.get()));
389389
case InfoType::IT_function:
390390
return serialize(*static_cast<FunctionInfo *>(I.get()));
391-
default:
391+
case InfoType::IT_typedef:
392+
case InfoType::IT_default:
392393
return "";
393394
}
394395
}
@@ -525,9 +526,13 @@ static std::unique_ptr<Info> makeAndInsertIntoParent(ChildType Child) {
525526
InsertChild(ParentRec->Children, std::forward<ChildType>(Child));
526527
return ParentRec;
527528
}
528-
default:
529-
llvm_unreachable("Invalid reference type for parent namespace");
529+
case InfoType::IT_default:
530+
case InfoType::IT_enum:
531+
case InfoType::IT_function:
532+
case InfoType::IT_typedef:
533+
break;
530534
}
535+
llvm_unreachable("Invalid reference type for parent namespace");
531536
}
532537

533538
// There are two uses for this function.

clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ getNewFieldsOrder(const RecordDecl *Definition,
8686
static void
8787
addReplacement(SourceRange Old, SourceRange New, const ASTContext &Context,
8888
std::map<std::string, tooling::Replacements> &Replacements) {
89+
if (Old.getBegin().isMacroID())
90+
Old = Context.getSourceManager().getExpansionRange(Old).getAsRange();
91+
if (New.getBegin().isMacroID())
92+
New = Context.getSourceManager().getExpansionRange(New).getAsRange();
8993
StringRef NewText =
9094
Lexer::getSourceText(CharSourceRange::getTokenRange(New),
9195
Context.getSourceManager(), Context.getLangOpts());

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -702,17 +702,16 @@ void NotNullTerminatedResultCheck::registerMatchers(MatchFinder *Finder) {
702702
return hasArgument(
703703
CC.LengthPos,
704704
allOf(
705-
anyOf(
706-
ignoringImpCasts(integerLiteral().bind(WrongLengthExprName)),
707-
allOf(unless(hasDefinition(SizeOfCharExpr)),
708-
allOf(CC.WithIncrease
709-
? ignoringImpCasts(hasDefinition(HasIncOp))
710-
: ignoringImpCasts(allOf(
711-
unless(hasDefinition(HasIncOp)),
712-
anyOf(hasDefinition(binaryOperator().bind(
713-
UnknownLengthName)),
714-
hasDefinition(anything())))),
715-
AnyOfWrongLengthInit))),
705+
anyOf(ignoringImpCasts(integerLiteral().bind(WrongLengthExprName)),
706+
allOf(unless(hasDefinition(SizeOfCharExpr)),
707+
allOf(CC.WithIncrease
708+
? ignoringImpCasts(hasDefinition(HasIncOp))
709+
: ignoringImpCasts(
710+
allOf(unless(hasDefinition(HasIncOp)),
711+
hasDefinition(optionally(
712+
binaryOperator().bind(
713+
UnknownLengthName))))),
714+
AnyOfWrongLengthInit))),
716715
expr().bind(LengthExprName)));
717716
};
718717

clang-tools-extra/clang-tidy/hicpp/ExceptionBaseclassCheck.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ void ExceptionBaseclassCheck::registerMatchers(MatchFinder *Finder) {
2424
isSameOrDerivedFrom(hasName("::std::exception")))))))))),
2525
// This condition is always true, but will bind to the
2626
// template value if the thrown type is templated.
27-
anyOf(has(expr(
28-
hasType(substTemplateTypeParmType().bind("templ_type")))),
29-
anything()),
27+
optionally(has(
28+
expr(hasType(substTemplateTypeParmType().bind("templ_type"))))),
3029
// Bind to the declaration of the type of the value that
31-
// is thrown. 'anything()' is necessary to always succeed
32-
// in the 'eachOf' because builtin types are not
33-
// 'namedDecl'.
34-
eachOf(has(expr(hasType(namedDecl().bind("decl")))), anything()))
30+
// is thrown. 'optionally' is necessary because builtin types
31+
// are not 'namedDecl'.
32+
optionally(has(expr(hasType(namedDecl().bind("decl"))))))
3533
.bind("bad_throw"),
3634
this);
3735
}

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ void StaticAssertCheck::registerMatchers(MatchFinder *Finder) {
3838
binaryOperator(
3939
hasAnyOperatorName("&&", "=="),
4040
hasEitherOperand(ignoringImpCasts(stringLiteral().bind("assertMSG"))),
41-
anyOf(binaryOperator(hasEitherOperand(IsAlwaysFalseWithCast)),
42-
anything()))
41+
optionally(binaryOperator(hasEitherOperand(IsAlwaysFalseWithCast))))
4342
.bind("assertExprRoot"),
4443
IsAlwaysFalse);
4544
auto NonConstexprFunctionCall =
@@ -52,12 +51,10 @@ void StaticAssertCheck::registerMatchers(MatchFinder *Finder) {
5251
auto NonConstexprCode =
5352
expr(anyOf(NonConstexprFunctionCall, NonConstexprVariableReference));
5453
auto AssertCondition =
55-
expr(
56-
anyOf(expr(ignoringParenCasts(anyOf(
57-
AssertExprRoot, unaryOperator(hasUnaryOperand(
58-
ignoringParenCasts(AssertExprRoot)))))),
59-
anything()),
60-
unless(NonConstexprCode), unless(hasDescendant(NonConstexprCode)))
54+
expr(optionally(expr(ignoringParenCasts(anyOf(
55+
AssertExprRoot, unaryOperator(hasUnaryOperand(
56+
ignoringParenCasts(AssertExprRoot))))))),
57+
unless(NonConstexprCode), unless(hasDescendant(NonConstexprCode)))
6158
.bind("condition");
6259
auto Condition =
6360
anyOf(ignoringParenImpCasts(callExpr(

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@ void UseBoolLiteralsCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
2626

2727
void UseBoolLiteralsCheck::registerMatchers(MatchFinder *Finder) {
2828
Finder->addMatcher(
29-
traverse(
30-
TK_AsIs,
31-
implicitCastExpr(
32-
has(ignoringParenImpCasts(integerLiteral().bind("literal"))),
33-
hasImplicitDestinationType(qualType(booleanType())),
34-
unless(isInTemplateInstantiation()),
35-
anyOf(hasParent(explicitCastExpr().bind("cast")), anything()))),
29+
traverse(TK_AsIs,
30+
implicitCastExpr(
31+
has(ignoringParenImpCasts(integerLiteral().bind("literal"))),
32+
hasImplicitDestinationType(qualType(booleanType())),
33+
unless(isInTemplateInstantiation()),
34+
optionally(hasParent(explicitCastExpr().bind("cast"))))),
3635
this);
3736

3837
Finder->addMatcher(

clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
348348
implicitCastExpr().bind("implicitCastFromBool"),
349349
unless(hasParent(BitfieldConstruct)),
350350
// Check also for nested casts, for example: bool -> int -> float.
351-
anyOf(hasParent(implicitCastExpr().bind("furtherImplicitCast")),
352-
anything()),
351+
optionally(
352+
hasParent(implicitCastExpr().bind("furtherImplicitCast"))),
353353
unless(isInTemplateInstantiation()),
354354
unless(IsInCompilerGeneratedFunction))),
355355
this);

clang-tools-extra/clangd/unittests/HoverTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ class Foo final {})cpp";
974974
HI.Name = "abc";
975975
HI.Kind = index::SymbolKind::Variable;
976976
HI.NamespaceScope = "";
977-
HI.Definition = "int abc = <recovery - expr>()";
977+
HI.Definition = "int abc";
978978
HI.Type = "int";
979979
HI.AccessSpecifier = "public";
980980
}},

clang-tools-extra/clangd/unittests/XRefsTests.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,6 +2311,14 @@ TEST(FindReferences, WithinAST) {
23112311
$(S::deleteObject)[[de^lete]] S;
23122312
}
23132313
};
2314+
)cpp",
2315+
// Array designators
2316+
R"cpp(
2317+
const int $def[[F^oo]] = 0;
2318+
int Bar[] = {
2319+
[$(Bar)[[F^oo]]...$(Bar)[[Fo^o]] + 1] = 0,
2320+
[$(Bar)[[^Foo]] + 2] = 1
2321+
};
23142322
)cpp"};
23152323
for (const char *Test : Tests)
23162324
checkFindRefs(Test);

clang-tools-extra/modularize/CoverageChecker.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,8 @@ bool CoverageChecker::collectFileSystemHeaders() {
329329
else {
330330
// Otherwise we only look at the sub-trees specified by the
331331
// include paths.
332-
for (std::vector<std::string>::const_iterator I = IncludePaths.begin(),
333-
E = IncludePaths.end();
334-
I != E; ++I) {
335-
if (!collectFileSystemHeaders(*I))
332+
for (const std::string &IncludePath : IncludePaths) {
333+
if (!collectFileSystemHeaders(IncludePath))
336334
return false;
337335
}
338336
}

clang-tools-extra/modularize/Modularize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ static std::string findInputFile(const CommandLineArguments &CLArgs) {
339339
llvm::opt::Visibility VisibilityMask(options::CC1Option);
340340
unsigned MissingArgIndex, MissingArgCount;
341341
SmallVector<const char *, 256> Argv;
342-
for (auto I = CLArgs.begin(), E = CLArgs.end(); I != E; ++I)
343-
Argv.push_back(I->c_str());
342+
for (const std::string &CLArg : CLArgs)
343+
Argv.push_back(CLArg.c_str());
344344
InputArgList Args = getDriverOptTable().ParseArgs(
345345
Argv, MissingArgIndex, MissingArgCount, VisibilityMask);
346346
std::vector<std::string> Inputs = Args.getAllArgValues(OPT_INPUT);

clang-tools-extra/modularize/ModularizeUtilities.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ ModularizeUtilities *ModularizeUtilities::createModularizeUtilities(
6969
// Load all header lists and dependencies.
7070
std::error_code ModularizeUtilities::loadAllHeaderListsAndDependencies() {
7171
// For each input file.
72-
for (auto I = InputFilePaths.begin(), E = InputFilePaths.end(); I != E; ++I) {
73-
llvm::StringRef InputPath = *I;
72+
for (llvm::StringRef InputPath : InputFilePaths) {
7473
// If it's a module map.
7574
if (InputPath.ends_with(".modulemap")) {
7675
// Load the module map.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: clang-reorder-fields -record-name ::bar::Foo -fields-order z,y,x %s -- | FileCheck %s
2+
3+
namespace bar {
4+
5+
#define INT_DECL(NAME) int NAME // CHECK: {{^#define INT_DECL\(NAME\) int NAME}}
6+
#define MACRO_DECL int x; // CHECK-NEXT: {{^#define MACRO_DECL int x;}}
7+
8+
struct Foo {
9+
MACRO_DECL // CHECK: {{^ INT_DECL\(z\);}}
10+
int y; // CHECK-NEXT: {{^ int y;}}
11+
INT_DECL(z); // CHECK-NEXT: {{^ MACRO_DECL}}
12+
};
13+
14+
#define FOO 0 // CHECK: {{^#define FOO 0}}
15+
#define BAR 1 // CHECK-NEXT: {{^#define BAR 1}}
16+
#define BAZ 2 // CHECK-NEXT: {{^#define BAZ 2}}
17+
18+
struct Foo foo = {
19+
FOO, // CHECK: {{^ BAZ,}}
20+
BAR, // CHECK-NEXT: {{^ BAR,}}
21+
BAZ, // CHECK-NEXT: {{^ FOO,}}
22+
};
23+
24+
} // end namespace bar

clang-tools-extra/unittests/clang-doc/BitcodeTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static std::string writeInfo(Info *I) {
3737
return writeInfo(*static_cast<FunctionInfo *>(I));
3838
case InfoType::IT_typedef:
3939
return writeInfo(*static_cast<TypedefInfo *>(I));
40-
default:
40+
case InfoType::IT_default:
4141
return "";
4242
}
4343
}

clang/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,6 @@ configure_file(
345345
# Add appropriate flags for GCC
346346
if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
347347
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual")
348-
if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
349-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
350-
endif ()
351348

352349
# Enable -pedantic for Clang even if it's not enabled for LLVM.
353350
if (NOT LLVM_ENABLE_PEDANTIC)

clang/docs/ReleaseNotes.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,14 @@ Improvements to Clang's diagnostics
622622

623623
- Improved the FixIts for unused lambda captures.
624624

625+
- Delayed typo correction was removed from the compiler; immediate typo
626+
correction behavior remains the same. Delayed typo correction facilities were
627+
fragile and unmaintained, and the removal closed the following issues:
628+
#GH142457, #GH139913, #GH138850, #GH137867, #GH137860, #GH107840, #GH93308,
629+
#GH69470, #GH59391, #GH58172, #GH46215, #GH45915, #GH45891, #GH44490,
630+
#GH36703, #GH32903, #GH23312, #GH69874.
631+
632+
625633
Improvements to Clang's time-trace
626634
----------------------------------
627635

@@ -695,6 +703,7 @@ Bug Fixes in This Version
695703
the second clause of a C-style ``for`` loop. (#GH139818)
696704
- Fixed a bug with constexpr evaluation for structs containing unions in case of C++ modules. (#GH143168)
697705
- Fixed incorrect token location when emitting diagnostics for tokens expanded from macros. (#GH143216)
706+
- Fixed an infinite recursion when checking constexpr destructors. (#GH141789)
698707

699708
Bug Fixes to Compiler Builtins
700709
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)