Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 8422cc0

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:bf01bb851b1e1a977ba1b92e7eb9c8c6d773e6d5 into amd-gfx:b797b956371e
Local branch amd-gfx b797b95 Manual merge remote-tracking branch llvm-org/main into amd-gfx Remote branch main bf01bb8 [lldb] Refactor string manipulation in Debugger.cpp (llvm#92565)
2 parents b797b95 + bf01bb8 commit 8422cc0

File tree

1,254 files changed

+39283
-13057
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,254 files changed

+39283
-13057
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
path: |
8080
**/test-results.xml
8181
**/*.abilist
82+
**/CMakeConfigureLog.yaml
8283
**/CMakeError.log
8384
**/CMakeOutput.log
8485
**/crash_diagnostics/*
@@ -123,6 +124,7 @@ jobs:
123124
path: |
124125
**/test-results.xml
125126
**/*.abilist
127+
**/CMakeConfigureLog.yaml
126128
**/CMakeError.log
127129
**/CMakeOutput.log
128130
**/crash_diagnostics/*
@@ -188,6 +190,7 @@ jobs:
188190
path: |
189191
**/test-results.xml
190192
**/*.abilist
193+
**/CMakeConfigureLog.yaml
191194
**/CMakeError.log
192195
**/CMakeOutput.log
193196
**/crash_diagnostics/*
@@ -230,6 +233,7 @@ jobs:
230233
path: |
231234
**/test-results.xml
232235
**/*.abilist
236+
**/CMakeConfigureLog.yaml
233237
**/CMakeError.log
234238
**/CMakeOutput.log
235239
**/crash_diagnostics/*

bolt/lib/Core/HashUtilities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ std::string hashBlockLoose(BinaryContext &BC, const BinaryBasicBlock &BB) {
145145
continue;
146146
}
147147

148-
std::string Mnemonic = BC.InstPrinter->getMnemonic(&Inst).first;
148+
std::string Mnemonic = BC.InstPrinter->getMnemonic(Inst).first;
149149
llvm::erase_if(Mnemonic, [](unsigned char ch) { return std::isspace(ch); });
150150
Opcodes.insert(Mnemonic);
151151
}

clang-tools-extra/clang-tidy/altera/IdDependentBackwardBranchCheck.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,33 +78,44 @@ void IdDependentBackwardBranchCheck::registerMatchers(MatchFinder *Finder) {
7878

7979
IdDependentBackwardBranchCheck::IdDependencyRecord *
8080
IdDependentBackwardBranchCheck::hasIdDepVar(const Expr *Expression) {
81+
if (!Expression)
82+
return nullptr;
83+
8184
if (const auto *Declaration = dyn_cast<DeclRefExpr>(Expression)) {
8285
// It is a DeclRefExpr, so check if it's an ID-dependent variable.
83-
const auto *CheckVariable = dyn_cast<VarDecl>(Declaration->getDecl());
86+
const auto *CheckVariable =
87+
dyn_cast_if_present<VarDecl>(Declaration->getDecl());
88+
if (!CheckVariable)
89+
return nullptr;
8490
auto FoundVariable = IdDepVarsMap.find(CheckVariable);
8591
if (FoundVariable == IdDepVarsMap.end())
8692
return nullptr;
8793
return &(FoundVariable->second);
8894
}
8995
for (const auto *Child : Expression->children())
90-
if (const auto *ChildExpression = dyn_cast<Expr>(Child))
96+
if (const auto *ChildExpression = dyn_cast_if_present<Expr>(Child))
9197
if (IdDependencyRecord *Result = hasIdDepVar(ChildExpression))
9298
return Result;
9399
return nullptr;
94100
}
95101

96102
IdDependentBackwardBranchCheck::IdDependencyRecord *
97103
IdDependentBackwardBranchCheck::hasIdDepField(const Expr *Expression) {
104+
if (!Expression)
105+
return nullptr;
106+
98107
if (const auto *MemberExpression = dyn_cast<MemberExpr>(Expression)) {
99108
const auto *CheckField =
100-
dyn_cast<FieldDecl>(MemberExpression->getMemberDecl());
109+
dyn_cast_if_present<FieldDecl>(MemberExpression->getMemberDecl());
110+
if (!CheckField)
111+
return nullptr;
101112
auto FoundField = IdDepFieldsMap.find(CheckField);
102113
if (FoundField == IdDepFieldsMap.end())
103114
return nullptr;
104115
return &(FoundField->second);
105116
}
106117
for (const auto *Child : Expression->children())
107-
if (const auto *ChildExpression = dyn_cast<Expr>(Child))
118+
if (const auto *ChildExpression = dyn_cast_if_present<Expr>(Child))
108119
if (IdDependencyRecord *Result = hasIdDepField(ChildExpression))
109120
return Result;
110121
return nullptr;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ struct CognitiveComplexity final {
126126
// Limit of 25 is the "upstream"'s default.
127127
static constexpr unsigned DefaultLimit = 25U;
128128

129-
// Based on the publicly-avaliable numbers for some big open-source projects
129+
// Based on the publicly-available numbers for some big open-source projects
130130
// https://sonarcloud.io/projects?languages=c%2Ccpp&size=5 we can estimate:
131131
// value ~20 would result in no allocs for 98% of functions, ~12 for 96%, ~10
132132
// for 91%, ~8 for 88%, ~6 for 84%, ~4 for 77%, ~2 for 64%, and ~1 for 37%.

clang-tools-extra/clangd/Protocol.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,16 @@ bool fromJSON(const llvm::json::Value &Params, ClientCapabilities &R,
504504
P.field("offsetEncoding")))
505505
return false;
506506
}
507+
508+
if (auto *Experimental = O->getObject("experimental")) {
509+
if (auto *TextDocument = Experimental->getObject("textDocument")) {
510+
if (auto *Completion = TextDocument->getObject("completion")) {
511+
if (auto EditsNearCursor = Completion->getBoolean("editsNearCursor"))
512+
R.CompletionFixes |= *EditsNearCursor;
513+
}
514+
}
515+
}
516+
507517
return true;
508518
}
509519

clang-tools-extra/clangd/XRefs.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2238,7 +2238,10 @@ prepareCallHierarchy(ParsedAST &AST, Position Pos, PathRef TUPath) {
22382238
for (const NamedDecl *Decl : getDeclAtPosition(AST, *Loc, {})) {
22392239
if (!(isa<DeclContext>(Decl) &&
22402240
cast<DeclContext>(Decl)->isFunctionOrMethod()) &&
2241-
Decl->getKind() != Decl::Kind::FunctionTemplate)
2241+
Decl->getKind() != Decl::Kind::FunctionTemplate &&
2242+
!(Decl->getKind() == Decl::Kind::Var &&
2243+
!cast<VarDecl>(Decl)->isLocalVarDecl()) &&
2244+
Decl->getKind() != Decl::Kind::Field)
22422245
continue;
22432246
if (auto CHI = declToCallHierarchyItem(*Decl, AST.tuPath()))
22442247
Result.emplace_back(std::move(*CHI));

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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,51 @@ TEST(CallHierarchy, CallInLocalVarDecl) {
446446
AllOf(from(withName("caller3")), fromRanges(Source.range("call3")))));
447447
}
448448

449+
TEST(CallHierarchy, HierarchyOnField) {
450+
// Tests that the call hierarchy works on fields.
451+
Annotations Source(R"cpp(
452+
struct Vars {
453+
int v^ar1 = 1;
454+
};
455+
void caller() {
456+
Vars values;
457+
values.$Callee[[var1]];
458+
}
459+
)cpp");
460+
TestTU TU = TestTU::withCode(Source.code());
461+
auto AST = TU.build();
462+
auto Index = TU.index();
463+
464+
std::vector<CallHierarchyItem> Items =
465+
prepareCallHierarchy(AST, Source.point(), testPath(TU.Filename));
466+
ASSERT_THAT(Items, ElementsAre(withName("var1")));
467+
auto IncomingLevel1 = incomingCalls(Items[0], Index.get());
468+
ASSERT_THAT(IncomingLevel1,
469+
ElementsAre(AllOf(from(withName("caller")),
470+
fromRanges(Source.range("Callee")))));
471+
}
472+
473+
TEST(CallHierarchy, HierarchyOnVar) {
474+
// Tests that the call hierarchy works on non-local variables.
475+
Annotations Source(R"cpp(
476+
int v^ar = 1;
477+
void caller() {
478+
$Callee[[var]];
479+
}
480+
)cpp");
481+
TestTU TU = TestTU::withCode(Source.code());
482+
auto AST = TU.build();
483+
auto Index = TU.index();
484+
485+
std::vector<CallHierarchyItem> Items =
486+
prepareCallHierarchy(AST, Source.point(), testPath(TU.Filename));
487+
ASSERT_THAT(Items, ElementsAre(withName("var")));
488+
auto IncomingLevel1 = incomingCalls(Items[0], Index.get());
489+
ASSERT_THAT(IncomingLevel1,
490+
ElementsAre(AllOf(from(withName("caller")),
491+
fromRanges(Source.range("Callee")))));
492+
}
493+
449494
} // namespace
450495
} // namespace clangd
451496
} // namespace clang

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ New check aliases
147147
Changes in existing checks
148148
^^^^^^^^^^^^^^^^^^^^^^^^^^
149149

150+
- Improved :doc:`altera-id-dependent-backward-branch
151+
<clang-tidy/checks/altera/id-dependent-backward-branch>` check by fixing
152+
crashes from invalid code.
153+
150154
- Improved :doc:`bugprone-casting-through-void
151155
<clang-tidy/checks/bugprone/casting-through-void>` check to suggest replacing
152156
the offending code with ``reinterpret_cast``, to more clearly express intent.

clang-tools-extra/test/clang-tidy/checkers/altera/id-dependent-backward-branch.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %check_clang_tidy %s altera-id-dependent-backward-branch %t -- -header-filter=.* "--" -cl-std=CL1.2 -c
1+
// RUN: %check_clang_tidy %s altera-id-dependent-backward-branch %t -- -header-filter=.* "--" -cl-std=CLC++1.0 -c
22

33
void error() {
44
// ==== Conditional Expressions ====
@@ -80,3 +80,9 @@ void success() {
8080
}
8181
}
8282
}
83+
84+
template<char... STOP>
85+
void gh55408(char const input[], int pos) {
86+
while (((input[pos] != STOP) && ...));
87+
}
88+

clang-tools-extra/test/clang-tidy/checkers/readability/function-cognitive-complexity.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ void unittest_false() {
6969
//----------------------------------------------------------------------------//
7070

7171
// break does not increase cognitive complexity.
72-
// only break LABEL does, but it is unavaliable in C or C++
72+
// only break LABEL does, but it is unavailable in C or C++
7373

7474
// continue does not increase cognitive complexity.
75-
// only continue LABEL does, but it is unavaliable in C or C++
75+
// only continue LABEL does, but it is unavailable in C or C++
7676

7777
void unittest_b1_00() {
7878
// CHECK-NOTES: :[[@LINE-1]]:6: warning: function 'unittest_b1_00' has cognitive complexity of 33 (threshold 0) [readability-function-cognitive-complexity]

0 commit comments

Comments
 (0)