Skip to content

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]

clang/Maintainers.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ Sema
6969
| aeternalmail\@gmail.com (email), Sirraide (GitHub), Ætérnal (Discord), Sirraide (Discourse)
7070
7171

72+
Recovery AST
73+
~~~~~~~~~~~~
74+
| Haojian Wu
75+
| hokein.wu\@gmail.com (email), hokein (Phabricator), hokein (GitHub), hokein (Discourse)
76+
77+
7278
Experimental new constant interpreter
7379
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7480
| Timm Bäder
@@ -295,6 +301,15 @@ SYCL conformance
295301
| alexey.bader\@intel.com (email), bader (Phabricator), bader (GitHub)
296302
297303

304+
Issue Triage
305+
~~~~~~~~~~~~
306+
| Shafik Yaghmour
307+
| shafik.yaghmour\@intel.com (email), shafik (GitHub), shafik.yaghmour (Discord), shafik (Discourse)
308+
309+
| hstk30
310+
| hanwei62\@huawei.com (email), hstk30-hw (GitHub), hstk30(Discord), hstk30 (Discourse)
311+
312+
298313
Inactive Maintainers
299314
====================
300315
The following people have graciously spent time performing maintainership

clang/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If you're interested in more (including how to build Clang) it is best to read t
1616

1717
* Information on the LLVM project: http://llvm.org/
1818

19-
* If you have questions or comments about Clang, a great place to disucss them is on the Clang forums:    
19+
* If you have questions or comments about Clang, a great place to discuss them is on the Clang forums:    
2020

2121
[Clang Frontend - LLVM Discussion Forums](https://discourse.llvm.org/c/clang/)
2222

clang/docs/APINotes.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,31 @@ declaration kind), all of which are optional:
169169
to ``SWIFT_RETURNS_INDEPENDENT_VALUE``) or ``computed_property`` (equivalent to
170170
``SWIFT_COMPUTED_PROPERTY``).
171171

172+
::
173+
174+
Tags:
175+
- Name: OwnedStorage
176+
SwiftImportAs: owned
177+
178+
:SwiftRetainOp, SwiftReleaseOp:
179+
180+
Controls the lifetime operations of a class which uses custom reference
181+
counting. The class must be annotated as a reference type using
182+
``SwiftImportAs: reference``. The values are either names of global functions,
183+
each taking a single parameter of a pointer type, or ``immortal`` for a type
184+
that is considered alive for the duration of the program.
185+
172186
::
173187

174188
Tags:
175189
- Name: RefCountedStorage
176190
SwiftImportAs: reference
177191
SwiftReleaseOp: RCRelease
178192
SwiftRetainOp: RCRetain
193+
- Name: ImmortalSingleton
194+
SwiftImportAs: reference
195+
SwiftReleaseOp: immortal
196+
SwiftRetainOp: immortal
179197

180198
:SwiftCopyable:
181199

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2259,7 +2259,7 @@ the configuration (without a prefix: ``Auto``).
22592259
**BraceWrapping** (``BraceWrappingFlags``) :versionbadge:`clang-format 3.8` :ref:`<BraceWrapping>`
22602260
Control of individual brace wrapping cases.
22612261

2262-
If ``BreakBeforeBraces`` is set to ``BS_Custom``, use this to specify how
2262+
If ``BreakBeforeBraces`` is set to ``Custom``, use this to specify how
22632263
each individual brace case should be handled. Otherwise, this is ignored.
22642264

22652265
.. code-block:: yaml

clang/docs/LanguageExtensions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3979,9 +3979,9 @@ standard:
39793979
- ``4`` - to nearest, ties away from zero
39803980
The effect of passing some other value to ``__builtin_flt_rounds`` is
39813981
implementation-defined. ``__builtin_set_flt_rounds`` is currently only supported
3982-
to work on x86, x86_64, Arm and AArch64 targets. These builtins read and modify
3983-
the floating-point environment, which is not always allowed and may have unexpected
3984-
behavior. Please see the section on `Accessing the floating point environment <https://clang.llvm.org/docs/UsersManual.html#accessing-the-floating-point-environment>`_ for more information.
3982+
to work on x86, x86_64, powerpc, powerpc64, Arm and AArch64 targets. These builtins
3983+
read and modify the floating-point environment, which is not always allowed and may
3984+
have unexpected behavior. Please see the section on `Accessing the floating point environment <https://clang.llvm.org/docs/UsersManual.html#accessing-the-floating-point-environment>`_ for more information.
39853985
39863986
String builtins
39873987
---------------

clang/docs/ReleaseNotes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ Bug Fixes to C++ Support
559559
- Fixed an assertion failure in debug mode, and potential crashes in release mode, when
560560
diagnosing a failed cast caused indirectly by a failed implicit conversion to the type of the constructor parameter.
561561
- Fixed an assertion failure by adjusting integral to boolean vector conversions (#GH108326)
562+
- Fixed a crash when mixture of designated and non-designated initializers in union. (#GH113855)
562563
- Fixed an issue deducing non-type template arguments of reference type. (#GH73460)
563564
- Fixed an issue in constraint evaluation, where type constraints on the lambda expression
564565
containing outer unexpanded parameters were not correctly expanded. (#GH101754)
@@ -871,6 +872,13 @@ Sanitizers
871872
This new flag should allow those projects to enable integer sanitizers with
872873
less noise.
873874

875+
- ``-fsanitize=signed-integer-overflow``, ``-fsanitize=unsigned-integer-overflow``,
876+
``-fsanitize=implicit-signed-integer-truncation``, ``-fsanitize=implicit-unsigned-integer-truncation``,
877+
``-fsanitize=enum`` now properly support the
878+
"type" prefix within `Sanitizer Special Case Lists (SSCL)
879+
<https://clang.llvm.org/docs/SanitizerSpecialCaseList.html>`_. See that link
880+
for examples.
881+
874882
Python Binding Changes
875883
----------------------
876884
- Fixed an issue that led to crashes when calling ``Type.get_exception_specification_kind``.

0 commit comments

Comments
 (0)