Skip to content

Commit 074c14d

Browse files
committed
Merge from 'main' to 'sycl-web' (30 commits)
CONFLICT (modify/delete): clang/test/CodeGenCXX/builtin-std-move.cpp deleted in 98d911e and modified in HEAD. Version HEAD of clang/test/CodeGenCXX/builtin-std-move.cpp left in tree.
2 parents 4c4d2bb + 98d911e commit 074c14d

File tree

158 files changed

+1660
-2125
lines changed

Some content is hidden

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

158 files changed

+1660
-2125
lines changed

clang/docs/CommandGuide/clang.rst

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -252,24 +252,8 @@ Language Selection and Mode Options
252252

253253
.. option:: -fno-builtin
254254

255-
Disable special handling and optimizations of well-known library functions,
256-
like :c:func:`strlen` and :c:func:`malloc`.
257-
258-
.. option:: -fno-builtin-<function>
259-
260-
Disable special handling and optimizations for the specific library function.
261-
For example, ``-fno-builtin-strlen`` removes any special handling for the
262-
:c:func:`strlen` library function.
263-
264-
.. option:: -fno-builtin-std-<function>
265-
266-
Disable special handling and optimizations for the specific C++ standard
267-
library function in namespace ``std``. For example,
268-
``-fno-builtin-std-move_if_noexcept`` removes any special handling for the
269-
:cpp:func:`std::move_if_noexcept` library function.
270-
271-
For C standard library functions that the C++ standard library also provides
272-
in namespace ``std``, use :option:`-fno-builtin-\<function\>` instead.
255+
Disable special handling and optimizations of builtin functions like
256+
:c:func:`strlen` and :c:func:`malloc`.
273257

274258
.. option:: -fmath-errno
275259

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,7 @@ C2x Feature Support
265265
C++ Language Changes in Clang
266266
-----------------------------
267267

268-
- Improved ``-O0`` code generation for calls to ``std::move``, ``std::forward``,
269-
``std::move_if_noexcept``, ``std::addressof``, and ``std::as_const``. These
270-
are now treated as compiler builtins and implemented directly, rather than
271-
instantiating the definition from the standard library.
268+
- ...
272269

273270
C++20 Feature Support
274271
^^^^^^^^^^^^^^^^^^^^^
@@ -293,11 +290,6 @@ C++2b Feature Support
293290
- Implemented `P2128R6: Multidimensional subscript operator <https://wg21.link/P2128R6>`_.
294291
- Implemented `P0849R8: auto(x): decay-copy in the language <https://wg21.link/P0849R8>`_.
295292
- Implemented `P2242R3: Non-literal variables (and labels and gotos) in constexpr functions <https://wg21.link/P2242R3>`_.
296-
- Implemented `P2036R3: Change scope of lambda trailing-return-type <https://wg21.link/P2036R3>`_.
297-
This proposal modifies how variables captured in lambdas can appear in trailing return type
298-
expressions and how their types are deduced therein, in all C++ language versions.
299-
`CWG2569 <https://cplusplus.github.io/CWG/issues/2569.html>`_ is also partially implemented so that
300-
`[x](decltype(x)){}` doesn't become ill-formed with the adoption of P2036R3.
301293

302294
CUDA Language Changes in Clang
303295
------------------------------

clang/include/clang/AST/DeclCXX.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,20 +1799,6 @@ class CXXRecordDecl : public RecordDecl {
17991799
return getLambdaData().MethodTyInfo;
18001800
}
18011801

1802-
void setLambdaTypeInfo(TypeSourceInfo *TS) {
1803-
auto *DD = DefinitionData;
1804-
assert(DD && DD->IsLambda && "setting lambda property of non-lambda class");
1805-
auto &DL = static_cast<LambdaDefinitionData &>(*DD);
1806-
DL.MethodTyInfo = TS;
1807-
}
1808-
1809-
void setLambdaIsGeneric(bool IsGeneric) {
1810-
auto *DD = DefinitionData;
1811-
assert(DD && DD->IsLambda && "setting lambda property of non-lambda class");
1812-
auto &DL = static_cast<LambdaDefinitionData &>(*DD);
1813-
DL.IsGenericLambda = IsGeneric;
1814-
}
1815-
18161802
// Determine whether this type is an Interface Like type for
18171803
// __interface inheritance purposes.
18181804
bool isInterfaceLike() const;

clang/include/clang/AST/Type.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,8 @@ class QualType {
13161316
static bool hasNonTrivialToPrimitiveCopyCUnion(const RecordDecl *RD);
13171317
};
13181318

1319+
raw_ostream &operator<<(raw_ostream &OS, QualType QT);
1320+
13191321
} // namespace clang
13201322

