Skip to content

Commit 1d22c95

Browse files
committed
Merge from 'main' to 'sycl-web' (57 commits)
CONFLICT (content): Merge conflict in llvm/test/Transforms/InstCombine/gep-combine-loop-invariant.ll
2 parents 42f1723 + 34b10e1 commit 1d22c95

File tree

169 files changed

+6022
-5678
lines changed

Some content is hidden

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

169 files changed

+6022
-5678
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ Bug Fixes to C++ Support
338338
- Fixed an assertion failure when converting vectors to int/float with invalid expressions. (#GH105486)
339339
- Template parameter names are considered in the name lookup of out-of-line class template
340340
specialization right before its declaration context. (#GH64082)
341+
- Fixed a constraint comparison bug for friend declarations. (#GH78101)
341342

342343
Bug Fixes to AST Handling
343344
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/DeclID.h

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
#include "llvm/ADT/Hashing.h"
2121
#include "llvm/ADT/iterator.h"
2222

23-
#include <climits>
24-
2523
namespace clang {
2624

2725
/// Predefined declaration IDs.
@@ -32,65 +30,62 @@ namespace clang {
3230
/// it is created.
3331
enum PredefinedDeclIDs {
3432
/// The NULL declaration.
35-
PREDEF_DECL_NULL_ID = 0,
33+
PREDEF_DECL_NULL_ID,
3634

3735
/// The translation unit.
38-
PREDEF_DECL_TRANSLATION_UNIT_ID = 1,
36+
PREDEF_DECL_TRANSLATION_UNIT_ID,
3937

4038
/// The Objective-C 'id' type.
41-
PREDEF_DECL_OBJC_ID_ID = 2,
39+
PREDEF_DECL_OBJC_ID_ID,
4240

4341
/// The Objective-C 'SEL' type.
44-
PREDEF_DECL_OBJC_SEL_ID = 3,
42+
PREDEF_DECL_OBJC_SEL_ID,
4543

4644
/// The Objective-C 'Class' type.
47-
PREDEF_DECL_OBJC_CLASS_ID = 4,
45+
PREDEF_DECL_OBJC_CLASS_ID,
4846

4947
/// The Objective-C 'Protocol' type.
50-
PREDEF_DECL_OBJC_PROTOCOL_ID = 5,
48+
PREDEF_DECL_OBJC_PROTOCOL_ID,
5149

5250
/// The signed 128-bit integer type.
53-
PREDEF_DECL_INT_128_ID = 6,
51+
PREDEF_DECL_INT_128_ID,
5452

5553
/// The unsigned 128-bit integer type.
56-
PREDEF_DECL_UNSIGNED_INT_128_ID = 7,
54+
PREDEF_DECL_UNSIGNED_INT_128_ID,
5755

5856
/// The internal 'instancetype' typedef.
59-
PREDEF_DECL_OBJC_INSTANCETYPE_ID = 8,
57+
PREDEF_DECL_OBJC_INSTANCETYPE_ID,
6058

6159
/// The internal '__builtin_va_list' typedef.
62-
PREDEF_DECL_BUILTIN_VA_LIST_ID = 9,
60+
PREDEF_DECL_BUILTIN_VA_LIST_ID,
6361

6462
/// The internal '__va_list_tag' struct, if any.
65-
PREDEF_DECL_VA_LIST_TAG = 10,
63+
PREDEF_DECL_VA_LIST_TAG,
6664

6765
/// The internal '__builtin_ms_va_list' typedef.
68-
PREDEF_DECL_BUILTIN_MS_VA_LIST_ID = 11,
66+
PREDEF_DECL_BUILTIN_MS_VA_LIST_ID,
6967

7068
/// The predeclared '_GUID' struct.
71-
PREDEF_DECL_BUILTIN_MS_GUID_ID = 12,
69+
PREDEF_DECL_BUILTIN_MS_GUID_ID,
7270

7371
/// The extern "C" context.
74-
PREDEF_DECL_EXTERN_C_CONTEXT_ID = 13,
72+
PREDEF_DECL_EXTERN_C_CONTEXT_ID,
7573

7674
/// The internal '__make_integer_seq' template.
77-
PREDEF_DECL_MAKE_INTEGER_SEQ_ID = 14,
75+
PREDEF_DECL_MAKE_INTEGER_SEQ_ID,
7876

7977
/// The internal '__NSConstantString' typedef.
80-
PREDEF_DECL_CF_CONSTANT_STRING_ID = 15,
78+
PREDEF_DECL_CF_CONSTANT_STRING_ID,
8179

8280
/// The internal '__NSConstantString' tag type.
83-
PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID = 16,
81+
PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID,
8482

8583
/// The internal '__type_pack_element' template.
86-
PREDEF_DECL_TYPE_PACK_ELEMENT_ID = 17,
87-
};
84+
PREDEF_DECL_TYPE_PACK_ELEMENT_ID,
8885

89-
/// The number of declaration IDs that are predefined.
90-
///
91-
/// For more information about predefined declarations, see the
92-
/// \c PredefinedDeclIDs type and the PREDEF_DECL_*_ID constants.
93-
const unsigned int NUM_PREDEF_DECL_IDS = 18;
86+
/// The number of declaration IDs that are predefined.
87+
NUM_PREDEF_DECL_IDS
88+
};
9489

9590
/// GlobalDeclID means DeclID in the current ASTContext and LocalDeclID means
9691
/// DeclID specific to a certain ModuleFile. Specially, in ASTWriter, the

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5688,7 +5688,7 @@ def note_checking_constraints_for_function_here : Note<
56885688
def note_constraint_substitution_here : Note<
56895689
"while substituting template arguments into constraint expression here">;
56905690
def note_constraint_normalization_here : Note<
5691-
"while calculating associated constraint of template '%0' here">;
5691+
"while calculating associated constraint of template %0 here">;
56925692
def note_parameter_mapping_substitution_here : Note<
56935693
"while substituting into concept arguments here; substitution failures not "
56945694
"allowed in concept arguments">;

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3772,7 +3772,6 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD,
37723772

37733773
auto initGlobal = [&](unsigned GlobalIndex) -> bool {
37743774
assert(Init);
3775-
DeclScope<Emitter> LocalScope(this, VD);
37763775

37773776
if (VarT) {
37783777
if (!this->visit(Init))
@@ -3796,6 +3795,8 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD,
37963795
return this->emitPopPtr(Init);
37973796
};
37983797

3798+
DeclScope<Emitter> LocalScope(this, VD);
3799+
37993800
// We've already seen and initialized this global.
38003801
if (std::optional<unsigned> GlobalIndex = P.getGlobal(VD)) {
38013802
if (P.getPtrGlobal(*GlobalIndex).isInitialized())

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,21 @@ static bool CheckTemporary(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
181181
if (!Ptr.isStaticTemporary())
182182
return true;
183183

184-
if (Ptr.getDeclDesc()->getType().isConstQualified())
184+
const auto *MTE = dyn_cast_if_present<MaterializeTemporaryExpr>(
185+
Ptr.getDeclDesc()->asExpr());
186+
if (!MTE)
185187
return true;
186188

187-
if (S.P.getCurrentDecl() == ID)
188-
return true;
189-
190-
const SourceInfo &E = S.Current->getSource(OpPC);
191-
S.FFDiag(E, diag::note_constexpr_access_static_temporary, 1) << AK;
192-
S.Note(Ptr.getDeclLoc(), diag::note_constexpr_temporary_here);
193-
return false;
189+
// FIXME(perf): Since we do this check on every Load from a static
190+
// temporary, it might make sense to cache the value of the
191+
// isUsableInConstantExpressions call.
192+
if (!MTE->isUsableInConstantExpressions(S.getASTContext()) &&
193+
Ptr.block()->getEvalID() != S.Ctx.getEvalID()) {
194+
const SourceInfo &E = S.Current->getSource(OpPC);
195+
S.FFDiag(E, diag::note_constexpr_access_static_temporary, 1) << AK;
196+
S.Note(Ptr.getDeclLoc(), diag::note_constexpr_temporary_here);
197+
return false;
198+
}
194199
}
195200
return true;
196201
}

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,8 @@ static void runThinLTOBackend(
13341334
// We can simply import the values mentioned in the combined index, since
13351335
// we should only invoke this using the individual indexes written out
13361336
// via a WriteIndexesThinBackend.
1337-
FunctionImporter::ImportMapTy ImportList;
1337+
FunctionImporter::ImportIDTable ImportIDs;
1338+
FunctionImporter::ImportMapTy ImportList(ImportIDs);
13381339
if (!lto::initImportList(*M, *CombinedIndex, ImportList))
13391340
return;
13401341

clang/lib/Driver/ToolChain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,8 @@ std::optional<std::string> ToolChain::getRuntimePath() const {
921921
llvm::sys::path::append(P, "lib");
922922
if (auto Ret = getTargetSubDirPath(P))
923923
return Ret;
924-
// Darwin does not use per-target runtime directory.
925-
if (Triple.isOSDarwin())
924+
// Darwin and AIX does not use per-target runtime directory.
925+
if (Triple.isOSDarwin() || Triple.isOSAIX())
926926
return {};
927927
llvm::sys::path::append(P, Triple.str());
928928
return std::string(P);

clang/lib/Sema/CheckExprLifetime.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,10 @@ void checkExprLifetime(Sema &SemaRef, const AssignedEntity &Entity,
12971297
Expr *Init) {
12981298
bool EnableLifetimeWarnings = !SemaRef.getDiagnostics().isIgnored(
12991299
diag::warn_dangling_lifetime_pointer, SourceLocation());
1300-
bool RunAnalysis = Entity.LHS->getType()->isPointerType() ||
1300+
bool EnableDanglingPointerAssignment = !SemaRef.getDiagnostics().isIgnored(
1301+
diag::warn_dangling_pointer_assignment, SourceLocation());
1302+
bool RunAnalysis = (EnableDanglingPointerAssignment &&
1303+
Entity.LHS->getType()->isPointerType()) ||
13011304
(EnableLifetimeWarnings &&
13021305
isRecordWithAttr<PointerAttr>(Entity.LHS->getType()));
13031306

clang/lib/Sema/SemaConcept.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,14 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction(
10121012
// possible that e.g. constraints involving C<Class<T>> and C<Class> are
10131013
// perceived identical.
10141014
std::optional<Sema::ContextRAII> ContextScope;
1015-
if (auto *RD = dyn_cast<CXXRecordDecl>(DeclInfo.getDeclContext())) {
1015+
const DeclContext *DC = [&] {
1016+
if (!DeclInfo.getDecl())
1017+
return DeclInfo.getDeclContext();
1018+
return DeclInfo.getDecl()->getFriendObjectKind()
1019+
? DeclInfo.getLexicalDeclContext()
1020+
: DeclInfo.getDeclContext();
1021+
}();
1022+
if (auto *RD = dyn_cast<CXXRecordDecl>(DC)) {
10161023
ThisScope.emplace(S, const_cast<CXXRecordDecl *>(RD), Qualifiers());
10171024
ContextScope.emplace(S, const_cast<DeclContext *>(cast<DeclContext>(RD)),
10181025
/*NewThisContext=*/false);

0 commit comments

Comments
 (0)