Skip to content

Commit 4c59949

Browse files
authored
Merge branch 'main' into Add-inreg-bit-convert-tests
2 parents 1be6116 + 934cfa7 commit 4c59949

File tree

295 files changed

+8272
-3764
lines changed

Some content is hidden

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

295 files changed

+8272
-3764
lines changed

clang-tools-extra/clang-doc/Representation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct CommentInfo {
6060
// the vector.
6161
bool operator<(const CommentInfo &Other) const;
6262

63+
// TODO: The Kind field should be an enum, so we can switch on it easily.
6364
SmallString<16>
6465
Kind; // Kind of comment (FullComment, ParagraphComment, TextComment,
6566
// InlineCommandComment, HTMLStartTagComment, HTMLEndTagComment,
@@ -534,6 +535,7 @@ struct ClangDocContext {
534535
std::vector<std::string> UserStylesheets;
535536
// JavaScript files that will be imported in all HTML files.
536537
std::vector<std::string> JsScripts;
538+
// Base directory for remote repositories.
537539
StringRef Base;
538540
Index Idx;
539541
};

clang-tools-extra/clang-tidy/cppcoreguidelines/MissingStdForwardCheck.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,15 @@ void MissingStdForwardCheck::registerMatchers(MatchFinder *Finder) {
9292
declRefExpr(to(equalsBoundNode("param"))))));
9393
auto RefToParm = capturesVar(
9494
varDecl(anyOf(hasSameNameAsBoundNode("param"), RefToParmImplicit)));
95-
auto HasRefToParm = hasAnyCapture(RefToParm);
9695

9796
auto CaptureInRef =
9897
allOf(hasCaptureDefaultKind(LambdaCaptureDefault::LCD_ByRef),
9998
unless(hasAnyCapture(
10099
capturesVar(varDecl(hasSameNameAsBoundNode("param"))))));
101-
auto CaptureInCopy = allOf(
102-
hasCaptureDefaultKind(LambdaCaptureDefault::LCD_ByCopy), HasRefToParm);
103100
auto CaptureByRefExplicit = hasAnyCapture(
104101
allOf(hasCaptureKind(LambdaCaptureKind::LCK_ByRef), RefToParm));
105102

106-
auto CapturedInBody =
107-
lambdaExpr(anyOf(CaptureInRef, CaptureInCopy, CaptureByRefExplicit));
103+
auto CapturedInBody = lambdaExpr(anyOf(CaptureInRef, CaptureByRefExplicit));
108104
auto CapturedInCaptureList = hasAnyCapture(capturesVar(
109105
varDecl(hasInitializer(ignoringParenImpCasts(equalsBoundNode("call"))))));
110106

clang/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,17 @@ check_include_file(sys/resource.h CLANG_HAVE_RLIMITS)
183183
# This check requires _GNU_SOURCE on linux
184184
check_include_file(dlfcn.h CLANG_HAVE_DLFCN_H)
185185
if( CLANG_HAVE_DLFCN_H )
186+
include(CMakePushCheckState)
186187
include(CheckLibraryExists)
187188
include(CheckSymbolExists)
188189
check_library_exists(dl dlopen "" HAVE_LIBDL)
190+
cmake_push_check_state()
189191
if( HAVE_LIBDL )
190192
list(APPEND CMAKE_REQUIRED_LIBRARIES dl)
191193
endif()
192194
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
193195
check_symbol_exists(dladdr dlfcn.h CLANG_HAVE_DLADDR)
194-
list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
195-
if( HAVE_LIBDL )
196-
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES dl)
197-
endif()
196+
cmake_pop_check_state()
198197
endif()
199198

