Skip to content

Commit 4565039

Browse files
committed
Merge from 'main' to 'sycl-web' (107 commits)
1> Add code in CodeGenAction.cpp Basic change add new field "const FileManager &FileMgr" Add new function ReloadModules Code change in function LinkInModules. 2> revert "[DebugInfo][RemoveDIs] Turn on non-instrinsic debug-info by default. CONFLICT (modify/delete): clang/lib/CodeGen/BackendConsumer.h deleted in HEAD and modified in 6d4ffbd. Version 6d4ffbd of clang/lib/CodeGen/BackendConsumer.h left in tree. CONFLICT (content): Merge conflict in clang/lib/CodeGen/CodeGenAction.cpp CONFLICT (modify/delete): clang/lib/CodeGen/LinkInModulesPass.cpp deleted in HEAD and modified in 6d4ffbd. Version 6d4ffbd of clang/lib/CodeGen/LinkInModulesPass.cpp left in tree.
2 parents 0728f6d + 6d4ffbd commit 4565039

File tree

440 files changed

+26356
-23006
lines changed

Some content is hidden

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

440 files changed

+26356
-23006
lines changed

.github/workflows/approved-prs.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

clang/docs/LanguageExtensions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,8 +2791,8 @@ frequency is fixed, making it suitable for measuring elapsed time.
27912791
27922792
The ``__builtin_readsteadycounter()`` builtin returns the frequency counter value.
27932793
When not supported by the target, the return value is always zero. This builtin
2794-
takes no arguments and produces an unsigned long long result. The builtin does
2795-
not guarantee any particular frequency, only that it is stable. Knowledge of the
2794+
takes no arguments and produces an unsigned long long result. The builtin does
2795+
not guarantee any particular frequency, only that it is stable. Knowledge of the
27962796
counter's true frequency will need to be provided by the user.
27972797
27982798
Query for this feature with ``__has_builtin(__builtin_readsteadycounter)``.

clang/docs/ReleaseNotes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ Clang Frontend Potentially Breaking Changes
5656
``ArrayRef<TemplateArgument>`` reduces AST memory usage by 0.4% when compiling clang, and is
5757
expected to show similar improvements on other workloads.
5858

59+
- The ``-Wgnu-binary-literal`` diagnostic group no longer controls any
60+
diagnostics. Binary literals are no longer a GNU extension, they're now a C23
61+
extension which is controlled via ``-pedantic`` or ``-Wc23-extensions``. Use
62+
of ``-Wno-gnu-binary-literal`` will no longer silence this pedantic warning,
63+
which may break existing uses with ``-Werror``.
64+
5965
Target OS macros extension
6066
^^^^^^^^^^^^^^^^^^^^^^^^^^
6167
A new Clang extension (see :ref:`here <target_os_detail>`) is enabled for
@@ -113,6 +119,8 @@ C Language Changes
113119

114120
C23 Feature Support
115121
^^^^^^^^^^^^^^^^^^^
122+
- No longer diagnose use of binary literals as an extension in C23 mode. Fixes
123+
`#72017 <https://github.com/llvm/llvm-project/issues/72017>`_.
116124

117125
Non-comprehensive list of changes in this release
118126
-------------------------------------------------

clang/include/clang/Basic/Attr.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3956,6 +3956,13 @@ def Suppress : DeclOrStmtAttr {
39563956
let Spellings = [CXX11<"gsl", "suppress">, Clang<"suppress">];
39573957
let Args = [VariadicStringArgument<"DiagnosticIdentifiers">];
39583958
let Accessors = [Accessor<"isGSL", [CXX11<"gsl", "suppress">]>];
3959+
// There's no fundamental reason why we can't simply accept all Decls
3960+
// but let's make a short list so that to avoid supporting something weird
3961+
// by accident. We can always expand the list later.
3962+
let Subjects = SubjectList<[
3963+
Stmt, Var, Field, ObjCProperty, Function, ObjCMethod, Record, ObjCInterface,
3964+
ObjCImplementation, Namespace, Empty
3965+
], ErrorDiag, "variables, functions, structs, interfaces, and namespaces">;
39593966
let Documentation = [SuppressDocs];
39603967
}
39613968

clang/include/clang/Basic/AttrDocs.td

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7025,6 +7025,29 @@ Putting the attribute on a compound statement suppresses all warnings in scope:
70257025
}
70267026
}
70277027

