Skip to content

Commit 3e3077c

Browse files
committed
merge main into amd-staging
breaks build of deviceLibs : swdev-493072 Revert 622e398 [AMDGPU] Allow overload of __builtin_amdgcn_mov/update_dpp (llvm#112447) Change-Id: Ia41446b077f701bed7b0c9aad82cbbfcd3c3e3db
2 parents a2256d1 + aea60ab commit 3e3077c

File tree

201 files changed

+11977
-1852
lines changed

Some content is hidden

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

201 files changed

+11977
-1852
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,8 @@ std::string getTagType(TagTypeKind AS);
5555
} // namespace doc
5656
} // namespace clang
5757

58+
namespace llvm {
59+
extern template class Registry<clang::doc::Generator>;
60+
} // namespace llvm
61+
5862
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_GENERATOR_H

clang-tools-extra/clang-tidy/ClangTidyModuleRegistry.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ using ClangTidyModuleRegistry = llvm::Registry<ClangTidyModule>;
1818

1919
} // namespace clang::tidy
2020

21+
namespace llvm {
22+
extern template class Registry<clang::tidy::ClangTidyModule>;
23+
} // namespace llvm
24+
2125
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYMODULEREGISTRY_H

clang-tools-extra/clangd/URI.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,8 @@ typedef llvm::Registry<URIScheme> URISchemeRegistry;
133133
} // namespace clangd
134134
} // namespace clang
135135

136+
namespace llvm {
137+
extern template class Registry<clang::clangd::URIScheme>;
138+
} // namespace llvm
139+
136140
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_URI_H

clang-tools-extra/clangd/refactor/Tweak.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,8 @@ prepareTweak(StringRef ID, const Tweak::Selection &S,
147147
} // namespace clangd
148148
} // namespace clang
149149

150+
namespace llvm {
151+
extern template class Registry<clang::clangd::Tweak>;
152+
} // namespace llvm
153+
150154
#endif

clang-tools-extra/include-cleaner/include/clang-include-cleaner/IncludeSpeller.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,8 @@ using IncludeSpellingStrategy = llvm::Registry<IncludeSpeller>;
4646
std::string spellHeader(const IncludeSpeller::Input &Input);
4747
} // namespace clang::include_cleaner
4848

