Skip to content

Commit a2974c5

Browse files
authored
merge main into amd-staging (llvm#2094)
2 parents b76e32b + cc5ccef commit a2974c5

File tree

160 files changed

+2388
-6093
lines changed

Some content is hidden

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

160 files changed

+2388
-6093
lines changed

bolt/test/runtime/X86/fdata-escape-chars.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ define internal void @static_symb_backslash_b() #0 {
8282
; INSTR_CHECK: Binary Function "main"
8383
; INSTR_CHECK: Exec Count : 1
8484
; INSTR_CHECK: {{([[:xdigit:]]+)}}: callq "symb whitespace" # Count: 1
85-
; INSTR_CHECK: {{([[:xdigit:]]+)}}: callq "symb backslash\" # Count: 2
85+
; INSTR_CHECK: {{([[:xdigit:]]+)}}: callq "symb backslash\\" # Count: 2
8686
; INSTR_CHECK: Binary Function "static symb backslash\/1(*2)"
8787
; INSTR_CHECK: Exec Count : 1
8888
; INSTR_CHECK: {{([[:xdigit:]]+)}}: callq "symb whitespace" # Count: 1

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,9 @@ Improvements to Clang's diagnostics
525525
- Clang now prints the namespace for an attribute, if any,
526526
when emitting an unknown attribute diagnostic.
527527

528+
- ``-Wvolatile`` now warns about volatile-qualified class return types
529+
as well as volatile-qualified scalar return types. Fixes #GH133380
530+
528531
- Several compatibility diagnostics that were incorrectly being grouped under
529532
``-Wpre-c++20-compat`` are now part of ``-Wc++20-compat``. (#GH138775)
530533

@@ -941,7 +944,8 @@ Improvements
941944
^^^^^^^^^^^^
942945

943946
Additional Information
944-
======================
947+
948+
===================
945949

946950
A wide variety of additional information is available on the `Clang web
947951
page <https://clang.llvm.org/>`_. The web page contains versions of the

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -942,15 +942,6 @@ bool CheckThis(InterpState &S, CodePtr OpPC, const Pointer &This) {
942942
return false;
943943
}
944944

945-
bool CheckPure(InterpState &S, CodePtr OpPC, const CXXMethodDecl *MD) {
946-
if (!MD->isPureVirtual())
947-
return true;
948-
const SourceInfo &E = S.Current->getSource(OpPC);
949-
S.FFDiag(E, diag::note_constexpr_pure_virtual_call, 1) << MD;
950-
S.Note(MD->getLocation(), diag::note_declared_at);
951-
return false;
952-
}
953-
954945
bool CheckFloatResult(InterpState &S, CodePtr OpPC, const Floating &Result,
955946
APFloat::opStatus Status, FPOptions FPO) {
956947
// [expr.pre]p4:

clang/lib/AST/ByteCode/Interp.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,6 @@ bool CheckCallDepth(InterpState &S, CodePtr OpPC);
114114
/// Checks the 'this' pointer.
115115
bool CheckThis(InterpState &S, CodePtr OpPC, const Pointer &This);
116116

117-
/// Checks if a method is pure virtual.
118-
bool CheckPure(InterpState &S, CodePtr OpPC, const CXXMethodDecl *MD);
119-
120117
/// Checks if all the arguments annotated as 'nonnull' are in fact not null.
121118
bool CheckNonNullArgs(InterpState &S, CodePtr OpPC, const Function *F,
122119
const CallExpr *CE, unsigned ArgSize);

clang/lib/Format/FormatToken.h

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,7 @@ struct AdditionalKeywords {
10681068
kw_interface = &IdentTable.get("interface");
10691069
kw_native = &IdentTable.get("native");
10701070
kw_package = &IdentTable.get("package");
1071+
kw_record = &IdentTable.get("record");
10711072
kw_synchronized = &IdentTable.get("synchronized");
10721073
kw_throws = &IdentTable.get("throws");
10731074
kw___except = &IdentTable.get("__except");
@@ -1262,7 +1263,7 @@ struct AdditionalKeywords {
12621263
kw_verilogHashHash = &IdentTable.get("##");
12631264
kw_apostrophe = &IdentTable.get("\'");
12641265

1265-
// TableGen keywords
1266+
// TableGen keywords.
12661267
kw_bit = &IdentTable.get("bit");
12671268
kw_bits = &IdentTable.get("bits");
12681269
kw_code = &IdentTable.get("code");
@@ -1277,8 +1278,7 @@ struct AdditionalKeywords {
12771278
kw_multiclass = &IdentTable.get("multiclass");
12781279
kw_then = &IdentTable.get("then");
12791280

1280-
// Keep this at the end of the constructor to make sure everything here
1281-
// is
1281+
// Keep this at the end of the constructor to make sure everything here is
12821282
// already initialized.
12831283
JsExtraKeywords = std::unordered_set<IdentifierInfo *>(
12841284
{kw_as, kw_async, kw_await, kw_declare, kw_finally, kw_from,
@@ -1287,19 +1287,14 @@ struct AdditionalKeywords {
12871287
// Keywords from the Java section.
12881288
kw_abstract, kw_extends, kw_implements, kw_instanceof, kw_interface});
12891289

1290-
CSharpExtraKeywords = std::unordered_set<IdentifierInfo *>(
1291-
{kw_base, kw_byte, kw_checked, kw_decimal, kw_delegate, kw_event,
1292-
kw_fixed, kw_foreach, kw_implicit, kw_in, kw_init, kw_interface,
1293-
kw_internal, kw_is, kw_lock, kw_null, kw_object, kw_out, kw_override,
1294-
kw_params, kw_readonly, kw_ref, kw_string, kw_stackalloc, kw_sbyte,
1295-
kw_sealed, kw_uint, kw_ulong, kw_unchecked, kw_unsafe, kw_ushort,
1296-
kw_when, kw_where,
1297-
// Keywords from the JavaScript section.
1298-
kw_as, kw_async, kw_await, kw_declare, kw_finally, kw_from,
1299-
kw_function, kw_get, kw_import, kw_is, kw_let, kw_module, kw_readonly,
1300-
kw_set, kw_type, kw_typeof, kw_var, kw_yield,
1301-
// Keywords from the Java section.
1302-
kw_abstract, kw_extends, kw_implements, kw_instanceof, kw_interface});
1290+
CSharpExtraKeywords = JsExtraKeywords;
1291+
CSharpExtraKeywords.insert(
1292+
{kw_base, kw_byte, kw_checked, kw_decimal, kw_delegate,
1293+
kw_event, kw_fixed, kw_foreach, kw_implicit, kw_in,
1294+
kw_init, kw_internal, kw_lock, kw_null, kw_object,
1295+
kw_out, kw_params, kw_ref, kw_string, kw_stackalloc,
1296+
kw_sbyte, kw_sealed, kw_uint, kw_ulong, kw_unchecked,
1297+
kw_unsafe, kw_ushort, kw_when, kw_where});
13031298

13041299
// Some keywords are not included here because they don't need special
13051300
// treatment like `showcancelled` or they should be treated as identifiers
@@ -1417,6 +1412,7 @@ struct AdditionalKeywords {
14171412
IdentifierInfo *kw_interface;
14181413
IdentifierInfo *kw_native;
14191414
IdentifierInfo *kw_package;
1415+
IdentifierInfo *kw_record;
14201416
IdentifierInfo *kw_synchronized;
14211417
IdentifierInfo *kw_throws;
14221418

@@ -1706,8 +1702,8 @@ struct AdditionalKeywords {
17061702
}
17071703
}
17081704

1709-
/// Returns \c true if \p Tok is a C# keyword, returns
1710-
/// \c false if it is a anything else.
1705+
/// Returns \c true if \p Tok is a C# keyword, returns \c false if it is
1706+
/// anything else.
17111707
bool isCSharpKeyword(const FormatToken &Tok) const {
17121708
if (Tok.isAccessSpecifierKeyword())
17131709
return true;
@@ -1933,7 +1929,7 @@ struct AdditionalKeywords {
19331929
/// The JavaScript keywords beyond the C++ keyword set.
19341930
std::unordered_set<IdentifierInfo *> JsExtraKeywords;
19351931

1936-
/// The C# keywords beyond the C++ keyword set
1932+
/// The C# keywords beyond the C++ keyword set.
19371933
std::unordered_set<IdentifierInfo *> CSharpExtraKeywords;
19381934

19391935
/// The Verilog keywords beyond the C++ keyword set.

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,11 @@ void UnwrappedLineParser::parseStructuralElement(
17041704
*HasLabel = true;
17051705
return;
17061706
}
1707+
if (Style.isJava() && FormatTok->is(Keywords.kw_record)) {
1708+
parseRecord(/*ParseAsExpr=*/false, /*IsJavaRecord=*/true);
1709+
addUnwrappedLine();
1710+
return;
1711+
}
17071712
// In all other cases, parse the declaration.
17081713
break;
17091714
default:
@@ -3996,11 +4001,13 @@ void UnwrappedLineParser::parseJavaEnumBody() {
39964001
addUnwrappedLine();
39974002
}
39984003

3999-
void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
4004+
void UnwrappedLineParser::parseRecord(bool ParseAsExpr, bool IsJavaRecord) {
4005+
assert(!IsJavaRecord || FormatTok->is(Keywords.kw_record));
40004006
const FormatToken &InitialToken = *FormatTok;
40014007
nextToken();
40024008

4003-
FormatToken *ClassName = nullptr;
4009+
FormatToken *ClassName =
4010+
IsJavaRecord && FormatTok->is(tok::identifier) ? FormatTok : nullptr;
40044011
bool IsDerived = false;
40054012
auto IsNonMacroIdentifier = [](const FormatToken *Tok) {
40064013
return Tok->is(tok::identifier) && Tok->TokenText != Tok->TokenText.upper();
@@ -4035,7 +4042,7 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
40354042
switch (FormatTok->Tok.getKind()) {
40364043
case tok::l_paren:
40374044
// We can have macros in between 'class' and the class name.
4038-
if (!IsNonMacroIdentifier(Previous) ||
4045+
if (IsJavaRecord || !IsNonMacroIdentifier(Previous) ||
40394046
// e.g. `struct macro(a) S { int i; };`
40404047
Previous->Previous == &InitialToken) {
40414048
parseParens();

clang/lib/Format/UnwrappedLineParser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class UnwrappedLineParser {
177177
// Parses a record (aka class) as a top level element. If ParseAsExpr is true,
178178
// parses the record as a child block, i.e. if the class declaration is an
179179
// expression.
180-
void parseRecord(bool ParseAsExpr = false);
180+
void parseRecord(bool ParseAsExpr = false, bool IsJavaRecord = false);
181181
void parseObjCLightweightGenerics();
182182
void parseObjCMethod();
183183
void parseObjCProtocolList();

clang/lib/Parse/ParseOpenMP.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2282,7 +2282,8 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
22822282
/* ConstructTraits */ ArrayRef<llvm::omp::TraitProperty>(),
22832283
Actions.OpenMP().getOpenMPDeviceNum());
22842284

2285-
if (isVariantApplicableInContext(VMI, OMPCtx, /* DeviceSetOnly */ true)) {
2285+
if (isVariantApplicableInContext(VMI, OMPCtx,
2286+
/*DeviceOrImplementationSetOnly=*/true)) {
22862287
Actions.OpenMP().ActOnOpenMPBeginDeclareVariant(Loc, TI);
22872288
break;
22882289
}

clang/lib/Sema/SemaType.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5056,13 +5056,13 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
50565056
S.Diag(DeclType.Loc, diag::err_func_returning_qualified_void) << T;
50575057
} else
50585058
diagnoseRedundantReturnTypeQualifiers(S, T, D, chunkIndex);
5059-
5060-
// C++2a [dcl.fct]p12:
5061-
// A volatile-qualified return type is deprecated
5062-
if (T.isVolatileQualified() && S.getLangOpts().CPlusPlus20)
5063-
S.Diag(DeclType.Loc, diag::warn_deprecated_volatile_return) << T;
50645059
}
50655060

5061+
// C++2a [dcl.fct]p12:
5062+
// A volatile-qualified return type is deprecated
5063+
if (T.isVolatileQualified() && S.getLangOpts().CPlusPlus20)
5064+
S.Diag(DeclType.Loc, diag::warn_deprecated_volatile_return) << T;
5065+
50665066
// Objective-C ARC ownership qualifiers are ignored on the function
50675067
// return type (by type canonicalization). Complain if this attribute
50685068
// was written here.

clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefLambdaCapturesChecker.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,22 @@ class RawPtrRefLambdaCapturesChecker
127127
return true;
128128
}
129129

130-
// WTF::switchOn(T, F... f) is a variadic template function and couldn't
131-
// be annotated with NOESCAPE. We hard code it here to workaround that.
132130
bool shouldTreatAllArgAsNoEscape(FunctionDecl *Decl) {
133131
auto *NsDecl = Decl->getParent();
134132
if (!NsDecl || !isa<NamespaceDecl>(NsDecl))
135133
return false;
136-
return safeGetName(NsDecl) == "WTF" && safeGetName(Decl) == "switchOn";
134+
// WTF::switchOn(T, F... f) is a variadic template function and couldn't
135+
// be annotated with NOESCAPE. We hard code it here to workaround that.
136+
if (safeGetName(NsDecl) == "WTF" && safeGetName(Decl) == "switchOn")
137+
return true;
138+
// Treat every argument of functions in std::ranges as noescape.
139+
if (safeGetName(NsDecl) == "ranges") {
140+
if (auto *OuterDecl = NsDecl->getParent();
141+
OuterDecl && isa<NamespaceDecl>(OuterDecl) &&
142+
safeGetName(OuterDecl) == "std")
143+
return true;
144+
}
145+
return false;
137146
}
138147

139148
bool VisitCXXConstructExpr(CXXConstructExpr *CE) override {

0 commit comments

Comments
 (0)