200199
set(CLANG_RESOURCE_DIR "" CACHE STRING

clang/Maintainers.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ Clang LLVM IR generation
5151
| Anton Korobeynikov
5252
| anton\@korobeynikov.info (email), asl (Phabricator), asl (GitHub)
5353
54+
Clang MLIR generation
55+
~~~~~~~~~~~~~~~~~~~~~
56+
| Andy Kaylor
57+
| akaylor\@nvidia.com (email), AndyKaylor (Discord), AndyKaylor (GitHub)
58+
59+
| Bruno Cardoso Lopes
60+
| bruno.cardoso\@gmail.com (email), sonicsprawl (Discord), bcardosolopes (GitHub)
61+
5462

5563
Analysis & CFG
5664
~~~~~~~~~~~~~~
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This file sets up a CMakeCache for the second stage of a Fuchsia toolchain build.
2+
3+
include(${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake)
4+
5+
if(NOT APPLE)
6+
set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
7+
endif()
8+
9+
set(CLANG_BOOTSTRAP_TARGETS
10+
check-all
11+
check-clang
12+
check-lld
13+
check-llvm
14+
check-polly
15+
clang
16+
clang-test-depends
17+
toolchain-distribution
18+
install-toolchain-distribution
19+
install-toolchain-distribution-stripped
20+
install-toolchain-distribution-toolchain
21+
lld-test-depends
22+
llvm-config
23+
llvm-test-depends
24+
test-depends
25+
test-suite CACHE STRING "")
26+
27+
get_cmake_property(variableNames VARIABLES)
28+
foreach(variableName ${variableNames})
29+
if(variableName MATCHES "^STAGE2_")
30+
string(REPLACE "STAGE2_" "" new_name ${variableName})
31+
list(APPEND EXTRA_ARGS "-D${new_name}=${${variableName}}")
32+
endif()
33+
endforeach()
34+
35+
set(CLANG_PGO_TRAINING_DEPS
36+
builtins
37+
runtimes
38+
CACHE STRING "")
39+
40+
# Setup the bootstrap build.
41+
set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
42+
set(CLANG_BOOTSTRAP_CMAKE_ARGS
43+
${EXTRA_ARGS}
44+
-C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake
45+
CACHE STRING "")

clang/cmake/caches/Fuchsia.cmake

Lines changed: 78 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ else()
126126
set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
127127
set(LIBCXX_HARDENING_MODE "none" CACHE STRING "")
128128
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
129+
set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
130+
set(COMPILER_RT_BUILD_PROFILE ON CACHE BOOL "")
131+
set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
132+
set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
133+
set(COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
134+
set(COMPILER_RT_DEFAULT_TARGET_ONLY ON CACHE BOOL "")
135+
set(SANITIZER_CXX_ABI "libc++" CACHE STRING "")
136+
set(SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
137+
set(SANITIZER_TEST_CXX "libc++" CACHE STRING "")
138+
set(SANITIZER_TEST_CXX_INTREE ON CACHE BOOL "")
129139
set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
130140
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13;-DCMAKE_OSX_ARCHITECTURES=arm64|x86_64" CACHE STRING "")
131141
endif()
@@ -165,33 +175,59 @@ endif()
165175
set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
166176
set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
167177

168-
set(_FUCHSIA_BOOTSTRAP_TARGETS
169-
check-all
170-
check-clang
171-
check-lld
172-
check-llvm
173-
check-polly
174-
llvm-config
175-
clang-test-depends
176-
lld-test-depends
177-
llvm-test-depends
178-
test-suite
179-
test-depends
180-
toolchain-distribution
181-
install-toolchain-distribution
182-
install-toolchain-distribution-stripped
183-
install-toolchain-distribution-toolchain
184-
clang)
185-
186-
if(FUCHSIA_ENABLE_LLDB)
187-
list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
188-
list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
189-
check-lldb
190-
lldb-test-depends
191-
debugger-distribution
192-
install-debugger-distribution
193-
install-debugger-distribution-stripped
194-
install-debugger-distribution-toolchain)
178+
if(FUCHSIA_ENABLE_PGO)
179+
set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "")
180+
181+
set(_FUCHSIA_BOOTSTRAP_TARGETS
182+
generate-profdata
183+
stage2
184+
stage2-toolchain-distribution
185+
stage2-install-toolchain-distribution
186+
stage2-install-toolchain-distribution-stripped
187+
stage2-install-toolchain-distribution-toolchain
188+
stage2-check-all
189+
stage2-check-clang
190+
stage2-check-lld
191+
stage2-check-llvm
192+
stage2-check-polly
193+
stage2-test-suite)
194+
if(FUCHSIA_ENABLE_LLDB)
195+
list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
196+
list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
197+
stage2-check-lldb
198+
stage2-debugger-distribution
199+
stage2-install-debugger-distribution
200+
stage2-install-debugger-distribution-stripped
201+
stage2-install-debugger-distribution-toolchain)
202+
endif()
203+
else()
204+
set(_FUCHSIA_BOOTSTRAP_TARGETS
205+
check-all
206+
check-clang
207+
check-lld
208+
check-llvm
209+
check-polly
210+
llvm-config
211+
clang
212+
clang-test-depends
213+
lld-test-depends
214+
llvm-test-depends
215+
test-suite
216+
test-depends
217+
toolchain-distribution
218+
install-toolchain-distribution
219+
install-toolchain-distribution-stripped
220+
install-toolchain-distribution-toolchain)
221+
if(FUCHSIA_ENABLE_LLDB)
222+
list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
223+
list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
224+
check-lldb
225+
lldb-test-depends
226+
debugger-distribution
227+
install-debugger-distribution
228+
install-debugger-distribution-stripped
229+
install-debugger-distribution-toolchain)
230+
endif()
195231
endif()
196232

