Skip to content

Commit e294055

Browse files
committed
Merge from 'main' to 'sycl-web' (73 commits)
CONFLICT (content): Merge conflict in clang/include/clang/Basic/AttributeCommonInfo.h
2 parents 05fb631 + 20d7019 commit e294055

File tree

389 files changed

+23713
-30226
lines changed

Some content is hidden

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

389 files changed

+23713
-30226
lines changed

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ std::error_code DataAggregator::parseAggregatedLBREntry() {
12201220
// Storage for parsed fields.
12211221
StringRef EventName;
12221222
std::optional<Location> Addr[3];
1223-
int64_t Counters[2];
1223+
int64_t Counters[2] = {0};
12241224

12251225
while (Type == INVALID || Type == EVENT_NAME) {
12261226
while (checkAndConsumeFS()) {

bolt/test/X86/entry-point-fallthru.s

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
# RUN: link_fdata %s %t %t.preagg PREAGG
77
# RUN: perf2bolt %t -p %t.preagg --pa -o %t.fdata | FileCheck %s
88
# CHECK: traces mismatching disassembled function contents: 0
9+
# RUN: FileCheck %s --check-prefix=CHECK-FDATA --input-file %t.fdata
10+
# CHECK-FDATA: 1 main 0 1 main 6 0 1
11+
# CHECK-FDATA-NEXT: 1 main e 1 main 11 0 1
12+
# CHECK-FDATA-NEXT: 1 main 11 1 main 0 0 1
913

1014
.globl main
1115
main:

clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ void SizeofExpressionCheck::registerMatchers(MatchFinder *Finder) {
170170

171171
const auto PointerToStructType =
172172
hasUnqualifiedDesugaredType(pointerType(pointee(recordType())));
173-
const auto PointerToStructTypeWithBinding =
174-
type(PointerToStructType).bind("struct-type");
175173
const auto PointerToStructExpr =
176174
expr(hasType(hasCanonicalType(PointerToStructType)));
177175

@@ -188,12 +186,10 @@ void SizeofExpressionCheck::registerMatchers(MatchFinder *Finder) {
188186
ignoringParenImpCasts(unaryOperator(hasOperatorName("*")));
189187

190188
Finder->addMatcher(
191-
expr(sizeOfExpr(anyOf(has(ignoringParenImpCasts(
192-
expr(PointerToDetectedExpr, unless(DerefExpr),
193-
unless(SubscriptExprWithZeroIndex),
194-
unless(VarWithConstStrLiteralDecl),
195-
unless(cxxThisExpr())))),
196-
has(PointerToStructTypeWithBinding))))
189+
expr(sizeOfExpr(has(ignoringParenImpCasts(expr(
190+
PointerToDetectedExpr, unless(DerefExpr),
191+
unless(SubscriptExprWithZeroIndex),
192+
unless(VarWithConstStrLiteralDecl), unless(cxxThisExpr()))))))
197193
.bind("sizeof-pointer"),
198194
this);
199195
}
@@ -354,16 +350,9 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) {
354350
"suspicious usage of 'sizeof(char*)'; do you mean 'strlen'?")
355351
<< E->getSourceRange();
356352
} else if (const auto *E = Result.Nodes.getNodeAs<Expr>("sizeof-pointer")) {
357-
if (Result.Nodes.getNodeAs<Type>("struct-type")) {
358-
diag(E->getBeginLoc(),
359-
"suspicious usage of 'sizeof(A*)' on pointer-to-aggregate type; did "
360-
"you mean 'sizeof(A)'?")
361-
<< E->getSourceRange();
362-
} else {
363-
diag(E->getBeginLoc(), "suspicious usage of 'sizeof()' on an expression "
364-
"of pointer type")
365-
<< E->getSourceRange();
366-
}
353+
diag(E->getBeginLoc(), "suspicious usage of 'sizeof()' on an expression "
354+
"of pointer type")
355+
<< E->getSourceRange();
367356
} else if (const auto *E = Result.Nodes.getNodeAs<BinaryOperator>(
368357
"sizeof-compare-constant")) {
369358
diag(E->getOperatorLoc(),

clang/docs/LanguageExtensions.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3074,6 +3074,41 @@ following way:
30743074
30753075
Query for this feature with ``__has_builtin(__builtin_offsetof)``.
30763076
3077+
``__builtin_get_vtable_pointer``
3078+
--------------------------------
3079+
3080+
``__builtin_get_vtable_pointer`` loads and authenticates the primary vtable
3081+
pointer from an instance of a polymorphic C++ class. This builtin is needed
3082+
for directly loading the vtable pointer when on platforms using
3083+
:doc:`PointerAuthentication`.
3084+
3085+
**Syntax**:
3086+
3087+
.. code-block:: c++
3088+
3089+
__builtin_get_vtable_pointer(PolymorphicClass*)
3090+
3091+
**Example of Use**:
3092+
3093+
.. code-block:: c++
3094+
3095+
struct PolymorphicClass {
3096+
virtual ~PolymorphicClass();
3097+
};
3098+
3099+
PolymorphicClass anInstance;
3100+
const void* vtablePointer = __builtin_get_vtable_pointer(&anInstance);
3101+
3102+
**Description**:
3103+
3104+
The ``__builtin_get_vtable_pointer`` builtin loads the primary vtable
3105+
pointer from a polymorphic C++ type. If the target platform authenticates
3106+
vtable pointers, this builtin will perform the authentication and produce
3107+
the underlying raw pointer. The object being queried must be polymorphic,
3108+
and so must also be a complete type.
3109+
3110+
Query for this feature with ``__has_builtin(__builtin_get_vtable_pointer)``.
3111+
30773112
``__builtin_call_with_static_chain``
30783113
------------------------------------
30793114

clang/docs/ReleaseNotes.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ Non-comprehensive list of changes in this release
317317
``sizeof`` or ``typeof`` expression. (#GH138444)
318318
- Deprecation warning is emitted for the deprecated ``__reference_binds_to_temporary`` intrinsic.
319319
``__reference_constructs_from_temporary`` should be used instead. (#GH44056)
320+
- Added `__builtin_get_vtable_pointer` to directly load the primary vtable pointer from a
321+
polymorphic object.
320322

321323
New Compiler Flags
322324
------------------
@@ -612,6 +614,8 @@ Improvements to Clang's diagnostics
612614
diagnostic group ``-Wimplicit-int-comparison-on-negation``, grouped under
613615
``-Wimplicit-int-conversion``, so user can turn it off independently.
614616

617+
- Improved the FixIts for unused lambda captures.
618+
615619
Improvements to Clang's time-trace
616620
----------------------------------
617621

@@ -1045,7 +1049,9 @@ Sanitizers
10451049
----------
10461050

10471051
- ``-fsanitize=vptr`` is no longer a part of ``-fsanitize=undefined``.
1048-
- Sanitizer ignorelists now support the syntax ``src:*=sanitize``.
1052+
- Sanitizer ignorelists now support the syntax ``src:*=sanitize``,
1053+
``type:*=sanitize``, ``fun:*=sanitize``, ``global:*=sanitize``,
1054+
and ``mainfile:*=sanitize``.
10491055

10501056
Python Binding Changes
10511057
----------------------

clang/docs/SanitizerSpecialCaseList.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ instrumentation for arithmetic operations containing values of type ``int``.
7979

8080
The ``=sanitize`` category is also supported. Any ``=sanitize`` category
8181
entries enable sanitizer instrumentation, even if it was ignored by entries
82-
before.
82+
before. Entries can be ``src``, ``type``, ``global``, ``fun``, and
83+
``mainfile``.
8384

8485
With this, one may disable instrumentation for some or all types and
8586
specifically allow instrumentation for one or many types -- including types
@@ -102,8 +103,8 @@ supported sanitizers.
102103
char c = toobig; // also not instrumented
103104
}
104105
105-
If multiple entries match the source, than the latest entry takes the
106-
precedence.
106+
If multiple entries match the source, then the latest entry takes the
107+
precedence. Here are a few examples.
107108

108109
.. code-block:: bash
109110
@@ -119,6 +120,19 @@ precedence.
119120
src:*/mylib/test.cc
120121
src:*/mylib/*=sanitize
121122
123+
$ cat ignorelist3.txt
124+
# Type T will not be instrumented.
125+
type:*
126+
type:T=sanitize
127+
type:T
128+
129+
$ cat ignorelist4.txt
130+
# Function `bad_bar`` will be instrumented.
131+
# Function `good_bar` will not be instrumented.
132+
fun:*
133+
fun:*bar
134+
fun:bad_bar=sanitize
135+
122136
Format
123137
======
124138

clang/include/clang/AST/Expr.h

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4631,7 +4631,6 @@ class ShuffleVectorExpr : public Expr {
46314631
// indices. The number of values in this list is always
46324632
// 2+the number of indices in the vector type.
46334633
Stmt **SubExprs;
4634-
unsigned NumExprs;
46354634

46364635
public:
46374636
ShuffleVectorExpr(const ASTContext &C, ArrayRef<Expr*> args, QualType Type,
@@ -4657,36 +4656,41 @@ class ShuffleVectorExpr : public Expr {
46574656
/// getNumSubExprs - Return the size of the SubExprs array. This includes the
46584657
/// constant expression, the actual arguments passed in, and the function
46594658
/// pointers.
4660-
unsigned getNumSubExprs() const { return NumExprs; }
4659+
unsigned getNumSubExprs() const { return ShuffleVectorExprBits.NumExprs; }
46614660

46624661
/// Retrieve the array of expressions.
46634662
Expr **getSubExprs() { return reinterpret_cast<Expr **>(SubExprs); }
46644663

46654664
/// getExpr - Return the Expr at the specified index.
46664665
Expr *getExpr(unsigned Index) {
4667-
assert((Index < NumExprs) && "Arg access out of range!");
4666+
assert((Index < ShuffleVectorExprBits.NumExprs) &&
4667+
"Arg access out of range!");
46684668
return cast<Expr>(SubExprs[Index]);
46694669
}
46704670
const Expr *getExpr(unsigned Index) const {
4671-
assert((Index < NumExprs) && "Arg access out of range!");
4671+
assert((Index < ShuffleVectorExprBits.NumExprs) &&
4672+
"Arg access out of range!");
46724673
return cast<Expr>(SubExprs[Index]);
46734674
}
46744675

46754676
void setExprs(const ASTContext &C, ArrayRef<Expr *> Exprs);
46764677

46774678
llvm::APSInt getShuffleMaskIdx(unsigned N) const {
4678-
assert((N < NumExprs - 2) && "Shuffle idx out of range!");
4679+
assert((N < ShuffleVectorExprBits.NumExprs - 2) &&
4680+
"Shuffle idx out of range!");
46794681
assert(isa<ConstantExpr>(getExpr(N + 2)) &&
46804682
"Index expression must be a ConstantExpr");
46814683
return cast<ConstantExpr>(getExpr(N + 2))->getAPValueResult().getInt();
46824684
}
46834685

46844686
// Iterators
46854687
child_range children() {
4686-
return child_range(&SubExprs[0], &SubExprs[0]+NumExprs);
4688+
return child_range(&SubExprs[0],
4689+
&SubExprs[0] + ShuffleVectorExprBits.NumExprs);
46874690
}
46884691
const_child_range children() const {
4689-
return const_child_range(&SubExprs[0], &SubExprs[0] + NumExprs);
4692+
return const_child_range(&SubExprs[0],
4693+
&SubExprs[0] + ShuffleVectorExprBits.NumExprs);
46904694
}
46914695
};
46924696

@@ -4828,13 +4832,13 @@ class ChooseExpr : public Expr {
48284832
enum { COND, LHS, RHS, END_EXPR };
48294833
Stmt* SubExprs[END_EXPR]; // Left/Middle/Right hand sides.
48304834
SourceLocation BuiltinLoc, RParenLoc;
4831-
bool CondIsTrue;
4835+
48324836
public:
48334837
ChooseExpr(SourceLocation BLoc, Expr *cond, Expr *lhs, Expr *rhs, QualType t,
48344838
ExprValueKind VK, ExprObjectKind OK, SourceLocation RP,
48354839
bool condIsTrue)
4836-
: Expr(ChooseExprClass, t, VK, OK), BuiltinLoc(BLoc), RParenLoc(RP),
4837-
CondIsTrue(condIsTrue) {
4840+
: Expr(ChooseExprClass, t, VK, OK), BuiltinLoc(BLoc), RParenLoc(RP) {
4841+
ChooseExprBits.CondIsTrue = condIsTrue;
48384842
SubExprs[COND] = cond;
48394843
SubExprs[LHS] = lhs;
48404844
SubExprs[RHS] = rhs;
@@ -4850,9 +4854,9 @@ class ChooseExpr : public Expr {
48504854
bool isConditionTrue() const {
48514855
assert(!isConditionDependent() &&
48524856
"Dependent condition isn't true or false");
4853-
return CondIsTrue;
4857+
return ChooseExprBits.CondIsTrue;
48544858
}
4855-
void setIsConditionTrue(bool isTrue) { CondIsTrue = isTrue; }
4859+
void setIsConditionTrue(bool isTrue) { ChooseExprBits.CondIsTrue = isTrue; }
48564860

48574861
bool isConditionDependent() const {
48584862
return getCond()->isTypeDependent() || getCond()->isValueDependent();

0 commit comments

Comments
 (0)