Skip to content

Commit 5d9754a

Browse files
committed
Merge from 'main' to 'sycl-web' (#2)
CONFLICT (content): Merge conflict in llvm/include/llvm/LinkAllPasses.h
2 parents ad96251 + 02c5ba8 commit 5d9754a

File tree

293 files changed

+8313
-2361
lines changed

Some content is hidden

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

293 files changed

+8313
-2361
lines changed

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7763,6 +7763,8 @@ class MappableExprsHandler {
77637763
const ValueDecl *MapDecl = (I->getAssociatedDeclaration())
77647764
? I->getAssociatedDeclaration()
77657765
: BaseDecl;
7766+
MapExpr = (I->getAssociatedExpression()) ? I->getAssociatedExpression()
7767+
: MapExpr;
77667768

77677769
// Get information on whether the element is a pointer. Have to do a
77687770
// special treatment for array sections given that they are built-in

clang/lib/Sema/SemaChecking.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4670,8 +4670,7 @@ void Sema::CheckArgAlignment(SourceLocation Loc, NamedDecl *FDecl,
46704670

46714671
// Find expected alignment, and the actual alignment of the passed object.
46724672
// getTypeAlignInChars requires complete types
4673-
if (ParamTy->isIncompleteType() || ArgTy->isIncompleteType() ||
4674-
ParamTy->isUndeducedType() || ArgTy->isUndeducedType())
4673+
if (ParamTy->isIncompleteType() || ArgTy->isIncompleteType())
46754674
return;
46764675

46774676
CharUnits ParamAlign = Context.getTypeAlignInChars(ParamTy);

clang/lib/Sema/SemaExpr.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19781,8 +19781,10 @@ ExprResult Sema::CreateRecoveryExpr(SourceLocation Begin, SourceLocation End,
1978119781
if (isSFINAEContext())
1978219782
return ExprError();
1978319783

19784-
if (T.isNull() || !Context.getLangOpts().RecoveryASTType)
19784+
if (T.isNull() || T->isUndeducedType() ||
19785+
!Context.getLangOpts().RecoveryASTType)
1978519786
// We don't know the concrete type, fallback to dependent type.
1978619787
T = Context.DependentTy;
19788+
1978719789
return RecoveryExpr::Create(Context, T, Begin, End, SubExprs);
1978819790
}

clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,10 +1135,11 @@ Decl *TemplateDeclInstantiator::InstantiateTypedefNameDecl(TypedefNameDecl *D,
11351135
SemaRef.MarkDeclarationsReferencedInType(D->getLocation(), DI->getType());
11361136
}
11371137

1138-
// HACK: g++ has a bug where it gets the value kind of ?: wrong.
1139-
// libstdc++ relies upon this bug in its implementation of common_type.
1140-
// If we happen to be processing that implementation, fake up the g++ ?:
1141-
// semantics. See LWG issue 2141 for more information on the bug.
1138+
// HACK: 2012-10-23 g++ has a bug where it gets the value kind of ?: wrong.
1139+
// libstdc++ relies upon this bug in its implementation of common_type. If we
1140+
// happen to be processing that implementation, fake up the g++ ?:
1141+
// semantics. See LWG issue 2141 for more information on the bug. The bugs
1142+
// are fixed in g++ and libstdc++ 4.9.0 (2014-04-22).
11421143
const DecltypeType *DT = DI->getType()->getAs<DecltypeType>();
11431144
CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D->getDeclContext());
11441145
if (DT && RD && isa<ConditionalOperator>(DT->getUnderlyingExpr()) &&

clang/lib/StaticAnalyzer/Core/SValBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,8 @@ SVal SValBuilder::evalCastSubKind(loc::MemRegionVal V, QualType CastTy,
761761
// Next fixes pointer dereference using type different from its initial
762762
// one. See PR37503 and PR49007 for details.
763763
if (const auto *ER = dyn_cast<ElementRegion>(R)) {
764-
R = StateMgr.getStoreManager().castRegion(ER, CastTy);
765-
return loc::MemRegionVal(R);
764+
if ((R = StateMgr.getStoreManager().castRegion(ER, CastTy)))
765+
return loc::MemRegionVal(R);
766766
}
767767

768768
return V;

clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void WriteJSON(StringRef JsonPath, llvm::json::Object &&ClassInheritance,
122122
}
123123

124124
std::error_code EC;
125-
llvm::raw_fd_ostream JsonOut(JsonPath, EC, llvm::sys::fs::F_Text);
125+
llvm::raw_fd_ostream JsonOut(JsonPath, EC, llvm::sys::fs::OF_Text);
126126
if (EC)
127127
return;
128128

clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int main(int argc, const char **argv) {
7171

7272
if (SkipProcessing) {
7373
std::error_code EC;
74-
llvm::raw_fd_ostream JsonOut(JsonOutputPath, EC, llvm::sys::fs::F_Text);
74+
llvm::raw_fd_ostream JsonOut(JsonOutputPath, EC, llvm::sys::fs::OF_Text);
7575
if (EC)
7676
return 1;
7777
JsonOut << formatv("{0:2}", llvm::json::Value(llvm::json::Object()));

clang/test/Analysis/casts.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,19 @@ void no_crash_reinterpret_char_as_uchar(char ***a, int *b) {
250250
if (**a == 0) // no-crash
251251
;
252252
}
253+
254+
// See PR50179.
255+
// Just don't crash.
256+
typedef struct taskS {
257+
void *pJob;
258+
} taskS;
259+
260+
typedef struct workS {
261+
taskS *pTaskList;
262+
} workS;
263+
264+
void *getTaskJob(unsigned jobId, workS *pWork, unsigned taskId) {
265+
const taskS *pTask = pWork->pTaskList + taskId;
266+
taskS task = *pTask;
267+
return task.pJob;
268+
}

clang/test/OpenMP/target_map_names.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.ps->ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
1717
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.ps->ps->ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
1818
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.ps->ps->s.f[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
19-
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.ps->ps->s.f[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
2019
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
2120
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->i;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
2221
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->s.f;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
@@ -25,7 +24,6 @@
2524
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->ps->ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
2625
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->ps->ps->ps;{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
2726
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->ps->ps->s.f[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
28-
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->ps->ps->s.f[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
2927
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.f[:22];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
3028
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.p[:33];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
3129
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";ps->p[:33];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
@@ -181,6 +179,18 @@ void qux() {
181179

182180
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";s.Z[0:64];{{.*}}.cpp;{{[0-9]+}};{{[0-9]+}};;\00"
183181

182+
// Clang used to mistakenly generate the map name "x" for both x and y on this
183+
// directive. Conditions to reproduce the bug: a single map clause has two
184+
// variables, and at least the second is used in the associated statement.
185+
//
186+
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";x;{{.*}}.cpp;[[@LINE+3]];7;;\00"
187+
// DEBUG: @{{[0-9]+}} = private unnamed_addr constant [{{[0-9]+}} x i8] c";y;{{.*}}.cpp;[[@LINE+2]];10;;\00"
188+
void secondMapNameInClause() {
189+
int x, y;
190+
#pragma omp target map(to: x, y)
191+
x = y = 1;
192+
}
193+
184194
// DEBUG: %{{.+}} = call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{.+}}, i32 1, i8** %{{.+}}, i8** %{{.+}}, i64* {{.+}}, i64* {{.+}}, i8** getelementptr inbounds ([{{[0-9]+}} x i8*], [{{[0-9]+}} x i8*]* @.offload_mapnames{{.*}}, i32 0, i32 0), i8** {{.+}})
185195
// DEBUG: %{{.+}} = call i32 @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{.+}}, i32 1, i8** %{{.+}}, i8** %{{.+}}, i64* {{.+}}, i64* {{.+}}, i8** getelementptr inbounds ([{{[0-9]+}} x i8*], [{{[0-9]+}} x i8*]* @.offload_mapnames{{.*}}, i32 0, i32 0), i8** {{.+}}, i32 {{.+}}, i32 {{.+}})
186196
// DEBUG: call void @__tgt_target_data_begin_mapper(%struct.ident_t* @{{.+}}, i64 -1, i32 1, i8** %{{.+}}, i8** %{{.+}}, i64* {{.+}}, i64* {{.+}}, i8** getelementptr inbounds ([{{[0-9]+}} x i8*], [{{[0-9]+}} x i8*]* @.offload_mapnames{{.*}}, i32 0, i32 0), i8** {{.+}})

clang/test/SemaCXX/recovery-expr-type.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple=x86_64-unknown-unknown -frecovery-ast -frecovery-ast-type -o - %s -fsyntax-only -verify
1+
// RUN: %clang_cc1 -triple=x86_64-unknown-unknown -frecovery-ast -frecovery-ast-type -o - %s -std=gnu++17 -fsyntax-only -verify
22

33
namespace test0 {
44
struct Indestructible {
@@ -26,7 +26,7 @@ namespace test2 {
2626
void foo(); // expected-note 3{{requires 0 arguments}}
2727
void func() {
2828
// verify that "field has incomplete type" diagnostic is suppressed.
29-
typeof(foo(42)) var; // expected-error {{no matching function}}
29+
typeof(foo(42)) var; // expected-error {{no matching function}} \
3030
3131
// FIXME: suppress the "cannot initialize a variable" diagnostic.
3232
int a = foo(1); // expected-error {{no matching function}} \
@@ -116,3 +116,23 @@ int f(); // expected-note {{candidate}}
116116
template<typename T> const int k = f(T()); // expected-error {{no matching function}}
117117
static_assert(k<int> == 1, ""); // expected-note {{instantiation of}}
118118
}
119+
120+
namespace test11 {
121+
// Verify we do not assert()-fail here.
122+
template <class T> void foo(T &t);
123+
template <typename T>
124+
void bar(T t) {
125+
foo(t);
126+
}
127+
128+
template <typename T = void *>
129+
struct S { // expected-note {{candidate}}
130+
S(T t); // expected-note {{candidate}}
131+
~S();
132+
};
133+
template <typename T> S(T t) -> S<void *>;
134+
135+
void baz() {
136+
bar(S(123)); // expected-error {{no matching conversion}}
137+
}
138+
} // namespace test11

0 commit comments

Comments
 (0)