Skip to content

Commit 94a627f

Browse files
authored
merge main into amd-staging (#624)
2 parents bcea769 + d59d11f commit 94a627f

File tree

164 files changed

+14682
-7055
lines changed

Some content is hidden

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

164 files changed

+14682
-7055
lines changed

.github/new-prs-labeler.yml

Lines changed: 1130 additions & 812 deletions
Large diffs are not rendered by default.

.github/workflows/new-prs.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ jobs:
2626
# See https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=opened#pull_request
2727
# for all the possible values.
2828
if: >-
29-
(github.repository == 'llvm/llvm-project') &&
3029
(github.event.action == 'opened') &&
3130
(github.event.pull_request.author_association != 'COLLABORATOR') &&
3231
(github.event.pull_request.author_association != 'CONTRIBUTOR') &&
@@ -67,9 +66,7 @@ jobs:
6766
github.event.pull_request.draft == false &&
6867
github.event.pull_request.commits < 10
6968
steps:
70-
- uses: actions/labeler@ac9175f8a1f3625fd0d4fb234536d26811351594 # v4.3.0
69+
- uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1
7170
with:
7271
configuration-path: .github/new-prs-labeler.yml
73-
# workaround for https://github.com/actions/labeler/issues/112
74-
sync-labels: ''
7572
repo-token: ${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}

bolt/test/lit.local.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if not "linux" in host_triple:
55
host_triple = host_triple.split("-")[0] + "-unknown-linux-gnu"
66

77
common_linker_flags = "-fuse-ld=lld -Wl,--unresolved-symbols=ignore-all -Wl,--build-id=none -pie"
8-
flags = f"--target={host_triple} -fPIE {common_linker_flags}"
8+
flags = f"--target={host_triple} -fPIE {common_linker_flags} -mllvm -x86-asm-syntax=att"
99

1010
config.substitutions.insert(0, ("%cflags", f"%cflags {flags}"))
1111
config.substitutions.insert(0, ("%cxxflags", f"%cxxflags {flags}"))

clang-tools-extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ void AvoidCStyleCastsCheck::check(const MatchFinder::MatchResult &Result) {
248248
}
249249
break;
250250
}
251+
if (DestType->isVoidPointerType() && SourceType->isPointerType() &&
252+
!SourceType->getPointeeType()->isPointerType()) {
253+
ReplaceWithNamedCast("reinterpret_cast");
254+
return;
255+
}
256+
251257
[[fallthrough]];
252258
case clang::CK_IntegralCast:
253259
// Convert integral and no-op casts between builtin types and enums to

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ Changes in existing checks
426426

427427
- Improved :doc:`google-readability-casting
428428
<clang-tidy/checks/google/readability-casting>` check by adding fix-it
429-
notes for downcasts.
429+
notes for downcasts and casts to void pointer.
430430

431431
- Improved :doc:`google-readability-todo
432432
<clang-tidy/checks/google/readability-todo>` check to accept the new TODO

clang-tools-extra/docs/clang-tidy/checks/list.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,9 @@ Check aliases
462462
:doc:`cert-mem57-cpp <cert/mem57-cpp>`, :doc:`bugprone-default-operator-new-on-overaligned-type <bugprone/default-operator-new-on-overaligned-type>`,
463463
:doc:`cert-msc24-c <cert/msc24-c>`, :doc:`bugprone-unsafe-functions <bugprone/unsafe-functions>`,
464464
:doc:`cert-msc30-c <cert/msc30-c>`, :doc:`misc-predictable-rand <misc/predictable-rand>`,
465-
:doc:`cert-msc50-cpp <cert/msc50-cpp>`, :doc:`misc-predictable-rand <misc/predictable-rand>`,
466465
:doc:`cert-msc32-c <cert/msc32-c>`, :doc:`bugprone-random-generator-seed <bugprone/random-generator-seed>`,
467466
:doc:`cert-msc33-c <cert/msc33-c>`, :doc:`bugprone-unsafe-functions <bugprone/unsafe-functions>`,
467+
:doc:`cert-msc50-cpp <cert/msc50-cpp>`, :doc:`misc-predictable-rand <misc/predictable-rand>`,
468468
:doc:`cert-msc51-cpp <cert/msc51-cpp>`, :doc:`bugprone-random-generator-seed <bugprone/random-generator-seed>`,
469469
:doc:`cert-msc54-cpp <cert/msc54-cpp>`, :doc:`bugprone-signal-handler <bugprone/signal-handler>`,
470470
:doc:`cert-oop11-cpp <cert/oop11-cpp>`, :doc:`performance-move-constructor-init <performance/move-constructor-init>`,