13211323
namespace llvm {

clang/include/clang/Basic/Builtins.def

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@
8181
// builtin even if type doesn't match signature, and don't warn if we
8282
// can't be sure the type is right
8383
// F -> this is a libc/libm function with a '__builtin_' prefix added.
84-
// f -> this is a libc/libm function without a '__builtin_' prefix, or with
85-
// 'z', a C++ standard library function in namespace std::. This builtin
86-
// is disableable by '-fno-builtin-foo' / '-fno-builtin-std-foo'.
84+
// f -> this is a libc/libm function without the '__builtin_' prefix.
8785
// h -> this function requires a specific header or an explicit declaration.
8886
// i -> this is a runtime library implemented function without the
8987
// '__builtin_' prefix. It will be implemented in compiler-rt or libgcc.
@@ -103,7 +101,6 @@
103101
// V:N: -> requires vectors of at least N bits to be legal
104102
// C<N,M_0,...,M_k> -> callback behavior: argument N is called with argument
105103
// M_0, ..., M_k as payload
106-
// z -> this is a function in (possibly-versioned) namespace std
107104
// FIXME: gcc has nonnull
108105

109106
#if defined(BUILTIN) && !defined(LIBBUILTIN)
@@ -922,7 +919,7 @@ LANGBUILTIN(__exception_info, "v*", "n", ALL_MS_LANGUAGES)
922919
LANGBUILTIN(_exception_info, "v*", "n", ALL_MS_LANGUAGES)
923920
LANGBUILTIN(__abnormal_termination, "i", "n", ALL_MS_LANGUAGES)
924921
LANGBUILTIN(_abnormal_termination, "i", "n", ALL_MS_LANGUAGES)
925-
LANGBUILTIN(__GetExceptionInfo, "v*.", "zntu", ALL_MS_LANGUAGES)
922+
LANGBUILTIN(__GetExceptionInfo, "v*.", "ntu", ALL_MS_LANGUAGES)
926923
LANGBUILTIN(_InterlockedAnd8, "ccD*c", "n", ALL_MS_LANGUAGES)
927924
LANGBUILTIN(_InterlockedAnd16, "ssD*s", "n", ALL_MS_LANGUAGES)
928925
LANGBUILTIN(_InterlockedAnd, "NiNiD*Ni", "n", ALL_MS_LANGUAGES)
@@ -1546,15 +1543,6 @@ LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", "Blocks.h", ALL_LANGUAGES)
15461543
LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h", ALL_LANGUAGES)
15471544
// FIXME: Also declare NSConcreteGlobalBlock and NSConcreteStackBlock.
15481545

1549-
// C++ standard library builtins in namespace 'std'.
1550-
LIBBUILTIN(addressof, "v*v&", "zfncTh", "memory", CXX_LANG)
1551-
// Synonym for addressof used internally by libstdc++.
1552-
LANGBUILTIN(__addressof, "v*v&", "zfncT", CXX_LANG)
1553-
LIBBUILTIN(as_const, "v&v&", "zfncTh", "utility", CXX_LANG)
1554-
LIBBUILTIN(forward, "v&v&", "zfncTh", "utility", CXX_LANG)
1555-
LIBBUILTIN(move, "v&v&", "zfncTh", "utility", CXX_LANG)
1556-
LIBBUILTIN(move_if_noexcept, "v&v&", "zfncTh", "utility", CXX_LANG)
1557-
15581546
// Annotation function
15591547
BUILTIN(__builtin_annotation, "v.", "tn")
15601548

clang/include/clang/Basic/Builtins.h

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,6 @@ class Context {
138138
/// Determines whether this builtin is a predefined libc/libm
139139
/// function, such as "malloc", where we know the signature a
140140
/// priori.
141-
/// In C, such functions behave as if they are predeclared,
142-
/// possibly with a warning on first use. In Objective-C and C++,
143-
/// they do not, but they are recognized as builtins once we see
144-
/// a declaration.
145141
bool isPredefinedLibFunction(unsigned ID) const {
146142
return strchr(getRecord(ID).Attributes, 'f') != nullptr;
147143
}
@@ -160,23 +156,6 @@ class Context {
160156
return strchr(getRecord(ID).Attributes, 'i') != nullptr;
161157
}
162158

163-
/// Determines whether this builtin is a C++ standard library function
164-
/// that lives in (possibly-versioned) namespace std, possibly a template
165-
/// specialization, where the signature is determined by the standard library
166-
/// declaration.
167-
bool isInStdNamespace(unsigned ID) const {
168-
return strchr(getRecord(ID).Attributes, 'z') != nullptr;
169-
}
170-
171-
/// Determines whether this builtin can have its address taken with no
172-
/// special action required.
173-
bool isDirectlyAddressable(unsigned ID) const {
174-
// Most standard library functions can have their addresses taken. C++
175-
// standard library functions formally cannot in C++20 onwards, and when
176-
// we allow it, we need to ensure we instantiate a definition.
177-
return isPredefinedLibFunction(ID) && !isInStdNamespace(ID);
178-
}
179-
180159
/// Determines whether this builtin has custom typechecking.
181160
bool hasCustomTypechecking(unsigned ID) const {
182161
return strchr(getRecord(ID).Attributes, 't') != nullptr;
@@ -258,6 +237,10 @@ class Context {
258237
private:
259238
const Info &getRecord(unsigned ID) const;
260239

240+
/// Is this builtin supported according to the given language options?
241+
bool builtinIsSupported(const Builtin::Info &BuiltinInfo,
242+
const LangOptions &LangOpts);
243+
261244
/// Helper function for isPrintfLike and isScanfLike.
262245
bool isLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg,
263246
const char *Fmt) const;

clang/include/clang/Basic/BuiltinsAArch64.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ TARGET_HEADER_BUILTIN(_AddressOfReturnAddress, "v*", "nh", "intrin.h", ALL_MS_LA
249249
TARGET_HEADER_BUILTIN(__mulh, "SLLiSLLiSLLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
250250
TARGET_HEADER_BUILTIN(__umulh, "ULLiULLiULLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
251251

252+
TARGET_HEADER_BUILTIN(__break, "vi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
253+
252254
#undef BUILTIN
253255
#undef LANGBUILTIN
254256
#undef TARGET_HEADER_BUILTIN

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6638,15 +6638,6 @@ def warn_self_move : Warning<
66386638
"explicitly moving variable of type %0 to itself">,
66396639
InGroup<SelfMove>, DefaultIgnore;
66406640

6641-
def err_builtin_move_forward_unsupported : Error<
6642-
"unsupported signature for %q0">;
6643-
def err_use_of_unaddressable_function : Error<
6644-
"taking address of non-addressable standard library function">;
6645-
// FIXME: This should also be in -Wc++23-compat once we have it.
6646-
def warn_cxx20_compat_use_of_unaddressable_function : Warning<
6647-
"taking address of non-addressable standard library function "
6648-
"is incompatible with C++20">, InGroup<CXX20Compat>;
6649-
66506641
def warn_redundant_move_on_return : Warning<
66516642
"redundant move in return statement">,
66526643
InGroup<RedundantMove>, DefaultIgnore;
@@ -7776,8 +7767,6 @@ let CategoryName = "Lambda Issue" in {
77767767
def err_lambda_impcap : Error<
77777768
"variable %0 cannot be implicitly captured in a lambda with no "
77787769
"capture-default specified">;
7779-
def err_lambda_used_before_capture: Error<
7780-
"captured variable %0 cannot appear here">;
77817770
def note_lambda_variable_capture_fixit : Note<
77827771
"capture %0 by %select{value|reference}1">;
77837772
def note_lambda_default_capture_fixit : Note<

clang/include/clang/Lex/HeaderSearch.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,8 @@ class HeaderSearch {
738738
/// frameworks.
739739
///
740740
/// \returns The module, if found; otherwise, null.
741-
Module *loadFrameworkModule(StringRef Name, DirectoryEntryRef Dir,
741+
Module *loadFrameworkModule(StringRef Name,
742+
const DirectoryEntry *Dir,
742743
bool IsSystem);
743744

744745
/// Load all of the module maps within the immediate subdirectories
@@ -887,7 +888,7 @@ class HeaderSearch {
887888

888889
LoadModuleMapResult loadModuleMapFileImpl(const FileEntry *File,
889890
bool IsSystem,
890-
DirectoryEntryRef Dir,
891+
const DirectoryEntry *Dir,
891892
FileID ID = FileID(),
892893
unsigned *Offset = nullptr);
893894

@@ -911,8 +912,8 @@ class HeaderSearch {
911912
///
912913
/// \returns The result of attempting to load the module map file from the
913914
/// named directory.
914-
LoadModuleMapResult loadModuleMapFile(DirectoryEntryRef Dir, bool IsSystem,
915-
bool IsFramework);
915+
LoadModuleMapResult loadModuleMapFile(const DirectoryEntry *Dir,
916+
bool IsSystem, bool IsFramework);
916917
};
917918

918919
/// Apply the header search options to get given HeaderSearch object.

clang/include/clang/Lex/ModuleMap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ class ModuleMap {
479479
void diagnoseHeaderInclusion(Module *RequestingModule,
480480
bool RequestingModuleIsModuleInterface,
481481
SourceLocation FilenameLoc, StringRef Filename,
482-
const FileEntry *File);
482+
FileEntryRef File);
483483

484484
/// Determine whether the given header is part of a module
485485
/// marked 'unavailable'.

0 commit comments

Comments
 (0)