7028+
The attribute can also be placed on entire declarations of functions, classes,
7029+
variables, member variables, and so on, to suppress warnings related
7030+
to the declarations themselves. When used this way, the attribute additionally
7031+
suppresses all warnings in the lexical scope of the declaration:
7032+
7033+
.. code-block:: c++
7034+
7035+
class [[clang::suppress]] C {
7036+
int foo() {
7037+
int *x = nullptr;
7038+
...
7039+
return *x; // warnings suppressed in the entire class scope
7040+
}
7041+
7042+
int bar();
7043+
};
7044+
7045+
int C::bar() {
7046+
int *x = nullptr;
7047+
...
7048+
return *x; // warning NOT suppressed! - not lexically nested in 'class C{}'
7049+
}
7050+
70287051
Some static analysis warnings are accompanied by one or more notes, and the
70297052
line of code against which the warning is emitted isn't necessarily the best
70307053
for suppression purposes. In such cases the tools are allowed to implement

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,4 +875,7 @@ def warn_android_unversioned_fallback : Warning<
875875

876876
def err_drv_triple_version_invalid : Error<
877877
"version '%0' in target triple '%1' is invalid">;
878+
879+
def err_drv_installapi_unsupported : Error<
880+
"InstallAPI is not supported for '%0'">;
878881
}

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ def DeprecatedModuleDotMap : DiagGroup<"deprecated-module-dot-map">;
4444
def FrameworkHdrAtImport : DiagGroup<"atimport-in-framework-header">;
4545
def CXX14BinaryLiteral : DiagGroup<"c++14-binary-literal">;
4646
def CXXPre14CompatBinaryLiteral : DiagGroup<"c++98-c++11-compat-binary-literal">;
47-
def GNUBinaryLiteral : DiagGroup<"gnu-binary-literal">;
4847
def BinaryLiteral : DiagGroup<"binary-literal", [CXX14BinaryLiteral,
49-
CXXPre14CompatBinaryLiteral,
50-
GNUBinaryLiteral]>;
48+
CXXPre14CompatBinaryLiteral]>;
5149
def GNUCompoundLiteralInitializer : DiagGroup<"gnu-compound-literal-initializer">;
5250
def SingleBitBitFieldConstantConversion :
5351
DiagGroup<"single-bit-bitfield-constant-conversion">;
@@ -1187,10 +1185,13 @@ def C23 : DiagGroup<"c23-extensions">;
11871185

11881186
def : DiagGroup<"c2x-extensions", [C23]>;
11891187

1188+
// Previously supported warning group which is no longer pertinent as binary
1189+
// literals are a C++14 and C23 extension now instead of a GNU extension.
1190+
def GNUBinaryLiteral : DiagGroup<"gnu-binary-literal">;
1191+
11901192
// A warning group for warnings about GCC extensions.
11911193
def GNU : DiagGroup<"gnu", [GNUAlignofExpression, GNUAnonymousStruct,
1192-
GNUAutoType,
1193-
GNUBinaryLiteral, GNUCaseRange,
1194+
GNUAutoType, GNUBinaryLiteral, GNUCaseRange,
11941195
GNUComplexInteger, GNUCompoundLiteralInitializer,
11951196
GNUConditionalOmittedOperand, GNUDesignator,
11961197
GNUEmptyStruct,

clang/include/clang/Basic/DiagnosticLexKinds.td

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,10 @@ def warn_cxx17_hex_literal : Warning<
246246
"C++ standards before C++17">,
247247
InGroup<CXXPre17CompatPedantic>, DefaultIgnore;
248248
def ext_binary_literal : Extension<
249-
"binary integer literals are a GNU extension">, InGroup<GNUBinaryLiteral>;
249+
"binary integer literals are a C23 extension">, InGroup<C23>;
250+
def warn_c23_compat_binary_literal : Warning<
251+
"binary integer literals are incompatible with C standards before C23">,
252+
InGroup<CPre23Compat>, DefaultIgnore;
250253
def ext_binary_literal_cxx14 : Extension<
251254
"binary integer literals are a C++14 extension">, InGroup<CXX14BinaryLiteral>;
252255
def warn_cxx11_compat_binary_literal : Warning<

clang/include/clang/Basic/FileManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,15 @@ class FileManager : public RefCountedBase<FileManager> {
283283
bool RequiresNullTerminator = true);
284284
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
285285
getBufferForFile(StringRef Filename, bool isVolatile = false,
286-
bool RequiresNullTerminator = true) {
286+
bool RequiresNullTerminator = true) const {
287287
return getBufferForFileImpl(Filename, /*FileSize=*/-1, isVolatile,
288288
RequiresNullTerminator);
289289
}
290290

291291
private:
292292
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
293293
getBufferForFileImpl(StringRef Filename, int64_t FileSize, bool isVolatile,
294-
bool RequiresNullTerminator);
294+
bool RequiresNullTerminator) const;
295295

