aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-01-22 21:17:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-01-22 21:17:12 +0000
commit790462cc37eb4ee9424408ca56a74bca9b3ef693 (patch)
treed75ecf941e7e23a1c07385e4904e73a5db387c81
parent53e9d7970557c6b1e6924cc30eb3bcf317aa8861 (diff)
downloadsrc-790462cc37eb4ee9424408ca56a74bca9b3ef693.tar.gz
src-790462cc37eb4ee9424408ca56a74bca9b3ef693.zip
Vendor import of clang release_38 branch r258549:vendor/clang/clang-release_38-r258549
Notes
Notes: svn path=/vendor/clang/dist/; revision=294604 svn path=/vendor/clang/clang-release_38-r258549/; revision=294605; tag=vendor/clang/clang-release_38-r258549
-rw-r--r--lib/CodeGen/CGOpenMPRuntime.cpp16
-rw-r--r--lib/CodeGen/CGStmtOpenMP.cpp20
-rw-r--r--lib/CodeGen/CodeGenFunction.h2
-rw-r--r--lib/Sema/SemaTemplate.cpp1
-rw-r--r--test/OpenMP/parallel_reduction_codegen.cpp4
-rw-r--r--test/SemaTemplate/default-arguments.cpp28
6 files changed, 53 insertions, 18 deletions
diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp
index 3b97ba2469ae..015a7396ffbe 100644
--- a/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -3548,14 +3548,16 @@ void CGOpenMPRuntime::emitReduction(CodeGenFunction &CGF, SourceLocation Loc,
E = CGF.EmitAnyExpr(EExpr);
CGF.EmitOMPAtomicSimpleUpdateExpr(
X, E, BO, /*IsXLHSInRHSPart=*/true, llvm::Monotonic, Loc,
- [&CGF, UpExpr, VD, IPriv](RValue XRValue) {
+ [&CGF, UpExpr, VD, IPriv, Loc](RValue XRValue) {
CodeGenFunction::OMPPrivateScope PrivateScope(CGF);
- PrivateScope.addPrivate(VD, [&CGF, VD, XRValue]() -> Address {
- Address LHSTemp = CGF.CreateMemTemp(VD->getType());
- CGF.EmitStoreThroughLValue(
- XRValue, CGF.MakeAddrLValue(LHSTemp, VD->getType()));
- return LHSTemp;
- });
+ PrivateScope.addPrivate(
+ VD, [&CGF, VD, XRValue, Loc]() -> Address {
+ Address LHSTemp = CGF.CreateMemTemp(VD->getType());
+ CGF.emitOMPSimpleStore(
+ CGF.MakeAddrLValue(LHSTemp, VD->getType()), XRValue,
+ VD->getType().getNonReferenceType(), Loc);
+ return LHSTemp;
+ });
(void)PrivateScope.Privatize();
return CGF.EmitAnyExpr(UpExpr);
});
diff --git a/lib/CodeGen/CGStmtOpenMP.cpp b/lib/CodeGen/CGStmtOpenMP.cpp
index 14917c20c535..68555128ea01 100644
--- a/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/lib/CodeGen/CGStmtOpenMP.cpp
@@ -2163,17 +2163,17 @@ static void emitSimpleAtomicStore(CodeGenFunction &CGF, bool IsSeqCst,
}
}
-static void emitSimpleStore(CodeGenFunction &CGF, LValue LVal, RValue RVal,
- QualType RValTy, SourceLocation Loc) {
- switch (CGF.getEvaluationKind(LVal.getType())) {
+void CodeGenFunction::emitOMPSimpleStore(LValue LVal, RValue RVal,
+ QualType RValTy, SourceLocation Loc) {
+ switch (getEvaluationKind(LVal.getType())) {
case TEK_Scalar:
- CGF.EmitStoreThroughLValue(RValue::get(convertToScalarValue(
- CGF, RVal, RValTy, LVal.getType(), Loc)),
- LVal);
+ EmitStoreThroughLValue(RValue::get(convertToScalarValue(
+ *this, RVal, RValTy, LVal.getType(), Loc)),
+ LVal);
break;
case TEK_Complex:
- CGF.EmitStoreOfComplex(
- convertToComplexValue(CGF, RVal, RValTy, LVal.getType(), Loc), LVal,
+ EmitStoreOfComplex(
+ convertToComplexValue(*this, RVal, RValTy, LVal.getType(), Loc), LVal,
/*isInit=*/false);
break;
case TEK_Aggregate:
@@ -2201,7 +2201,7 @@ static void EmitOMPAtomicReadExpr(CodeGenFunction &CGF, bool IsSeqCst,
// list.
if (IsSeqCst)
CGF.CGM.getOpenMPRuntime().emitFlush(CGF, llvm::None, Loc);
- emitSimpleStore(CGF, VLValue, Res, X->getType().getNonReferenceType(), Loc);
+ CGF.emitOMPSimpleStore(VLValue, Res, X->getType().getNonReferenceType(), Loc);
}
static void EmitOMPAtomicWriteExpr(CodeGenFunction &CGF, bool IsSeqCst,
@@ -2459,7 +2459,7 @@ static void EmitOMPAtomicCaptureExpr(CodeGenFunction &CGF, bool IsSeqCst,
}
}
// Emit post-update store to 'v' of old/new 'x' value.
- emitSimpleStore(CGF, VLValue, NewVVal, NewVValType, Loc);
+ CGF.emitOMPSimpleStore(VLValue, NewVVal, NewVValType, Loc);
// OpenMP, 2.12.6, atomic Construct
// Any atomic construct with a seq_cst clause forces the atomically
// performed operation to include an implicit flush operation without a
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index b3d50352532e..4803b13f58d9 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -2211,6 +2211,8 @@ public:
llvm::Function *GenerateOpenMPCapturedStmtFunction(const CapturedStmt &S);
void GenerateOpenMPCapturedVars(const CapturedStmt &S,
SmallVectorImpl<llvm::Value *> &CapturedVars);
+ void emitOMPSimpleStore(LValue LVal, RValue RVal, QualType RValTy,
+ SourceLocation Loc);
/// \brief Perform element by element copying of arrays with type \a
/// OriginalType from \a SrcAddr to \a DestAddr using copying procedure
/// generated by \a CopyGen.
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 57156078c80b..138cee0b9424 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -3281,7 +3281,6 @@ SubstDefaultTemplateArgument(Sema &SemaRef,
for (unsigned i = 0, e = Param->getDepth(); i != e; ++i)
TemplateArgLists.addOuterTemplateArguments(None);
- Sema::ContextRAII SavedContext(SemaRef, Template->getDeclContext());
EnterExpressionEvaluationContext ConstantEvaluated(SemaRef,
Sema::ConstantEvaluated);
return SemaRef.SubstExpr(Param->getDefaultArgument(), TemplateArgLists);
diff --git a/test/OpenMP/parallel_reduction_codegen.cpp b/test/OpenMP/parallel_reduction_codegen.cpp
index b9744b634118..05224d0a1391 100644
--- a/test/OpenMP/parallel_reduction_codegen.cpp
+++ b/test/OpenMP/parallel_reduction_codegen.cpp
@@ -158,6 +158,7 @@ int main() {
int vec[] = {1, 2};
S<float> s_arr[] = {1, 2};
S<float> var(3), var1;
+ float _Complex cf;
#pragma omp parallel reduction(+:t_var) reduction(&:var) reduction(&& : var1) reduction(min: t_var1)
{
vec[0] = t_var;
@@ -169,6 +170,8 @@ int main() {
vec[0] = t_var;
s_arr[0] = var;
}
+#pragma omp parallel reduction(+ : cf)
+ ;
return tmain<int>();
#endif
}
@@ -178,6 +181,7 @@ int main() {
// CHECK: call {{.*}} [[S_FLOAT_TY_CONSTR:@.+]]([[S_FLOAT_TY]]* [[TEST]])
// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 6, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [2 x i32]*, float*, [2 x [[S_FLOAT_TY]]]*, [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]*, float*)* [[MAIN_MICROTASK:@.+]] to void
// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 6, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [2 x i32]*, float*, [2 x [[S_FLOAT_TY]]]*, [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]*, float*)* [[MAIN_MICROTASK1:@.+]] to void
+// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, { float, float }*)* [[MAIN_MICROTASK2:@.+]] to void
// CHECK: = call {{.*}}i{{.+}} [[TMAIN_INT:@.+]]()
// CHECK: call {{.*}} [[S_FLOAT_TY_DESTR:@.+]]([[S_FLOAT_TY]]*
// CHECK: ret
diff --git a/test/SemaTemplate/default-arguments.cpp b/test/SemaTemplate/default-arguments.cpp
index 740a5a9d07b3..d3e249db7ee2 100644
--- a/test/SemaTemplate/default-arguments.cpp
+++ b/test/SemaTemplate/default-arguments.cpp
@@ -179,3 +179,31 @@ struct C {
C(T t = ); // expected-error {{expected expression}}
};
C<int> obj;
+
+namespace PR26134 {
+// Make sure when substituting default template arguments we do it in the current context.
+template<class T, bool Val = T::value>
+struct X {};
+
+template<bool B> struct Y {
+ void f() { X<Y> xy; }
+ static const bool value = B;
+};
+
+namespace ns1 {
+template<class T0>
+struct X {
+ template<bool B = T0::value> struct XInner { static const bool value = B; };
+};
+template<bool B> struct S { static const bool value = B; };
+#if __cplusplus > 199711L
+template<bool B> struct Y {
+ static constexpr bool f() { return typename X<S<B>>::template XInner<>{}.value; }
+ static_assert(f() == B, "");
+};
+Y<true> y;
+Y<false> y2;
+#endif
+
+} // end ns1
+} // end ns PR26134