49+
namespace llvm {
50+
extern template class Registry<clang::include_cleaner::IncludeSpeller>;
51+
} // namespace llvm
52+
4953
#endif

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ Bug Fixes in This Version
464464
- Fixed a crash when trying to transform a dependent address space type. Fixes #GH101685.
465465
- Fixed a crash when diagnosing format strings and encountering an empty
466466
delimited escape sequence (e.g., ``"\o{}"``). #GH102218
467+
- Fixed a crash using ``__array_rank`` on 64-bit targets. (#GH113044).
467468
- The warning emitted for an unsupported register variable type now points to
468469
the unsupported type instead of the ``register`` keyword (#GH109776).
469470

@@ -532,7 +533,7 @@ Bug Fixes to C++ Support
532533
- Clang no longer tries to capture non-odr used default arguments of template parameters of generic lambdas (#GH107048)
533534
- Fixed a bug where defaulted comparison operators would remove ``const`` from base classes. (#GH102588)
534535
- Fix a crash when using ``source_location`` in the trailing return type of a lambda expression. (#GH67134)
535-
- A follow-up fix was added for (#GH61460), as the previous fix was not entirely correct. (#GH86361)
536+
- A follow-up fix was added for (#GH61460), as the previous fix was not entirely correct. (#GH86361), (#GH112352)
536537
- Fixed a crash in the typo correction of an invalid CTAD guide. (#GH107887)
537538
- Fixed a crash when clang tries to subtitute parameter pack while retaining the parameter
538539
pack. (#GH63819), (#GH107560)
@@ -564,6 +565,9 @@ Bug Fixes to C++ Support
564565
- Fix erroneous templated array size calculation leading to crashes in generated code. (#GH41441)
565566
- During the lookup for a base class name, non-type names are ignored. (#GH16855)
566567
- Fix a crash when recovering an invalid expression involving an explicit object member conversion operator. (#GH112559)
568+
- Clang incorrectly considered a class with an anonymous union member to not be
569+
const-default-constructible even if a union member has a default member initializer.
570+
(#GH95854).
567571

568572
Bug Fixes to AST Handling
569573
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/Basic/AttrDocs.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2669,7 +2669,7 @@ sign. For example:
26692669

26702670
.. code-block:: c++
26712671

2672-
__attribute__((target_clones("sha2+memtag2", "fcma+sve2-pmull128")))
2672+
__attribute__((target_clones("sha2+memtag", "fcma+sve2-pmull128")))
26732673
void foo() {}
26742674

26752675
For every multiversioned function a ``default`` (fallback) implementation

clang/include/clang/Basic/ParsedAttrInfo.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "clang/Basic/AttrSubjectMatchRules.h"
1919
#include "clang/Basic/AttributeCommonInfo.h"
20+
#include "clang/Support/Compiler.h"
2021
#include "llvm/ADT/ArrayRef.h"
2122
#include "llvm/Support/Registry.h"
2223
#include <climits>
@@ -175,4 +176,8 @@ const std::list<std::unique_ptr<ParsedAttrInfo>> &getAttributePluginInstances();
175176

176177
} // namespace clang
177178

179+
namespace llvm {
180+
extern template class CLANG_TEMPLATE_ABI Registry<clang::ParsedAttrInfo>;
181+
} // namespace llvm
182+
178183
#endif // LLVM_CLANG_BASIC_PARSEDATTRINFO_H

clang/include/clang/Frontend/FrontendPluginRegistry.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define LLVM_CLANG_FRONTEND_FRONTENDPLUGINREGISTRY_H
1515

1616
#include "clang/Frontend/FrontendAction.h"
17+
#include "clang/Support/Compiler.h"
1718
#include "llvm/Support/Registry.h"
1819

1920
namespace clang {
@@ -23,4 +24,8 @@ using FrontendPluginRegistry = llvm::Registry<PluginASTAction>;
2324

2425
} // namespace clang
2526

27+
namespace llvm {
28+
extern template class CLANG_TEMPLATE_ABI Registry<clang::PluginASTAction>;
29+
} // namespace llvm
30+
2631
#endif // LLVM_CLANG_FRONTEND_FRONTENDPLUGINREGISTRY_H

clang/include/clang/Lex/Preprocessor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "clang/Lex/PPEmbedParameters.h"
3333
#include "clang/Lex/Token.h"
3434
#include "clang/Lex/TokenLexer.h"
35+
#include "clang/Support/Compiler.h"
3536
#include "llvm/ADT/APSInt.h"
3637
#include "llvm/ADT/ArrayRef.h"
3738
#include "llvm/ADT/DenseMap.h"
@@ -3060,4 +3061,8 @@ using PragmaHandlerRegistry = llvm::Registry<PragmaHandler>;
30603061

30613062
} // namespace clang
30623063

3064+
namespace llvm {
3065+
extern template class CLANG_TEMPLATE_ABI Registry<clang::PragmaHandler>;
3066+
} // namespace llvm
3067+
30633068
#endif // LLVM_CLANG_LEX_PREPROCESSOR_H

clang/include/clang/Tooling/CompilationDatabasePluginRegistry.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H
1010
#define LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H
1111

12+
#include "clang/Support/Compiler.h"
1213
#include "clang/Tooling/CompilationDatabase.h"
1314
#include "llvm/Support/Registry.h"
1415

@@ -42,4 +43,9 @@ using CompilationDatabasePluginRegistry =
4243
} // namespace tooling
4344
} // namespace clang
4445

46+
namespace llvm {
47+
extern template class CLANG_TEMPLATE_ABI
48+
Registry<clang::tooling::CompilationDatabasePlugin>;
49+
} // namespace llvm
50+
4551
#endif // LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H

clang/include/clang/Tooling/ToolExecutorPluginRegistry.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef LLVM_CLANG_TOOLING_TOOLEXECUTORPLUGINREGISTRY_H
1010
#define LLVM_CLANG_TOOLING_TOOLEXECUTORPLUGINREGISTRY_H
1111

12+
#include "clang/Support/Compiler.h"
1213
#include "clang/Tooling/Execution.h"
1314
#include "llvm/Support/Registry.h"
1415

@@ -20,4 +21,9 @@ using ToolExecutorPluginRegistry = llvm::Registry<ToolExecutorPlugin>;
2021
} // namespace tooling
2122
} // namespace clang
2223

24+
namespace llvm {
25+
extern template class CLANG_TEMPLATE_ABI
26+
Registry<clang::tooling::ToolExecutorPlugin>;
27+
} // namespace llvm
28+
2329
#endif // LLVM_CLANG_TOOLING_TOOLEXECUTORPLUGINREGISTRY_H

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2371,9 +2371,9 @@ bool Compiler<Emitter>::VisitStringLiteral(const StringLiteral *E) {
23712371

23722372
template <class Emitter>
23732373
bool Compiler<Emitter>::VisitObjCStringLiteral(const ObjCStringLiteral *E) {
2374-
if (std::optional<unsigned> I = P.getOrCreateDummy(E))
2375-
return this->emitGetPtrGlobal(*I, E);
2376-
return false;
2374+
if (DiscardResult)
2375+
return true;
2376+
return this->emitDummyPtr(E, E);
23772377
}
23782378

23792379
template <class Emitter>
@@ -3445,11 +3445,8 @@ bool Compiler<Emitter>::VisitCXXUuidofExpr(const CXXUuidofExpr *E) {
34453445
assert(RD);
34463446
// If the definiton of the result type is incomplete, just return a dummy.
34473447
// If (and when) that is read from, we will fail, but not now.
3448-
if (!RD->isCompleteDefinition()) {
3449-
if (std::optional<unsigned> I = P.getOrCreateDummy(GuidDecl))
3450-
return this->emitGetPtrGlobal(*I, E);
3451-
return false;
3452-
}
3448+
if (!RD->isCompleteDefinition())
3449+
return this->emitDummyPtr(GuidDecl, E);
34533450

34543451
std::optional<unsigned> GlobalIndex = P.getOrCreateGlobal(GuidDecl);
34553452
if (!GlobalIndex)
@@ -3687,11 +3684,11 @@ bool Compiler<Emitter>::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) {
36873684
if (!E->isExpressibleAsConstantInitializer())
36883685
return this->discard(SubExpr) && this->emitInvalid(E);
36893686

3690-
assert(classifyPrim(E) == PT_Ptr);
3691-
if (std::optional<unsigned> I = P.getOrCreateDummy(E))
3692-
return this->emitGetPtrGlobal(*I, E);
3687+
if (DiscardResult)
3688+
return true;
36933689

3694-
return false;
3690+
assert(classifyPrim(E) == PT_Ptr);
3691+
return this->emitDummyPtr(E, E);
36953692
}
36963693

36973694
template <class Emitter>
@@ -4483,15 +4480,9 @@ bool Compiler<Emitter>::VisitBuiltinCallExpr(const CallExpr *E,
44834480
BuiltinID == Builtin::BI__builtin___NSStringMakeConstantString ||
44844481
BuiltinID == Builtin::BI__builtin_ptrauth_sign_constant ||
44854482
BuiltinID == Builtin::BI__builtin_function_start) {
4486-
if (std::optional<unsigned> GlobalOffset = P.getOrCreateDummy(E)) {
4487-
if (!this->emitGetPtrGlobal(*GlobalOffset, E))
4488-
return false;
4489-
4490-
if (PrimType PT = classifyPrim(E); PT != PT_Ptr && isPtrType(PT))
4491-
return this->emitDecayPtr(PT_Ptr, PT, E);
4483+
if (DiscardResult)
44924484
return true;
4493-
}
4494-
return false;
4485+
return this->emitDummyPtr(E, E);
44954486
}
44964487

44974488
QualType ReturnType = E->getType();
@@ -6097,6 +6088,10 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
60976088

60986089
if (VD->evaluateValue())
60996090
return revisit(VD);
6091+
6092+
if (!D->getType()->isReferenceType())
6093+
return this->emitDummyPtr(D, E);
6094+
61006095
return this->emitInvalidDeclRef(cast<DeclRefExpr>(E),
61016096
/*InitializerFailed=*/true, E);
61026097
}
@@ -6109,23 +6104,7 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
61096104
}
61106105
}
61116106

6112-
if (std::optional<unsigned> I = P.getOrCreateDummy(D)) {
6113-
if (!this->emitGetPtrGlobal(*I, E))
6114-
return false;
6115-
if (E->getType()->isVoidType())
6116-
return true;
6117-
// Convert the dummy pointer to another pointer type if we have to.
6118-
if (PrimType PT = classifyPrim(E); PT != PT_Ptr) {
6119-
if (isPtrType(PT))
6120-
return this->emitDecayPtr(PT_Ptr, PT, E);
6121-
return false;
6122-
}
6123-
return true;
6124-
}
6125-
6126-
if (const auto *DRE = dyn_cast<DeclRefExpr>(E))
6127-
return this->emitInvalidDeclRef(DRE, /*InitializerFailed=*/false, E);
6128-
return false;
6107+
return this->emitDummyPtr(D, E);
61296108
}
61306109

61316110
template <class Emitter>
@@ -6428,6 +6407,29 @@ bool Compiler<Emitter>::emitDestruction(const Descriptor *Desc,
64286407
return this->emitRecordDestruction(Desc->ElemRecord, Loc);
64296408
}
64306409

6410+
/// Create a dummy pointer for the given decl (or expr) and
6411+
/// push a pointer to it on the stack.
6412+
template <class Emitter>
6413+
bool Compiler<Emitter>::emitDummyPtr(const DeclTy &D, const Expr *E) {
6414+
assert(!DiscardResult && "Should've been checked before");
6415+
6416+
unsigned DummyID = P.getOrCreateDummy(D);
6417+
6418+
if (!this->emitGetPtrGlobal(DummyID, E))
6419+
return false;
6420+
if (E->getType()->isVoidType())
6421+
return true;
6422+
6423+
// Convert the dummy pointer to another pointer type if we have to.
6424+
if (PrimType PT = classifyPrim(E); PT != PT_Ptr) {
6425+
if (isPtrType(PT))
6426+
return this->emitDecayPtr(PT_Ptr, PT, E);
6427+
return false;
6428+
}
6429+
6430+
return true;
6431+
}
6432+
64316433
namespace clang {
64326434
namespace interp {
64336435

clang/lib/AST/ByteCode/Compiler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ class Compiler : public ConstStmtVisitor<Compiler<Emitter>, bool>,
370370
const BinaryOperator *E);
371371
bool emitRecordDestruction(const Record *R, SourceInfo Loc);
372372
bool emitDestruction(const Descriptor *Desc, SourceInfo Loc);
373+
bool emitDummyPtr(const DeclTy &D, const Expr *E);
373374
unsigned collectBaseOffset(const QualType BaseType,
374375
const QualType DerivedType);
375376
bool emitLambdaStaticInvokerBody(const CXXMethodDecl *MD);

clang/lib/AST/ByteCode/Program.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ std::optional<unsigned> Program::getOrCreateGlobal(const ValueDecl *VD,
147147
return std::nullopt;
148148
}
149149

150-
std::optional<unsigned> Program::getOrCreateDummy(const DeclTy &D) {
150+
unsigned Program::getOrCreateDummy(const DeclTy &D) {
151151
assert(D);
152152
// Dedup blocks since they are immutable and pointers cannot be compared.
153153
if (auto It = DummyVariables.find(D.getOpaqueValue());

clang/lib/AST/ByteCode/Program.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class Program final {
8585
const Expr *Init = nullptr);
8686

8787
/// Returns or creates a dummy value for unknown declarations.
88-
std::optional<unsigned> getOrCreateDummy(const DeclTy &D);
88+
unsigned getOrCreateDummy(const DeclTy &D);
8989

9090
/// Creates a global and returns its index.
9191
std::optional<unsigned> createGlobal(const ValueDecl *VD, const Expr *Init);

clang/lib/AST/DeclCXX.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,9 @@ void CXXRecordDecl::addedMember(Decl *D) {
10601060
if (isUnion() && !Field->isAnonymousStructOrUnion())
10611061
data().HasVariantMembers = true;
10621062

1063+
if (isUnion() && IsFirstField)
1064+
data().HasUninitializedFields = true;
1065+
10631066
// C++0x [class]p9:
10641067
// A POD struct is a class that is both a trivial class and a
10651068
// standard-layout class, and has no non-static data members of type
@@ -1128,7 +1131,10 @@ void CXXRecordDecl::addedMember(Decl *D) {
11281131
data().DefaultedCopyConstructorIsDeleted = true;
11291132
}
11301133

1131-
if (!Field->hasInClassInitializer() && !Field->isMutable()) {
1134+
if (isUnion() && !Field->isMutable()) {
1135+
if (Field->hasInClassInitializer())
1136+
data().HasUninitializedFields = false;
1137+
} else if (!Field->hasInClassInitializer() && !Field->isMutable()) {
11321138
if (CXXRecordDecl *FieldType = T->getAsCXXRecordDecl()) {
11331139
if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
11341140
data().HasUninitializedFields = true;

clang/lib/Basic/Targets/AArch64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const {
784784
.Case("sme-fa64", HasSMEFA64)
785785
.Case("sme-f16f16", HasSMEF16F16)
786786
.Case("sme-b16b16", HasSMEB16B16)
787-
.Cases("memtag", "memtag2", HasMTE)
787+
.Case("memtag", HasMTE)
788788
.Case("sb", HasSB)
789789
.Case("predres", HasPredRes)
790790
.Cases("ssbs", "ssbs2", HasSSBS)

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ class ScalarExprEmitter
722722
}
723723

724724
Value *VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *E) {
725-
return llvm::ConstantInt::get(Builder.getInt32Ty(), E->getValue());
725+
return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue());
726726
}
727727

728728
Value *VisitExpressionTraitExpr(const ExpressionTraitExpr *E) {

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,7 +2148,7 @@ bool UnwrappedLineParser::tryToParsePropertyAccessor() {
21482148
if (!Style.isCSharp())
21492149
return false;
21502150
// See if it's a property accessor.
2151-
if (FormatTok->Previous->isNot(tok::identifier))
2151+
if (!FormatTok->Previous || FormatTok->Previous->isNot(tok::identifier))
21522152
return false;
21532153

21542154
// See if we are inside a property accessor.
@@ -3484,10 +3484,10 @@ bool UnwrappedLineParser::parseRequires() {
34843484
case tok::r_paren:
34853485
case tok::kw_noexcept:
34863486
case tok::kw_const:
3487+
case tok::amp:
34873488
// This is a requires clause.
34883489
parseRequiresClause(RequiresToken);
34893490
return true;
3490-
case tok::amp:
34913491
case tok::ampamp: {
34923492
// This can be either:
34933493
// if (... && requires (T t) ...)

clang/lib/Headers/opencl-c-base.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#define __opencl_c_ext_fp32_global_atomic_min_max 1
4747
#define __opencl_c_ext_fp32_local_atomic_min_max 1
4848
#define __opencl_c_ext_image_raw10_raw12 1
49+
#define __opencl_c_ext_image_unorm_int_2_101010 1
4950
#define cl_khr_kernel_clock 1
5051
#define __opencl_c_kernel_clock_scope_device 1
5152
#define __opencl_c_kernel_clock_scope_work_group 1
@@ -486,6 +487,9 @@ typedef enum memory_order
486487
#define CLK_UNSIGNED_INT_RAW10_EXT 0x10E3
487488
#define CLK_UNSIGNED_INT_RAW12_EXT 0x10E4
488489
#endif // __opencl_c_ext_image_raw10_raw12
490+
#ifdef __opencl_c_ext_image_unorm_int_2_101010
491+
#define CLK_UNORM_INT_2_101010_EXT 0x10E5
492+
#endif // __opencl_c_ext_image_unorm_int_2_101010
489493

490494
// Channel order, numbering must be aligned with cl_channel_order in cl.h
491495
//

0 commit comments

Comments
 (0)