Skip to content

Commit 6c3b481

Browse files
author
Jenkins
committed
merge main into amd-staging
Change-Id: Ief6b8d89a2f4f72190f7f84f7c93becba632ec38
2 parents aaf013a + 2fcfc97 commit 6c3b481

File tree

209 files changed

+9666
-4262
lines changed

Some content is hidden

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

209 files changed

+9666
-4262
lines changed

clang/docs/ClangLinkerWrapper.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ linking is desired, simply do not run the binaries through the
7979
``clang-linker-wrapper``. This will simply append the embedded device code so
8080
that it can be linked later.
8181

82+
Matching
83+
========
84+
85+
The linker wrapper will link extracted device code that is compatible with each
86+
other. Generally, this requires that the target triple and architecture match.
87+
An exception is made when the architecture is listed as ``generic``, which will
88+
cause it be linked with any other device code with the same target triple.
89+
8290
Example
8391
=======
8492

clang/docs/analyzer/checkers.rst

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,28 +1890,6 @@ the locking/unlocking of ``mtx_t`` mutexes.
18901890
mtx_lock(&mtx1); // warn: This lock has already been acquired
18911891
}
18921892
1893-
.. _alpha-core-CallAndMessageUnInitRefArg:
1894-
1895-
alpha.core.CallAndMessageUnInitRefArg (C,C++, ObjC)
1896-
"""""""""""""""""""""""""""""""""""""""""""""""""""
1897-
Check for logical errors for function calls and Objective-C
1898-
message expressions (e.g., uninitialized arguments, null function pointers, and pointer to undefined variables).
1899-
1900-
.. code-block:: c
1901-
1902-
void test(void) {
1903-
int t;
1904-
int &p = t;
1905-
int &s = p;
1906-
int &q = s;
1907-
foo(q); // warn
1908-
}
1909-
1910-
void test(void) {
1911-
int x;
1912-
foo(&x); // warn
1913-
}
1914-
19151893
.. _alpha-core-CastSize:
19161894
19171895
alpha.core.CastSize (C)

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3728,6 +3728,8 @@ def err_sme_definition_using_zt0_in_non_sme2_target : Error<
37283728
"function using ZT0 state requires 'sme2'">;
37293729
def err_conflicting_attributes_arm_state : Error<
37303730
"conflicting attributes for state '%0'">;
3731+
def err_sme_streaming_cannot_be_multiversioned : Error<
3732+
"streaming function cannot be multi-versioned">;
37313733
def err_unknown_arm_state : Error<
37323734
"unknown state '%0'">;
37333735
def err_missing_arm_state : Error<

clang/include/clang/Basic/IdentifierTable.h

Lines changed: 79 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#ifndef LLVM_CLANG_BASIC_IDENTIFIERTABLE_H
1616
#define LLVM_CLANG_BASIC_IDENTIFIERTABLE_H
1717

18+
#include "clang/Basic/Builtins.h"
1819
#include "clang/Basic/DiagnosticIDs.h"
1920
#include "clang/Basic/LLVM.h"
2021
#include "clang/Basic/TokenKinds.h"
@@ -86,19 +87,26 @@ enum { IdentifierInfoAlignment = 8 };
8687
static constexpr int ObjCOrBuiltinIDBits = 16;
8788

8889
/// The "layout" of ObjCOrBuiltinID is:
89-
/// - The first value (0) represents "not a special identifier".
90-
/// - The next (NUM_OBJC_KEYWORDS - 1) values represent ObjCKeywordKinds (not
91-
/// including objc_not_keyword).
92-
/// - The next (NUM_INTERESTING_IDENTIFIERS - 1) values represent
93-
/// InterestingIdentifierKinds (not including not_interesting).
94-
/// - The rest of the values represent builtin IDs (not including NotBuiltin).
95-
static constexpr int FirstObjCKeywordID = 1;
96-
static constexpr int LastObjCKeywordID =
97-
FirstObjCKeywordID + tok::NUM_OBJC_KEYWORDS - 2;
98-
static constexpr int FirstInterestingIdentifierID = LastObjCKeywordID + 1;
99-
static constexpr int LastInterestingIdentifierID =
100-
FirstInterestingIdentifierID + tok::NUM_INTERESTING_IDENTIFIERS - 2;
101-
static constexpr int FirstBuiltinID = LastInterestingIdentifierID + 1;
90+
/// - ObjCKeywordKind enumerators
91+
/// - InterestingIdentifierKind enumerators
92+
/// - Builtin::ID enumerators
93+
/// - NonSpecialIdentifier
94+
enum class ObjCKeywordOrInterestingOrBuiltin {
95+
#define OBJC_AT_KEYWORD(X) objc_##X,
96+
#include "clang/Basic/TokenKinds.def"
97+
NUM_OBJC_KEYWORDS,
98+
99+
#define INTERESTING_IDENTIFIER(X) X,
100+
#include "clang/Basic/TokenKinds.def"
101+
NUM_OBJC_KEYWORDS_AND_INTERESTING_IDENTIFIERS,
102+
103+
NotBuiltin,
104+
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
105+
#include "clang/Basic/Builtins.inc"
106+
FirstTSBuiltin,
107+
108+
NonSpecialIdentifier = 65534
109+
};
102110

103111
/// One of these records is kept for each identifier that
104112
/// is lexed. This contains information about whether the token was \#define'd,
@@ -113,9 +121,7 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
113121
LLVM_PREFERRED_TYPE(tok::TokenKind)
114122
unsigned TokenID : 9;
115123

116-
// ObjC keyword ('protocol' in '@protocol') or builtin (__builtin_inf).
117-
// First NUM_OBJC_KEYWORDS values are for Objective-C,
118-
// the remaining values are for builtins.
124+
LLVM_PREFERRED_TYPE(ObjCKeywordOrInterestingOrBuiltin)
119125
unsigned ObjCOrBuiltinID : ObjCOrBuiltinIDBits;
120126

121127
// True if there is a #define for this.
@@ -198,13 +204,16 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
198204
llvm::StringMapEntry<IdentifierInfo *> *Entry = nullptr;
199205

200206
IdentifierInfo()
201-
: TokenID(tok::identifier), ObjCOrBuiltinID(0), HasMacro(false),
202-
HadMacro(false), IsExtension(false), IsFutureCompatKeyword(false),
203-
IsPoisoned(false), IsCPPOperatorKeyword(false),
204-
NeedsHandleIdentifier(false), IsFromAST(false), ChangedAfterLoad(false),
205-
FEChangedAfterLoad(false), RevertedTokenID(false), OutOfDate(false),
206-
IsModulesImport(false), IsMangledOpenMPVariantName(false),
207-
IsDeprecatedMacro(false), IsRestrictExpansion(false), IsFinal(false) {}
207+
: TokenID(tok::identifier),
208+
ObjCOrBuiltinID(llvm::to_underlying(
209+
ObjCKeywordOrInterestingOrBuiltin::NonSpecialIdentifier)),
210+
HasMacro(false), HadMacro(false), IsExtension(false),
211+
IsFutureCompatKeyword(false), IsPoisoned(false),
212+
IsCPPOperatorKeyword(false), NeedsHandleIdentifier(false),
213+
IsFromAST(false), ChangedAfterLoad(false), FEChangedAfterLoad(false),
214+
RevertedTokenID(false), OutOfDate(false), IsModulesImport(false),
215+
IsMangledOpenMPVariantName(false), IsDeprecatedMacro(false),
216+
IsRestrictExpansion(false), IsFinal(false) {}
208217

209218
public:
210219
IdentifierInfo(const IdentifierInfo &) = delete;
@@ -332,42 +341,66 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
332341
///
333342
/// For example, 'class' will return tok::objc_class if ObjC is enabled.
334343
tok::ObjCKeywordKind getObjCKeywordID() const {
335-
static_assert(FirstObjCKeywordID == 1,
336-
"hard-coding this assumption to simplify code");
337-
if (ObjCOrBuiltinID <= LastObjCKeywordID)
338-
return tok::ObjCKeywordKind(ObjCOrBuiltinID);
339-
else
340-
return tok::objc_not_keyword;
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);
350+
return tok::objc_not_keyword;
351+
}
352+
void setObjCKeywordID(tok::ObjCKeywordKind ID) {
353+
assert(0 == llvm::to_underlying(
354+
ObjCKeywordOrInterestingOrBuiltin::objc_not_keyword));
355+
ObjCOrBuiltinID = ID;
356+
assert(getObjCKeywordID() == ID && "ID too large for field!");
341357
}
342-
void setObjCKeywordID(tok::ObjCKeywordKind ID) { ObjCOrBuiltinID = ID; }
343358

344359
/// Return a value indicating whether this is a builtin function.
345-
///
346-
/// 0 is not-built-in. 1+ are specific builtin functions.
347360
unsigned getBuiltinID() const {
348-
if (ObjCOrBuiltinID >= FirstBuiltinID)
349-
return 1 + (ObjCOrBuiltinID - FirstBuiltinID);
350-
else
351-
return 0;
361+
auto Value =
362+
static_cast<ObjCKeywordOrInterestingOrBuiltin>(ObjCOrBuiltinID);
363+
if (Value > ObjCKeywordOrInterestingOrBuiltin::
364+
NUM_OBJC_KEYWORDS_AND_INTERESTING_IDENTIFIERS &&
365+
Value != ObjCKeywordOrInterestingOrBuiltin::NonSpecialIdentifier) {
366+
auto FirstBuiltin =
367+
llvm::to_underlying(ObjCKeywordOrInterestingOrBuiltin::NotBuiltin);
368+
return static_cast<Builtin::ID>(ObjCOrBuiltinID - FirstBuiltin);
369+
}
370+
return Builtin::ID::NotBuiltin;
352371
}
353372
void setBuiltinID(unsigned ID) {
354-
assert(ID != 0);
355-
ObjCOrBuiltinID = FirstBuiltinID + (ID - 1);
373+
assert(ID != Builtin::ID::NotBuiltin);
374+
auto FirstBuiltin =
375+
llvm::to_underlying(ObjCKeywordOrInterestingOrBuiltin::NotBuiltin);
376+
ObjCOrBuiltinID = ID + FirstBuiltin;
356377
assert(getBuiltinID() == ID && "ID too large for field!");
357378
}
358-
void clearBuiltinID() { ObjCOrBuiltinID = 0; }
379+
void clearBuiltinID() {
380+
ObjCOrBuiltinID = llvm::to_underlying(
381+
ObjCKeywordOrInterestingOrBuiltin::NonSpecialIdentifier);
382+
}
359383

360384
tok::InterestingIdentifierKind getInterestingIdentifierID() const {
361-
if (ObjCOrBuiltinID >= FirstInterestingIdentifierID &&
362-
ObjCOrBuiltinID <= LastInterestingIdentifierID)
363-
return tok::InterestingIdentifierKind(
364-
1 + (ObjCOrBuiltinID - FirstInterestingIdentifierID));
365-
else
366-
return tok::not_interesting;
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);
395+
}
396+
return tok::not_interesting;
367397
}
368398
void setInterestingIdentifierID(unsigned ID) {
369399
assert(ID != tok::not_interesting);
370-
ObjCOrBuiltinID = FirstInterestingIdentifierID + (ID - 1);
400+
auto FirstInterestingIdentifier =
401+
1 + llvm::to_underlying(
402+
ObjCKeywordOrInterestingOrBuiltin::NUM_OBJC_KEYWORDS);
403+
ObjCOrBuiltinID = ID + FirstInterestingIdentifier;
371404
assert(getInterestingIdentifierID() == ID && "ID too large for field!");
372405
}
373406

0 commit comments

Comments
 (0)