296296
public:
297297
/// Get the 'stat' information for the given \p Path.

clang/include/clang/Basic/IdentifierTable.h

Lines changed: 48 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,28 @@ using IdentifierLocPair = std::pair<IdentifierInfo *, SourceLocation>;
8484
/// of a pointer to one of these classes.
8585
enum { IdentifierInfoAlignment = 8 };
8686

87-
static constexpr int ObjCOrBuiltinIDBits = 16;
87+
static constexpr int InterestingIdentifierBits = 16;
8888

89-
/// The "layout" of ObjCOrBuiltinID is:
89+
/// The "layout" of InterestingIdentifier is:
9090
/// - ObjCKeywordKind enumerators
91-
/// - InterestingIdentifierKind enumerators
91+
/// - NotableIdentifierKind enumerators
9292
/// - Builtin::ID enumerators
93-
/// - NonSpecialIdentifier
94-
enum class ObjCKeywordOrInterestingOrBuiltin {
93+
/// - NotInterestingIdentifier
94+
enum class InterestingIdentifier {
9595
#define OBJC_AT_KEYWORD(X) objc_##X,
9696
#include "clang/Basic/TokenKinds.def"
9797
NUM_OBJC_KEYWORDS,
9898

99-
#define INTERESTING_IDENTIFIER(X) X,
99+
#define NOTABLE_IDENTIFIER(X) X,
100100
#include "clang/Basic/TokenKinds.def"
101-
NUM_OBJC_KEYWORDS_AND_INTERESTING_IDENTIFIERS,
101+
NUM_OBJC_KEYWORDS_AND_NOTABLE_IDENTIFIERS,
102102

103103
NotBuiltin,
104104
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
105105
#include "clang/Basic/Builtins.inc"
106106
FirstTSBuiltin,
107107

108-
NonSpecialIdentifier = 65534
108+
NotInterestingIdentifier = 65534
109109
};
110110

111111
/// One of these records is kept for each identifier that
@@ -121,8 +121,8 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
121121
LLVM_PREFERRED_TYPE(tok::TokenKind)
122122
unsigned TokenID : 9;
123123

124-
LLVM_PREFERRED_TYPE(ObjCKeywordOrInterestingOrBuiltin)
125-
unsigned ObjCOrBuiltinID : ObjCOrBuiltinIDBits;
124+
LLVM_PREFERRED_TYPE(InterestingIdentifier)
125+
unsigned InterestingIdentifierID : InterestingIdentifierBits;
126126

127127
// True if there is a #define for this.
128128
LLVM_PREFERRED_TYPE(bool)
@@ -205,8 +205,8 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
205205

206206
IdentifierInfo()
207207
: TokenID(tok::identifier),
208-
ObjCOrBuiltinID(llvm::to_underlying(
209-
ObjCKeywordOrInterestingOrBuiltin::NonSpecialIdentifier)),
208+
InterestingIdentifierID(llvm::to_underlying(
209+
InterestingIdentifier::NotInterestingIdentifier)),
210210
HasMacro(false), HadMacro(false), IsExtension(false),
211211
IsFutureCompatKeyword(false), IsPoisoned(false),
212212
IsCPPOperatorKeyword(false), NeedsHandleIdentifier(false),
@@ -341,71 +341,63 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
341341
///
342342
/// For example, 'class' will return tok::objc_class if ObjC is enabled.
343343
tok::ObjCKeywordKind getObjCKeywordID() const {
344-
assert(0 == llvm::to_underlying(
345-
ObjCKeywordOrInterestingOrBuiltin::objc_not_keyword));
346-
auto Value =
347-
static_cast<ObjCKeywordOrInterestingOrBuiltin>(ObjCOrBuiltinID);
348-
if (Value < ObjCKeywordOrInterestingOrBuiltin::NUM_OBJC_KEYWORDS)
349-
return static_cast<tok::ObjCKeywordKind>(ObjCOrBuiltinID);
344+
assert(0 == llvm::to_underlying(InterestingIdentifier::objc_not_keyword));
345+
auto Value = static_cast<InterestingIdentifier>(InterestingIdentifierID);
346+
if (Value < InterestingIdentifier::NUM_OBJC_KEYWORDS)
347+
return static_cast<tok::ObjCKeywordKind>(InterestingIdentifierID);
350348
return tok::objc_not_keyword;
351349
}
352350
void setObjCKeywordID(tok::ObjCKeywordKind ID) {
353-
assert(0 == llvm::to_underlying(
354-
ObjCKeywordOrInterestingOrBuiltin::objc_not_keyword));
355-
ObjCOrBuiltinID = ID;
351+
assert(0 == llvm::to_underlying(InterestingIdentifier::objc_not_keyword));
352+
InterestingIdentifierID = ID;
356353
assert(getObjCKeywordID() == ID && "ID too large for field!");
357354
}
358355

359356
/// Return a value indicating whether this is a builtin function.
360357
unsigned getBuiltinID() const {
361-
auto Value =
362-
static_cast<ObjCKeywordOrInterestingOrBuiltin>(ObjCOrBuiltinID);
363-
if (Value > ObjCKeywordOrInterestingOrBuiltin::
364-
NUM_OBJC_KEYWORDS_AND_INTERESTING_IDENTIFIERS &&
365-
Value != ObjCKeywordOrInterestingOrBuiltin::NonSpecialIdentifier) {
358+
auto Value = static_cast<InterestingIdentifier>(InterestingIdentifierID);
359+
if (Value >
360+
InterestingIdentifier::NUM_OBJC_KEYWORDS_AND_NOTABLE_IDENTIFIERS &&
361+
Value != InterestingIdentifier::NotInterestingIdentifier) {
366362
auto FirstBuiltin =
367-
llvm::to_underlying(ObjCKeywordOrInterestingOrBuiltin::NotBuiltin);
368-
return static_cast<Builtin::ID>(ObjCOrBuiltinID - FirstBuiltin);
363+
llvm::to_underlying(InterestingIdentifier::NotBuiltin);
364+
return static_cast<Builtin::ID>(InterestingIdentifierID - FirstBuiltin);
369365
}
370366
return Builtin::ID::NotBuiltin;
371367
}
372368
void setBuiltinID(unsigned ID) {
373369
assert(ID != Builtin::ID::NotBuiltin);
374-
auto FirstBuiltin =
375-
llvm::to_underlying(ObjCKeywordOrInterestingOrBuiltin::NotBuiltin);
376-
ObjCOrBuiltinID = ID + FirstBuiltin;
370+
auto FirstBuiltin = llvm::to_underlying(InterestingIdentifier::NotBuiltin);
371+
InterestingIdentifierID = ID + FirstBuiltin;
377372
assert(getBuiltinID() == ID && "ID too large for field!");
378373
}
379374
void clearBuiltinID() {
380-
ObjCOrBuiltinID = llvm::to_underlying(
381-
ObjCKeywordOrInterestingOrBuiltin::NonSpecialIdentifier);
382-
}
383-
384-
tok::InterestingIdentifierKind getInterestingIdentifierID() const {
385-
auto Value =
386-
static_cast<ObjCKeywordOrInterestingOrBuiltin>(ObjCOrBuiltinID);
387-
if (Value > ObjCKeywordOrInterestingOrBuiltin::NUM_OBJC_KEYWORDS &&
388-
Value < ObjCKeywordOrInterestingOrBuiltin::
389-
NUM_OBJC_KEYWORDS_AND_INTERESTING_IDENTIFIERS) {
390-
auto FirstInterestingIdentifier =
391-
1 + llvm::to_underlying(
392-
ObjCKeywordOrInterestingOrBuiltin::NUM_OBJC_KEYWORDS);
393-
return static_cast<tok::InterestingIdentifierKind>(
394-
ObjCOrBuiltinID - FirstInterestingIdentifier);
375+
InterestingIdentifierID =
376+
llvm::to_underlying(InterestingIdentifier::NotInterestingIdentifier);
377+
}
378+
379+
tok::NotableIdentifierKind getNotableIdentifierID() const {
380+
auto Value = static_cast<InterestingIdentifier>(InterestingIdentifierID);
381+
if (Value > InterestingIdentifier::NUM_OBJC_KEYWORDS &&
382+
Value <
383+
InterestingIdentifier::NUM_OBJC_KEYWORDS_AND_NOTABLE_IDENTIFIERS) {
384+
auto FirstNotableIdentifier =
385+
1 + llvm::to_underlying(InterestingIdentifier::NUM_OBJC_KEYWORDS);
386+
return static_cast<tok::NotableIdentifierKind>(InterestingIdentifierID -
387+
FirstNotableIdentifier);
395388
}
396-
return tok::not_interesting;
389+
return tok::not_notable;
397390
}
398-
void setInterestingIdentifierID(unsigned ID) {
399-
assert(ID != tok::not_interesting);
400-
auto FirstInterestingIdentifier =
401-
1 + llvm::to_underlying(
402-
ObjCKeywordOrInterestingOrBuiltin::NUM_OBJC_KEYWORDS);
403-
ObjCOrBuiltinID = ID + FirstInterestingIdentifier;
404-
assert(getInterestingIdentifierID() == ID && "ID too large for field!");
391+
void setNotableIdentifierID(unsigned ID) {
392+
assert(ID != tok::not_notable);
393+
auto FirstNotableIdentifier =
394+
1 + llvm::to_underlying(InterestingIdentifier::NUM_OBJC_KEYWORDS);
395+
InterestingIdentifierID = ID + FirstNotableIdentifier;
396+
assert(getNotableIdentifierID() == ID && "ID too large for field!");
405397
}
406398

407-
unsigned getObjCOrBuiltinID() const { return ObjCOrBuiltinID; }
408-
void setObjCOrBuiltinID(unsigned ID) { ObjCOrBuiltinID = ID; }
399+
unsigned getObjCOrBuiltinID() const { return InterestingIdentifierID; }
400+
void setObjCOrBuiltinID(unsigned ID) { InterestingIdentifierID = ID; }
409401

410402
/// get/setExtension - Initialize information about whether or not this
411403
/// language token is an extension. This controls extension warnings, and is

clang/include/clang/Basic/TokenKinds.def

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@
8585
#ifndef PRAGMA_ANNOTATION
8686
#define PRAGMA_ANNOTATION(X) ANNOTATION(X)
8787
#endif
88-
#ifndef INTERESTING_IDENTIFIER
89-
#define INTERESTING_IDENTIFIER(X)
88+
#ifndef NOTABLE_IDENTIFIER
89+
#define NOTABLE_IDENTIFIER(X)
9090
#endif
9191

9292
//===----------------------------------------------------------------------===//
@@ -816,15 +816,15 @@ OBJC_AT_KEYWORD(import)
816816
OBJC_AT_KEYWORD(available)
817817

818818
//===----------------------------------------------------------------------===//
819-
// Interesting identifiers.
819+
// Notable identifiers.
820820
//===----------------------------------------------------------------------===//
821-
INTERESTING_IDENTIFIER(not_interesting)
822-
INTERESTING_IDENTIFIER(FILE)
823-
INTERESTING_IDENTIFIER(jmp_buf)
824-
INTERESTING_IDENTIFIER(sigjmp_buf)
825-
INTERESTING_IDENTIFIER(ucontext_t)
826-
INTERESTING_IDENTIFIER(float_t)
827-
INTERESTING_IDENTIFIER(double_t)
821+
NOTABLE_IDENTIFIER(not_notable)
822+
NOTABLE_IDENTIFIER(FILE)
823+
NOTABLE_IDENTIFIER(jmp_buf)
824+
NOTABLE_IDENTIFIER(sigjmp_buf)
825+
NOTABLE_IDENTIFIER(ucontext_t)
826+
NOTABLE_IDENTIFIER(float_t)
827+
NOTABLE_IDENTIFIER(double_t)
828828

829829
// TODO: What to do about context-sensitive keywords like:
830830
// bycopy/byref/in/inout/oneway/out?
@@ -1019,4 +1019,4 @@ ANNOTATION(repl_input_end)
10191019
#undef TOK
10201020
#undef C99_KEYWORD
10211021
#undef C23_KEYWORD
1022-
#undef INTERESTING_IDENTIFIER
1022+
#undef NOTABLE_IDENTIFIER

0 commit comments

Comments
 (0)