Skip to content

Commit 6be5e32

Browse files
Merge branch 'main' into spv_intel_arbitrary_floating_points
2 parents 7916be8 + 60b3cc6 commit 6be5e32

File tree

533 files changed

+16460
-3278
lines changed

Some content is hidden

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

533 files changed

+16460
-3278
lines changed

.github/renovate.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:recommended"
5+
],
6+
"includePaths": [".github/**"],
7+
"schedule": "* 0 * * 1",
8+
"minimumReleaseAge": "3 days",
9+
"assignees": ["boomanaiden154"],
10+
"ignorePaths": [".github/workflows/containers/**"],
11+
"groupName": "[Github] Update GHA Dependencies"
12+
}

bolt/include/bolt/Core/FunctionLayout.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,20 +232,31 @@ class FunctionLayout {
232232
return Blocks[Index];
233233
}
234234

235+
/// Return the basic block after the given basic block iterator in the layout
236+
/// or nullptr if the last basic block iterator is given.
237+
const BinaryBasicBlock *getBasicBlockAfter(block_const_iterator BlockIt,
238+
bool IgnoreSplits = true) const;
239+
240+
/// Returns the basic block after the given basic block in the layout or
241+
/// nullptr if the last basic block is given.
242+
///
243+
/// Note: prefer the version that takes the iterator as this function uses
244+
/// linear basic block lookup.
245+
const BinaryBasicBlock *getBasicBlockAfter(const BinaryBasicBlock *BB,
246+
bool IgnoreSplits = true) const;
247+
235248
/// Returns the basic block after the given basic block in the layout or
236249
/// nullptr if the last basic block is given.
250+
///
251+
/// Note: prefer the version that takes the iterator as this function uses
252+
/// linear basic block lookup.
237253
BinaryBasicBlock *getBasicBlockAfter(const BinaryBasicBlock *const BB,
238254
const bool IgnoreSplits = true) {
239255
return const_cast<BinaryBasicBlock *>(
240256
static_cast<const FunctionLayout &>(*this).getBasicBlockAfter(
241257
BB, IgnoreSplits));
242258
}
243259

