Skip to content

Commit 7827646

Browse files
committed
Merge remote-tracking branch 'origin/main' into pr/zhinx-subreg
2 parents 56c3b94 + 7e56a09 commit 7827646

File tree

1,333 files changed

+39714
-14927
lines changed

Some content is hidden

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

1,333 files changed

+39714
-14927
lines changed

.github/workflows/commit-access-review.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,10 @@ def main():
358358
gh = github.Github(login_or_token=token)
359359
org = gh.get_organization("llvm")
360360
repo = org.get_repo("llvm-project")
361-
team = org.get_team_by_slug("llvm-committers")
362361
one_year_ago = datetime.datetime.now() - datetime.timedelta(days=365)
363362
triage_list = {}
364-
for member in team.get_members():
365-
triage_list[member.login] = User(member.login, triage_list)
363+
for collaborator in repo.get_collaborators(permission="push"):
364+
triage_list[collaborator.login] = User(collaborator.login, triage_list)
366365

367366
print("Start:", len(triage_list), "triagers")
368367
# Step 0 Check if users have requested commit access in the last year.

bolt/lib/Passes/ADRRelaxationPass.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,15 @@ void ADRRelaxationPass::runOnFunction(BinaryFunction &BF) {
5959
// Don't relax adr if it points to the same function and it is not split
6060
// and BF initial size is < 1MB.
6161
const unsigned OneMB = 0x100000;
62-
if (!BF.isSplit() && BF.getSize() < OneMB) {
62+
if (BF.getSize() < OneMB) {
6363
BinaryFunction *TargetBF = BC.getFunctionForSymbol(Symbol);
64-
if (TargetBF && TargetBF == &BF)
64+
if (TargetBF == &BF && !BF.isSplit())
6565
continue;
66+
// No relaxation needed if ADR references a basic block in the same
67+
// fragment.
68+
if (BinaryBasicBlock *TargetBB = BF.getBasicBlockForLabel(Symbol))
69+
if (BB.getFragmentNum() == TargetBB->getFragmentNum())
70+
continue;
6671
}
6772

6873
MCPhysReg Reg;

clang-tools-extra/clang-tidy/cert/FloatLoopCounter.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,38 @@
99
#include "FloatLoopCounter.h"
1010
#include "clang/AST/ASTContext.h"
1111
#include "clang/ASTMatchers/ASTMatchFinder.h"
12+
#include "clang/ASTMatchers/ASTMatchers.h"
1213

1314
using namespace clang::ast_matchers;
1415

1516
namespace clang::tidy::cert {
1617

1718
void FloatLoopCounter::registerMatchers(MatchFinder *Finder) {
1819
Finder->addMatcher(
19-
forStmt(hasIncrement(expr(hasType(realFloatingPointType())))).bind("for"),
20+
forStmt(hasIncrement(forEachDescendant(
21+
declRefExpr(hasType(realFloatingPointType()),
22+
to(varDecl().bind("var")))
23+
.bind("inc"))),
24+
hasCondition(forEachDescendant(
25+
declRefExpr(hasType(realFloatingPointType()),
26+
to(varDecl(equalsBoundNode("var"))))
27+
.bind("cond"))))
28+
.bind("for"),
2029
this);
2130
}
2231

2332
void FloatLoopCounter::check(const MatchFinder::MatchResult &Result) {
2433
const auto *FS = Result.Nodes.getNodeAs<ForStmt>("for");
2534

26-
diag(FS->getInc()->getExprLoc(), "loop induction expression should not have "
27-
"floating-point type");
35+
diag(FS->getInc()->getBeginLoc(), "loop induction expression should not have "
36+
"floating-point type")
37+
<< Result.Nodes.getNodeAs<DeclRefExpr>("inc")->getSourceRange()
38+
<< Result.Nodes.getNodeAs<DeclRefExpr>("cond")->getSourceRange();
39+
40+
if (!FS->getInc()->getType()->isRealFloatingType())
41+
if (const auto *V = Result.Nodes.getNodeAs<VarDecl>("var"))
42+
diag(V->getBeginLoc(), "floating-point type loop induction variable",
43+
DiagnosticIDs::Note);
2844
}
2945

3046
} // namespace clang::tidy::cert

clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void updateAssignmentLevel(
8383
memberExpr(hasObjectExpression(cxxThisExpr()),
8484
member(fieldDecl(indexNotLessThan(Field->getFieldIndex()))));
8585
auto DeclMatcher = declRefExpr(
86-
to(varDecl(unless(parmVarDecl()), hasDeclContext(equalsNode(Ctor)))));
86+
to(valueDecl(unless(parmVarDecl()), hasDeclContext(equalsNode(Ctor)))));
8787
const bool HasDependence = !match(expr(anyOf(MemberMatcher, DeclMatcher,
8888
hasDescendant(MemberMatcher),
8989
hasDescendant(DeclMatcher))),

clang-tools-extra/clang-tidy/performance/AvoidEndlCheck.cpp

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,38 +46,41 @@ void AvoidEndlCheck::check(const MatchFinder::MatchResult &Result) {
4646
// Handle the more common streaming '... << std::endl' case
4747
const CharSourceRange TokenRange =
4848
CharSourceRange::getTokenRange(Expression->getSourceRange());
49-
const StringRef SourceText = Lexer::getSourceText(
49+
StringRef SourceText = Lexer::getSourceText(
5050
TokenRange, *Result.SourceManager, Result.Context->getLangOpts());
51-
51+
if (SourceText.empty())
52+
SourceText = "std::endl";
5253
auto Diag = diag(Expression->getBeginLoc(),
5354
"do not use '%0' with streams; use '\\n' instead")
5455
<< SourceText;
55-
56-
Diag << FixItHint::CreateReplacement(TokenRange, "'\\n'");
56+
if (TokenRange.isValid())
57+
Diag << FixItHint::CreateReplacement(TokenRange, "'\\n'");
5758
} else {
5859
// Handle the less common function call 'std::endl(...)' case
5960
const auto *CallExpression = llvm::cast<CallExpr>(Expression);
6061
assert(CallExpression->getNumArgs() == 1);
6162

62-
const StringRef SourceText = Lexer::getSourceText(
63+
StringRef SourceText = Lexer::getSourceText(
6364
CharSourceRange::getTokenRange(
6465
CallExpression->getCallee()->getSourceRange()),
6566
*Result.SourceManager, Result.Context->getLangOpts());
67+
if (SourceText.empty())
68+
SourceText = "std::endl";
69+
auto Diag = diag(CallExpression->getBeginLoc(),
70+
"do not use '%0' with streams; use '\\n' instead")
71+
<< SourceText;
6672

6773
const CharSourceRange ArgTokenRange = CharSourceRange::getTokenRange(
6874
CallExpression->getArg(0)->getSourceRange());
6975
const StringRef ArgSourceText = Lexer::getSourceText(
7076
ArgTokenRange, *Result.SourceManager, Result.Context->getLangOpts());
71-
72-
const std::string ReplacementString =
73-
std::string(ArgSourceText) + " << '\\n'";
74-
75-
diag(CallExpression->getBeginLoc(),
76-
"do not use '%0' with streams; use '\\n' instead")
77-
<< SourceText
78-
<< FixItHint::CreateReplacement(
79-
CharSourceRange::getTokenRange(CallExpression->getSourceRange()),
80-
ReplacementString);
77+
const CharSourceRange ReplacementRange =
78+
CharSourceRange::getTokenRange(CallExpression->getSourceRange());
79+
if (!ArgSourceText.empty() && ReplacementRange.isValid()) {
80+
const std::string ReplacementString =
81+
std::string(ArgSourceText) + " << '\\n'";
82+
Diag << FixItHint::CreateReplacement(ReplacementRange, ReplacementString);
83+
}
8184
}
8285
}
8386

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ struct AvoidUnconditionalPreprocessorIfPPCallbacks : public PPCallbacks {
8484
return (Tok.getRawIdentifier() == "true" ||
8585
Tok.getRawIdentifier() == "false");
8686
default:
87-
return Tok.getKind() >= tok::l_square && Tok.getKind() <= tok::caretcaret;
87+
return Tok.getKind() >= tok::l_square &&
88+
Tok.getKind() <= tok::greatergreatergreater;
8889
}
8990
}
9091

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ TEST_F(ConfigCompileTests, DiagnosticSuppression) {
298298
"unreachable-code", "unused-variable",
299299
"typecheck_bool_condition",
300300
"unexpected_friend", "warn_alloca"));
301-
clang::DiagnosticsEngine DiagEngine(nullptr, nullptr,
301+
clang::DiagnosticsEngine DiagEngine(new DiagnosticIDs, nullptr,
302302
new clang::IgnoringDiagConsumer);
303303

304304
using Diag = clang::Diagnostic;

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,15 @@ Changes in existing checks
111111
<clang-tidy/checks/bugprone/casting-through-void>` check to suggest replacing
112112
the offending code with ``reinterpret_cast``, to more clearly express intent.
113113

114+
- Improved :doc:`cert-flp30-c<clang-tidy/checks/cert/flp30-c>` check to
115+
fix false positive that floating point variable is only used in increment
116+
expression.
117+
118+
- Improved :doc:`cppcoreguidelines-prefer-member-initializer
119+
<clang-tidy/checks/cppcoreguidelines/prefer-member-initializer>` check to avoid
120+
false positive when member initialization depends on a structured binging
121+
variable.
122+
114123
- Improved :doc:`modernize-use-std-format
115124
<clang-tidy/checks/modernize/use-std-format>` check to support replacing
116125
member function calls too.
@@ -123,6 +132,10 @@ Changes in existing checks
123132
<clang-tidy/checks/modernize/use-std-print>` check to support replacing
124133
member function calls too.
125134

135+
- Improved :doc:`performance-avoid-endl
136+
<clang-tidy/checks/performance/avoid-endl>` check to use ``std::endl`` as
137+
placeholder when lexer cannot get source text.
138+
126139
- Improved :doc:`readability-implicit-bool-conversion
127140
<clang-tidy/checks/readability/implicit-bool-conversion>` check
128141
by adding the option `UseUpperCaseLiteralSuffix` to select the

clang-tools-extra/pseudo/lib/cxx/cxx.bnf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,6 @@ operator-name := >
639639
operator-name := <=
640640
operator-name := >=
641641
operator-name := <=>
642-
operator-name := ^^
643642
operator-name := ||
644643
operator-name := <<
645644
operator-name := greatergreater
Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
// RUN: %check_clang_tidy %s cert-flp30-c %t
22

33
float g(void);
4+
int c(float);
5+
float f = 1.0f;
6+
7+
void match(void) {
48

5-
void func(void) {
69
for (float x = 0.1f; x <= 1.0f; x += 0.1f) {}
7-
// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: loop induction expression should not have floating-point type [cert-flp30-c]
10+
// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: loop induction expression should not have floating-point type [cert-flp30-c]
811

9-
float f = 1.0f;
1012
for (; f > 0; --f) {}
11-
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: loop induction expression
13+
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: loop induction expression should not have floating-point type [cert-flp30-c]
1214

13-
for (;;g()) {}
14-
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: loop induction expression
15+
for (float x = 0.0f; c(x); x = g()) {}
16+
// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: loop induction expression should not have floating-point type [cert-flp30-c]
1517

16-
for (int i = 0; i < 10; i += 1.0f) {}
18+
for (int i=0; i < 10 && f < 2.0f; f++, i++) {}
19+
// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: loop induction expression should not have floating-point type [cert-flp30-c]
20+
// CHECK-MESSAGES: :5:1: note: floating-point type loop induction variable
21+
}
1722

23+
void not_match(void) {
24+
for (int i = 0; i < 10; i += 1.0f) {}
1825
for (int i = 0; i < 10; ++i) {}
26+
for (int i = 0; i < 10; ++i, f++) {}
27+
for (int i = 0; f < 10.f; ++i) {}
1928
}

0 commit comments

Comments
 (0)