clang-tools-extra/test/clang-tidy/checkers/google/readability-casting.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ void f(int a, double b, const char *cpc, const void *cpv, X *pX) {
108108
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}}; use static_cast {{.*}}
109109
// CHECK-FIXES: Y &rB = static_cast<Y&>(*pX);
110110

111+
void *vp = (void *) pX;
112+
// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: {{.*}}; use reinterpret_cast
113+
// CHECK-FIXES: void *vp = reinterpret_cast<void *>(pX);
114+
111115
const char *pc3 = (const char*)cpv;
112116
// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: {{.*}}; use static_cast [
113117
// CHECK-FIXES: const char *pc3 = static_cast<const char*>(cpv);

clang/docs/AllocToken.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ change or removal. These may (experimentally) be selected with ``-Xclang
5252
The following command-line options affect generated token IDs:
5353

5454
* ``-falloc-token-max=<N>``
55-
Configures the maximum number of tokens. No max by default (tokens bounded
56-
by ``SIZE_MAX``).
55+
Configures the maximum number of token IDs. By default the number of tokens
56+
is bounded by ``SIZE_MAX``.
5757

5858
Querying Token IDs with ``__builtin_infer_alloc_token``
5959
=======================================================
@@ -129,7 +129,7 @@ Fast ABI
129129
--------
130130

131131
An alternative ABI can be enabled with ``-fsanitize-alloc-token-fast-abi``,
132-
which encodes the token ID hint in the allocation function name.
132+
which encodes the token ID in the allocation function name.
133133

134134
.. code-block:: c
135135

clang/include/clang/Analysis/Analyses/LifetimeSafety/Facts.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ class Fact {
4242
/// it. Otherwise, the source's loan set is merged into the destination's
4343
/// loan set.
4444
OriginFlow,
45-
/// An origin escapes the function by flowing into the return value.
46-
ReturnOfOrigin,
4745
/// An origin is used (eg. appears as l-value expression like DeclRefExpr).
4846
Use,
4947
/// A marker for a specific point in the code, for testing.
5048
TestPoint,
49+
/// An origin that escapes the function scope (e.g., via return).
50+
OriginEscapes,
5151
};
5252

5353
private:
@@ -136,16 +136,19 @@ class OriginFlowFact : public Fact {
136136
const OriginManager &OM) const override;
137137
};
138138

139-
class ReturnOfOriginFact : public Fact {
139+
class OriginEscapesFact : public Fact {
140140
OriginID OID;
141+
const Expr *EscapeExpr;
141142

142143
public:
143144
static bool classof(const Fact *F) {
144-
return F->getKind() == Kind::ReturnOfOrigin;
145+
return F->getKind() == Kind::OriginEscapes;
145146
}
146147

147-
ReturnOfOriginFact(OriginID OID) : Fact(Kind::ReturnOfOrigin), OID(OID) {}
148-
OriginID getReturnedOriginID() const { return OID; }
148+
OriginEscapesFact(OriginID OID, const Expr *EscapeExpr)
149+
: Fact(Kind::OriginEscapes), OID(OID), EscapeExpr(EscapeExpr) {}
150+
OriginID getEscapedOriginID() const { return OID; }
151+
const Expr *getEscapeExpr() const { return EscapeExpr; };
149152
void dump(llvm::raw_ostream &OS, const LoanManager &,
150153
const OriginManager &OM) const override;
151154
};
@@ -225,6 +228,9 @@ class FactManager {
225228
/// user-defined locations in the code.
226229
/// \note This is intended for testing only.
227230
llvm::StringMap<ProgramPoint> getTestPoints() const;
231+
/// Retrieves all the facts in the block containing Program Point P.
232+
/// \note This is intended for testing only.
233+
llvm::ArrayRef<const Fact *> getBlockContaining(ProgramPoint P) const;
228234

229235
unsigned getNumFacts() const { return NextFactID.Value; }
230236

clang/include/clang/Analysis/Analyses/LifetimeSafety/FactsGenerator.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ class FactsGenerator : public ConstStmtVisitor<FactsGenerator> {
9494
FactManager &FactMgr;
9595
AnalysisDeclContext &AC;
9696
llvm::SmallVector<Fact *> CurrentBlockFacts;
97+
// Collect origins that escape the function in this block (OriginEscapesFact),
98+
// appended at the end of CurrentBlockFacts to ensure they appear after
99+
// ExpireFact entries.
100+
llvm::SmallVector<Fact *> EscapesInCurrentBlock;
97101
// To distinguish between reads and writes for use-after-free checks, this map
98102
// stores the `UseFact` for each `DeclRefExpr`. We initially identify all
99103
// `DeclRefExpr`s as "read" uses. When an assignment is processed, the use

0 commit comments

Comments
 (0)