244-
/// Returns the basic block after the given basic block in the layout or
245-
/// nullptr if the last basic block is given.
246-
const BinaryBasicBlock *getBasicBlockAfter(const BinaryBasicBlock *BB,
247-
bool IgnoreSplits = true) const;
248-
249260
/// True if the layout contains at least two non-empty fragments.
250261
bool isSplit() const;
251262

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3598,7 +3598,9 @@ void BinaryFunction::fixBranches() {
35983598
auto &MIB = BC.MIB;
35993599
MCContext *Ctx = BC.Ctx.get();
36003600

3601-
for (BinaryBasicBlock *BB : BasicBlocks) {
3601+
for (auto BBI = Layout.block_begin(), BBE = Layout.block_end(); BBI != BBE;
3602+
++BBI) {
3603+
BinaryBasicBlock *BB = *BBI;
36023604
const MCSymbol *TBB = nullptr;
36033605
const MCSymbol *FBB = nullptr;
36043606
MCInst *CondBranch = nullptr;
@@ -3612,7 +3614,7 @@ void BinaryFunction::fixBranches() {
36123614

36133615
// Basic block that follows the current one in the final layout.
36143616
const BinaryBasicBlock *const NextBB =
3615-
Layout.getBasicBlockAfter(BB, /*IgnoreSplits=*/false);
3617+
Layout.getBasicBlockAfter(BBI, /*IgnoreSplits*/ false);
36163618

36173619
if (BB->succ_size() == 1) {
36183620
// __builtin_unreachable() could create a conditional branch that

bolt/lib/Core/FunctionLayout.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,23 +224,29 @@ void FunctionLayout::clear() {
224224
}
225225

226226
const BinaryBasicBlock *
227-
FunctionLayout::getBasicBlockAfter(const BinaryBasicBlock *BB,
227+
FunctionLayout::getBasicBlockAfter(block_const_iterator BBIter,
228228
bool IgnoreSplits) const {
229-
const block_const_iterator BBPos = find(blocks(), BB);
230-
if (BBPos == block_end())
231-
return nullptr;
232-
233-
const block_const_iterator BlockAfter = std::next(BBPos);
229+
const block_const_iterator BlockAfter = std::next(BBIter);
234230
if (BlockAfter == block_end())
235231
return nullptr;
236232

237233
if (!IgnoreSplits)
238-
if (BlockAfter == getFragment(BB->getFragmentNum()).end())
234+
if (BlockAfter == getFragment((*BBIter)->getFragmentNum()).end())
239235
return nullptr;
240236

241237
return *BlockAfter;
242238
}
243239

240+
const BinaryBasicBlock *
241+
FunctionLayout::getBasicBlockAfter(const BinaryBasicBlock *BB,
242+
bool IgnoreSplits) const {
243+
const block_const_iterator BBPos = find(blocks(), BB);
244+
if (BBPos == block_end())
245+
return nullptr;
246+
247+
return getBasicBlockAfter(BBPos, IgnoreSplits);
248+
}
249+
244250
bool FunctionLayout::isSplit() const {
245251
const unsigned NonEmptyFragCount = llvm::count_if(
246252
fragments(), [](const FunctionFragment &FF) { return !FF.empty(); });

bolt/test/AArch64/unmarked-data.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// RUN: yaml2obj %S/Inputs/unmarked-data.yaml -o %t.exe
44
// RUN: llvm-bolt %t.exe -o %t.bolt --lite=0 --use-old-text=0 2>&1 | FileCheck %s
5-
// CHECK-NOT: BOLT-WARNING
5+
// CHECK-NOT: BOLT-WARNING: unable to disassemble instruction at offset
66
// RUN: llvm-objdump -j .text -d --disassemble-symbols=first,second %t.bolt | FileCheck %s -check-prefix=CHECK-SYMBOL
77
// CHECK-SYMBOL: <first>:
88
// CHECK-SYMBOL: <second>:

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,12 @@ Error MustacheHTMLGenerator::generateDocForInfo(Info *I, raw_ostream &OS,
274274
}
275275

276276
Error MustacheHTMLGenerator::createResources(ClangDocContext &CDCtx) {
277+
std::string ResourcePath(CDCtx.OutDirectory + "/html");
277278
for (const auto &FilePath : CDCtx.UserStylesheets)
278-
if (Error Err = copyFile(FilePath, CDCtx.OutDirectory))
279+
if (Error Err = copyFile(FilePath, ResourcePath))
279280
return Err;
280281
for (const auto &FilePath : CDCtx.JsScripts)
281-
if (Error Err = copyFile(FilePath, CDCtx.OutDirectory))
282+
if (Error Err = copyFile(FilePath, ResourcePath))
282283
return Err;
283284
return Error::success();
284285
}

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -780,12 +780,10 @@ static void populateSymbolInfo(SymbolInfo &I, const T *D, const FullComment *C,
780780
MangledStream << D->getNameAsString();
781781
// A 250 length limit was chosen since 255 is a common limit across
782782
// different filesystems, with a 5 character buffer for file extensions.
783-
if (MangledName.size() > 250)
784-
// File creation fails if the mangled name is too long, so default to the
785-
// USR. We should look for a better check since filesystems differ in
786-
// maximum filename length
787-
I.MangledName = llvm::toStringRef(llvm::toHex(I.USR));
788-
else
783+
if (MangledName.size() > 250) {
784+
auto SymbolID = llvm::toStringRef(llvm::toHex(I.USR)).str();
785+
I.MangledName = MangledName.substr(0, 250 - SymbolID.size()) + SymbolID;
786+
} else
789787
I.MangledName = MangledName;
790788
delete Mangler;
791789
}

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

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,57 @@
88

99
#include "UseDefaultMemberInitCheck.h"
1010
#include "clang/AST/ASTContext.h"
11+
#include "clang/AST/Expr.h"
1112
#include "clang/ASTMatchers/ASTMatchFinder.h"
13+
#include "clang/ASTMatchers/ASTMatchers.h"
1214
#include "clang/Lex/Lexer.h"
15+
#include "llvm/ADT/TypeSwitch.h"
1316

1417
using namespace clang::ast_matchers;
1518

1619
namespace clang::tidy::modernize {
1720

21+
static bool isExprAllowedInMemberInit(const Expr *E) {
22+
if (!E)
23+
return false;
24+
return llvm::TypeSwitch<const Expr *, bool>(E)
25+
.Case<IntegerLiteral, FloatingLiteral, CXXBoolLiteralExpr,
26+
CXXNullPtrLiteralExpr, CharacterLiteral, StringLiteral>(
27+
[](const auto *) { return true; })
28+
.Case<ImplicitValueInitExpr>([](const auto *) { return true; })
29+
.Case<ParenExpr>([](const ParenExpr *PE) {
30+
return isExprAllowedInMemberInit(PE->getSubExpr());
31+
})
32+
.Case<UnaryOperator>([](const UnaryOperator *UO) {
33+
return isExprAllowedInMemberInit(UO->getSubExpr());
34+
})
35+
.Case<BinaryOperator>([](const BinaryOperator *BO) {
36+
return isExprAllowedInMemberInit(BO->getLHS()) &&
37+
isExprAllowedInMemberInit(BO->getRHS());
38+
})
39+
.Case<CastExpr>([](const CastExpr *CE) {
40+
return isExprAllowedInMemberInit(CE->getSubExpr());
41+
})
42+
.Case<DeclRefExpr>([](const DeclRefExpr *DRE) {
43+
if (const ValueDecl *D = DRE->getDecl()) {
44+
if (isa<EnumConstantDecl>(D))
45+
return true;
46+
if (const auto *VD = dyn_cast<VarDecl>(D))
47+
return VD->isConstexpr() || VD->getStorageClass() == SC_Static;
48+
}
49+
return false;
50+
})
51+
.Default(false);
52+
}
53+
1854
namespace {
55+
1956
AST_MATCHER_P(InitListExpr, initCountIs, unsigned, N) {
2057
return Node.getNumInits() == N;
2158
}
59+
60+
AST_MATCHER(Expr, allowedInitExpr) { return isExprAllowedInMemberInit(&Node); }
61+
2262
} // namespace
2363

2464
static StringRef getValueOfValueInit(const QualType InitType) {
@@ -206,30 +246,10 @@ void UseDefaultMemberInitCheck::storeOptions(
206246
}
207247

208248
void UseDefaultMemberInitCheck::registerMatchers(MatchFinder *Finder) {
209-
auto NumericLiteral = anyOf(integerLiteral(), floatLiteral());
210-
auto UnaryNumericLiteral = unaryOperator(hasAnyOperatorName("+", "-"),
211-
hasUnaryOperand(NumericLiteral));
212-
213-
auto ConstExprRef = varDecl(anyOf(isConstexpr(), isStaticStorageClass()));
214-
auto ImmutableRef =
215-
declRefExpr(to(decl(anyOf(enumConstantDecl(), ConstExprRef))));
216-
217-
auto BinaryNumericExpr = binaryOperator(
218-
hasOperands(anyOf(NumericLiteral, ImmutableRef, binaryOperator()),
219-
anyOf(NumericLiteral, ImmutableRef, binaryOperator())));
220-
221-
auto InitBase =
222-
anyOf(stringLiteral(), characterLiteral(), NumericLiteral,
223-
UnaryNumericLiteral, cxxBoolLiteral(), cxxNullPtrLiteralExpr(),
224-
implicitValueInitExpr(), ImmutableRef, BinaryNumericExpr);
225-
226-
auto ExplicitCastExpr = castExpr(hasSourceExpression(InitBase));
227-
auto InitMatcher = anyOf(InitBase, ExplicitCastExpr);
228-
229-
auto Init =
230-
anyOf(initListExpr(anyOf(allOf(initCountIs(1), hasInit(0, InitMatcher)),
231-
initCountIs(0), hasType(arrayType()))),
232-
InitBase, ExplicitCastExpr);
249+
auto Init = anyOf(
250+
initListExpr(anyOf(allOf(initCountIs(1), hasInit(0, allowedInitExpr())),
251+
initCountIs(0), hasType(arrayType()))),
252+
allowedInitExpr());
233253

234254
Finder->addMatcher(
235255
cxxConstructorDecl(forEachConstructorInitializer(

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ Changes in existing checks
301301
uses of non-standard ``enable_if`` with a signature different from
302302
``std::enable_if`` (such as ``boost::enable_if``).
303303

304+
- Improved :doc:`modernize-use-default-member-init
305+
<clang-tidy/checks/modernize/use-default-member-init>` check to
306+
enhance the robustness of the member initializer detection.
307+
304308
- Improved :doc:`modernize-use-designated-initializers
305309
<clang-tidy/checks/modernize/use-designated-initializers>` check to
306310
suggest using designated initializers for aliased aggregate types.

clang-tools-extra/test/clang-doc/long-name.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ struct ThisStructHasANameThatResultsInAMangledNameThatIsExactly250CharactersLong
99
struct ThisStructHasANameThatResultsInAMangledNameThatIsExactly251CharactersLongThatIsSupposedToTestTheFilenameLengthLimitsWithinClangDocInOrdertoSeeifclangdocwillcrashornotdependingonthelengthofthestructIfTheLengthIsTooLongThenClangDocWillCrashAnd123 {};
1010

1111
// CHECK-JSON: ThisStructHasANameThatResultsInAMangledNameThatIsExactly250CharactersLongThatIsSupposedToTestTheFilenameLengthLimitsWithinClangDocInOrdertoSeeifclangdocwillcrashornotdependingonthelengthofthestructIfTheLengthIsTooLongThenClangDocWillCrashAnd12.json
12-
// CHECK-JSON: {{[0-9A-F]*}}.json
12+
// CHECK-JSON: _ZTV244ThisStructHasANameThatResultsInAMangledNameThatIsExactly251CharactersLongThatIsSupposedToTestTheFilenameLengthLimitsWithinClangDocInOrdertoSeeifclangdocwillcrashornotdependingonthelengthofthestructIfTheL29DE8558215A13A506661C0E01E50AA3E5C9C7FA.json
1313
// CHECK-HTML: ThisStructHasANameThatResultsInAMangledNameThatIsExactly250CharactersLongThatIsSupposedToTestTheFilenameLengthLimitsWithinClangDocInOrdertoSeeifclangdocwillcrashornotdependingonthelengthofthestructIfTheLengthIsTooLongThenClangDocWillCrashAnd12.html
14-
// CHECK-HTML: {{[0-9A-F]*}}.html
14+
// CHECK-HTML: _ZTV244ThisStructHasANameThatResultsInAMangledNameThatIsExactly251CharactersLongThatIsSupposedToTestTheFilenameLengthLimitsWithinClangDocInOrdertoSeeifclangdocwillcrashornotdependingonthelengthofthestructIfTheL29DE8558215A13A506661C0E01E50AA3E5C9C7FA.html

0 commit comments

Comments
 (0)