197233
set(LLVM_ENABLE_PROJECTS ${_FUCHSIA_ENABLE_PROJECTS} CACHE STRING "")
@@ -200,6 +236,7 @@ set(CLANG_BOOTSTRAP_TARGETS ${_FUCHSIA_BOOTSTRAP_TARGETS} CACHE STRING "")
200236
get_cmake_property(variableNames VARIABLES)
201237
foreach(variableName ${variableNames})
202238
if(variableName MATCHES "^STAGE2_")
239+
list(APPEND EXTRA_ARGS "-D${variableName}=${${variableName}}")
203240
string(REPLACE "STAGE2_" "" new_name ${variableName})
204241
string(REPLACE ";" "|" value "${${variableName}}")
205242
list(APPEND EXTRA_ARGS "-D${new_name}=${value}")
@@ -209,13 +246,23 @@ endforeach()
209246
# TODO: This is a temporary workaround until we figure out the right solution.
210247
set(BOOTSTRAP_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
211248

249+
set(LLVM_BUILTIN_TARGETS "default" CACHE STRING "")
250+
set(LLVM_RUNTIME_TARGETS "default" CACHE STRING "")
251+
212252
# Setup the bootstrap build.
213253
set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
214254
set(CLANG_BOOTSTRAP_EXTRA_DEPS
215255
builtins
216256
runtimes
217257
CACHE STRING "")
218-
set(CLANG_BOOTSTRAP_CMAKE_ARGS
219-
${EXTRA_ARGS}
220-
-C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake
221-
CACHE STRING "")
258+
if(FUCHSIA_ENABLE_PGO)
259+
set(CLANG_BOOTSTRAP_CMAKE_ARGS
260+
${EXTRA_ARGS}
261+
-C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2-instrumented.cmake
262+
CACHE STRING "")
263+
else()
264+
set(CLANG_BOOTSTRAP_CMAKE_ARGS
265+
${EXTRA_ARGS}
266+
-C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake
267+
CACHE STRING "")
268+
endif()

clang/docs/HIPSupport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ Predefined Macros
518518
* - ``__HIPSTDPAR__``
519519
- Defined when Clang is compiling code in algorithm offload mode, enabled
520520
with the ``--hipstdpar`` compiler option.
521-
* - ``__HIPSTDPAR_INTERPOSE_ALLOC__``
521+
* - ``__HIPSTDPAR_INTERPOSE_ALLOC__`` / ``__HIPSTDPAR_INTERPOSE_ALLOC_V1__``
522522
- Defined only when compiling in algorithm offload mode, when the user
523523
enables interposition mode with the ``--hipstdpar-interpose-alloc``
524524
compiler option, indicating that all dynamic memory allocation /

clang/docs/LanguageExtensions.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,12 +1859,18 @@ The following type trait primitives are supported by Clang. Those traits marked
18591859
* ``__is_trivially_constructible`` (C++, GNU, Microsoft)
18601860
* ``__is_trivially_copyable`` (C++, GNU, Microsoft)
18611861
* ``__is_trivially_destructible`` (C++, MSVC 2013)
1862-
* ``__is_trivially_relocatable`` (Clang): Returns true if moving an object
1862+
* ``__is_trivially_relocatable`` (Clang) (Deprecated,
1863+
use ``__builtin_is_cpp_trivially_relocatable`` instead).
1864+
Returns true if moving an object
18631865
of the given type, and then destroying the source object, is known to be
18641866
functionally equivalent to copying the underlying bytes and then dropping the
18651867
source object on the floor. This is true of trivial types,
18661868
C++26 relocatable types, and types which
18671869
were made trivially relocatable via the ``clang::trivial_abi`` attribute.
1870+
This trait is deprecated and should be replaced by
1871+
``__builtin_is_cpp_trivially_relocatable``. Note however that it is generally
1872+
unsafe to relocate a C++-relocatable type with ``memcpy`` or ``memmove``;
1873+
use ``__builtin_trivially_relocate``.
18681874
* ``__builtin_is_cpp_trivially_relocatable`` (C++): Returns true if an object
18691875
is trivially relocatable, as defined by the C++26 standard [meta.unary.prop].
18701876
Note that when relocating the caller code should ensure that if the object is polymorphic,

clang/docs/ReleaseNotes.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,9 @@ Improvements to Clang's diagnostics
434434
- The ``-Wsign-compare`` warning now treats expressions with bitwise not(~) and minus(-) as signed integers
435435
except for the case where the operand is an unsigned integer
436436
and throws warning if they are compared with unsigned integers (##18878).
437-
- The ``-Wunnecessary-virtual-specifier`` warning has been added to warn about
438-
methods which are marked as virtual inside a ``final`` class, and hence can
439-
never be overridden.
437+
- The ``-Wunnecessary-virtual-specifier`` warning (included in ``-Wextra``) has
438+
been added to warn about methods which are marked as virtual inside a
439+
``final`` class, and hence can never be overridden.
440440

441441
- Improve the diagnostics for chained comparisons to report actual expressions and operators (#GH129069).
442442

@@ -505,6 +505,9 @@ Improvements to Clang's diagnostics
505505
- ``-Wreserved-identifier`` now fires on reserved parameter names in a function
506506
declaration which is not a definition.
507507

508+
- Several compatibility diagnostics that were incorrectly being grouped under
509+
``-Wpre-c++20-compat`` are now part of ``-Wc++20-compat``. (#GH138775)
510+
508511
Improvements to Clang's time-trace
509512
----------------------------------
510513

@@ -574,6 +577,15 @@ Bug Fixes to Compiler Builtins
574577
- ``__has_unique_object_representations(Incomplete[])`` is no longer accepted, per
575578
`LWG4113 <https://cplusplus.github.io/LWG/issue4113>`_.
576579

580+
- ``__builtin_is_cpp_trivially_relocatable``, ``__builtin_is_replaceable`` and
581+
``__builtin_trivially_relocate`` have been added to support standard C++26 relocation.
582+
583+
- ``__is_trivially_relocatable`` has been deprecated, and uses should be replaced by
584+
``__builtin_is_cpp_trivially_relocatable``.
585+
Note that, it is generally unsafe to ``memcpy`` non-trivially copyable types that
586+
are ``__builtin_is_cpp_trivially_relocatable``. It is recommended to use
587+
``__builtin_trivially_relocate`` instead.
588+
577589
Bug Fixes to Attribute Support
578590
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
579591
- Fixed crash when a parameter to the ``clang::annotate`` attribute evaluates to ``void``. See #GH119125
@@ -660,6 +672,8 @@ Bug Fixes to C++ Support
660672
- Fixed a crash when forming an invalid function type in a dependent context. (#GH138657) (#GH115725) (#GH68852)
661673
- No longer crashes when instantiating invalid variable template specialization
662674
whose type depends on itself. (#GH51347), (#GH55872)
675+
- Improved parser recovery of invalid requirement expressions. In turn, this
676+
fixes crashes from follow-on processing of the invalid requirement. (#GH138820)
663677

664678
Bug Fixes to AST Handling
665679
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/APINotes/Types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ class TagInfo : public CommonTypeInfo {
737737
std::optional<std::string> SwiftImportAs;
738738
std::optional<std::string> SwiftRetainOp;
739739
std::optional<std::string> SwiftReleaseOp;
740+
std::optional<std::string> SwiftDefaultOwnership;
740741

741742
/// The Swift protocol that this type should be automatically conformed to.
742743
std::optional<std::string> SwiftConformance;
@@ -786,6 +787,8 @@ class TagInfo : public CommonTypeInfo {
786787
SwiftRetainOp = RHS.SwiftRetainOp;
787788
if (!SwiftReleaseOp)
788789
SwiftReleaseOp = RHS.SwiftReleaseOp;
790+
if (!SwiftDefaultOwnership)
791+
SwiftDefaultOwnership = RHS.SwiftDefaultOwnership;
789792

790793
if (!SwiftConformance)
791794
SwiftConformance = RHS.SwiftConformance;
@@ -815,6 +818,7 @@ inline bool operator==(const TagInfo &LHS, const TagInfo &RHS) {
815818
LHS.SwiftImportAs == RHS.SwiftImportAs &&
816819
LHS.SwiftRetainOp == RHS.SwiftRetainOp &&
817820
LHS.SwiftReleaseOp == RHS.SwiftReleaseOp &&
821+
LHS.SwiftDefaultOwnership == RHS.SwiftDefaultOwnership &&
818822
LHS.SwiftConformance == RHS.SwiftConformance &&
819823
LHS.isFlagEnum() == RHS.isFlagEnum() &&
820824
LHS.isSwiftCopyable() == RHS.isSwiftCopyable() &&

0 commit comments

Comments
 (0)