Skip to content

Commit 14ec4b6

Browse files
Merge branch 'llvm:main' into AMDLIBM
2 parents 4505686 + d561d59 commit 14ec4b6

File tree

399 files changed

+20033
-3911
lines changed

Some content is hidden

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

399 files changed

+20033
-3911
lines changed

clang-tools-extra/clang-tidy/concurrency/MtUnsafeCheck.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ static const clang::StringRef GlibcFunctions[] = {
153153
"::sigsuspend",
154154
"::sleep",
155155
"::srand48",
156-
"::strerror",
157156
"::strsignal",
158157
"::strtok",
159158
"::tcflow",

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ Changes in existing checks
172172
<clang-tidy/checks/cert/err33-c>` check by fixing false positives when
173173
a function name is just prefixed with a targeted function name.
174174

175+
- Improved :doc:`concurrency-mt-unsafe
176+
<clang-tidy/checks/concurrency/mt-unsafe>` check by fixing a false positive
177+
where ``strerror`` was flagged as MT-unsafe.
178+
175179
- Improved :doc:`misc-const-correctness
176180
<clang-tidy/checks/misc/const-correctness>` check by adding the option
177181
`AllowedTypes`, that excludes specified types from const-correctness

clang-tools-extra/test/clang-tidy/checkers/concurrency/mt-unsafe-glibc.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
extern unsigned int sleep (unsigned int __seconds);
44
extern int *gmtime (const int *__timer);
55
extern char *dirname (char *__path);
6+
extern char *strerror(int errnum);
67

78
void foo() {
89
sleep(2);
@@ -12,4 +13,6 @@ void foo() {
1213
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: function is not thread safe [concurrency-mt-unsafe]
1314

1415
dirname(nullptr);
16+
17+
strerror(0);
1518
}

clang/docs/BoundsSafety.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ In C, arrays on function prototypes are promoted (or "decayed") to a pointer to
664664
its first element (e.g., ``&arr[0]``). In ``-fbounds-safety``, arrays are also
665665
decayed to pointers, but with the addition of an implicit bounds annotation,
666666
which includes variable-length arrays (VLAs). As shown in the following example,
667-
arrays on function prototypes are decalyed to corresponding ``__counted_by``
667+
arrays on function prototypes are decayed to corresponding ``__counted_by``
668668
pointers.
669669

670670
.. code-block:: c

clang/docs/BoundsSafetyAdoptionGuide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Annotate pointers on struct fields and function parameters if they are pointing
3939
to an array of object, with appropriate bounds annotations. Please see
4040
:doc:`BoundsSafety` to learn what kind of bounds annotations are available and
4141
their semantics. Note that local pointer variables typically don't need bounds
42-
annotations because they are implicitely a wide pointer (``__bidi_indexable``)
42+
annotations because they are implicitly a wide pointer (``__bidi_indexable``)
4343
that automatically carries the bounds information.
4444

4545
Address compiler diagnostics

clang/docs/HIPSupport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ In other scenarios, calling virtual functions is not allowed.
259259
Explanation
260260
-----------
261261

262-
An object constructed on the device side contains a pointer to the virtual function table on the device side, which is not accessible in host code, and vice versa. Thus, trying to invoke virtual functions from a context different from where the object was constructed will be disallowed because the appropriate virtual table cannot be accessed. The virtual function tables for offloading devices with different architecures are different, therefore trying to invoke virtual functions from an offloading device with a different architecture than where the object is constructed is also disallowed.
262+
An object constructed on the device side contains a pointer to the virtual function table on the device side, which is not accessible in host code, and vice versa. Thus, trying to invoke virtual functions from a context different from where the object was constructed will be disallowed because the appropriate virtual table cannot be accessed. The virtual function tables for offloading devices with different architectures are different, therefore trying to invoke virtual functions from an offloading device with a different architecture than where the object is constructed is also disallowed.
263263

264264
Example Usage
265265
-------------

clang/docs/ReleaseNotes.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,9 @@ Improvements to Clang's diagnostics
558558
between different Unicode character types (``char8_t``, ``char16_t``, ``char32_t``).
559559
This warning only triggers in C++ as these types are aliases in C. (#GH138526)
560560

561+
- Fixed a crash when checking a ``__thread``-specified variable declaration
562+
with a dependent type in C++. (#GH140509)
563+
561564
Improvements to Clang's time-trace
562565
----------------------------------
563566

@@ -644,7 +647,7 @@ Bug Fixes to Compiler Builtins
644647
- ``__is_trivially_relocatable`` has been deprecated, and uses should be replaced by
645648
``__builtin_is_cpp_trivially_relocatable``.
646649
Note that, it is generally unsafe to ``memcpy`` non-trivially copyable types that
647-
are ``__builtin_is_cpp_trivially_relocatable``. It is recommanded to use
650+
are ``__builtin_is_cpp_trivially_relocatable``. It is recommended to use
648651
``__builtin_trivially_relocate`` instead.
649652

650653
Bug Fixes to Attribute Support
@@ -700,7 +703,7 @@ Bug Fixes to C++ Support
700703
- Fix crash when evaluating the trailing requires clause of generic lambdas which are part of
701704
a pack expansion.
702705
- Fixes matching of nested template template parameters. (#GH130362)
703-
- Correctly diagnoses template template paramters which have a pack parameter
706+
- Correctly diagnoses template template parameters which have a pack parameter
704707
not in the last position.
705708
- Disallow overloading on struct vs class on dependent types, which is IFNDR, as
706709
this makes the problem diagnosable.
@@ -709,7 +712,7 @@ Bug Fixes to C++ Support
709712
- Clang now correctly parses ``if constexpr`` expressions in immediate function context. (#GH123524)
710713
- Fixed an assertion failure affecting code that uses C++23 "deducing this". (#GH130272)
711714
- Clang now properly instantiates destructors for initialized members within non-delegating constructors. (#GH93251)
712-
- Correctly diagnoses if unresolved using declarations shadows template paramters (#GH129411)
715+
- Correctly diagnoses if unresolved using declarations shadows template parameters (#GH129411)
713716
- Fixed C++20 aggregate initialization rules being incorrectly applied in certain contexts. (#GH131320)
714717
- Clang was previously coalescing volatile writes to members of volatile base class subobjects.
715718
The issue has been addressed by propagating qualifiers during derived-to-base conversions in the AST. (#GH127824)
@@ -738,9 +741,10 @@ Bug Fixes to C++ Support
738741
- Fixed the handling of pack indexing types in the constraints of a member function redeclaration. (#GH138255)
739742
- Clang now correctly parses arbitrary order of ``[[]]``, ``__attribute__`` and ``alignas`` attributes for declarations (#GH133107)
740743
- Fixed a crash when forming an invalid function type in a dependent context. (#GH138657) (#GH115725) (#GH68852)
741-
- Fixed a function declaration mismatch that caused inconsistencies between concepts and variable template declarations. (#GH139476)
742744
- Clang no longer segfaults when there is a configuration mismatch between modules and their users (http://crbug.com/400353616).
743745
- Fix an incorrect deduction when calling an explicit object member function template through an overload set address.
746+
- Fixed bug in constant evaluation that would allow using the value of a
747+
reference in its own initializer in C++23 mode (#GH131330).
744748

745749
Bug Fixes to AST Handling
746750
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -815,7 +819,7 @@ Windows Support
815819
which makes ``offsetof`` provided by Microsoft's ``<stddef.h>`` to be defined
816820
correctly. (#GH59689)
817821

818-
- Clang now can process the `i128` and `ui128` integeral suffixes when MSVC
822+
- Clang now can process the `i128` and `ui128` integral suffixes when MSVC
819823
extensions are enabled. This allows for properly processing ``intsafe.h`` in
820824
the Windows SDK.
821825

clang/docs/UsersManual.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3650,7 +3650,7 @@ below. If multiple flags are present, the last one is used.
36503650
By default, Clang does not emit type information for types that are defined
36513651
but not used in a program. To retain the debug info for these unused types,
36523652
the negation **-fno-eliminate-unused-debug-types** can be used.
3653-
This can be particulary useful on Windows, when using NATVIS files that
3653+
This can be particularly useful on Windows, when using NATVIS files that
36543654
can reference const symbols that would otherwise be stripped, even in full
36553655
debug or standalone debug modes.
36563656

@@ -4267,7 +4267,7 @@ nosvm
42674267
^^^^^
42684268

42694269
Clang supports this attribute to comply to OpenCL v2.0 conformance, but it
4270-
does not have any effect on the IR. For more details reffer to the specification
4270+
does not have any effect on the IR. For more details refer to the specification
42714271
`section 6.7.2
42724272
<https://www.khronos.org/registry/cl/specs/opencl-2.0-openclc.pdf#49>`_
42734273

clang/include/clang/AST/DeclFriend.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ class FriendDecl final
9090
: Decl(Decl::Friend, DC, L), Friend(Friend), FriendLoc(FriendL),
9191
EllipsisLoc(EllipsisLoc), UnsupportedFriend(false),
9292
NumTPLists(FriendTypeTPLists.size()) {
93-
for (unsigned i = 0; i < NumTPLists; ++i)
94-
getTrailingObjects<TemplateParameterList *>()[i] = FriendTypeTPLists[i];
93+
llvm::copy(FriendTypeTPLists, getTrailingObjects());
9594
}
9695

9796
FriendDecl(EmptyShell Empty, unsigned NumFriendTypeTPLists)
@@ -132,8 +131,7 @@ class FriendDecl final
132131
}
133132

134133
TemplateParameterList *getFriendTypeTemplateParameterList(unsigned N) const {
135-
assert(N < NumTPLists);
136-
return getTrailingObjects<TemplateParameterList *>()[N];
134+
return getTrailingObjects(NumTPLists)[N];
137135
}
138136

139137
/// If this friend declaration doesn't name a type, return the inner
@@ -153,10 +151,9 @@ class FriendDecl final
153151
/// Retrieves the source range for the friend declaration.
154152
SourceRange getSourceRange() const override LLVM_READONLY {
155153
if (TypeSourceInfo *TInfo = getFriendType()) {
156-
SourceLocation StartL =
157-
(NumTPLists == 0) ? getFriendLoc()
158-
: getTrailingObjects<TemplateParameterList *>()[0]
159-
->getTemplateLoc();
154+
SourceLocation StartL = (NumTPLists == 0)
155+
? getFriendLoc()
156+
: getTrailingObjects()[0]->getTemplateLoc();
160157
SourceLocation EndL = isPackExpansion() ? getEllipsisLoc()
161158
: TInfo->getTypeLoc().getEndLoc();
162159
return SourceRange(StartL, EndL);

clang/include/clang/AST/DeclGroup.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,10 @@ class DeclGroup final : private llvm::TrailingObjects<DeclGroup, Decl *> {
3737

3838
unsigned size() const { return NumDecls; }
3939

40-
Decl*& operator[](unsigned i) {
41-
assert (i < NumDecls && "Out-of-bounds access.");
42-
return getTrailingObjects<Decl *>()[i];
43-
}
40+
Decl *&operator[](unsigned i) { return getTrailingObjects(NumDecls)[i]; }
4441

4542
Decl* const& operator[](unsigned i) const {
46-
assert (i < NumDecls && "Out-of-bounds access.");
47-
return getTrailingObjects<Decl *>()[i];
43+
return getTrailingObjects(NumDecls)[i];
4844
}
4945
};
5046

0 commit comments

Comments
 (0)