[coroutines] Switch to using std::experimental namespace per P0057R5
Summary:
Look for coroutine_traits and friends in std::experimental namespace.
Patch (mostly) by EricWF.
Reviewers: cfe-commits, EricWF, rsmith
Subscribers: majnemer, mehdi_amini
Differential Revision: https://reviews.llvm.org/D25068
llvm-svn: 283170
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp
index 461ca8e..f9c3970 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -26,15 +26,15 @@
static QualType lookupPromiseType(Sema &S, const FunctionProtoType *FnType,
SourceLocation Loc) {
// FIXME: Cache std::coroutine_traits once we've found it.
- NamespaceDecl *Std = S.getStdNamespace();
- if (!Std) {
+ NamespaceDecl *StdExp = S.lookupStdExperimentalNamespace();
+ if (!StdExp) {
S.Diag(Loc, diag::err_implied_std_coroutine_traits_not_found);
return QualType();
}
LookupResult Result(S, &S.PP.getIdentifierTable().get("coroutine_traits"),
Loc, Sema::LookupOrdinaryName);
- if (!S.LookupQualifiedName(Result, Std)) {
+ if (!S.LookupQualifiedName(Result, StdExp)) {
S.Diag(Loc, diag::err_implied_std_coroutine_traits_not_found);
return QualType();
}
@@ -86,7 +86,7 @@
QualType PromiseType = S.Context.getTypeDeclType(Promise);
if (!PromiseType->getAsCXXRecordDecl()) {
// Use the fully-qualified name of the type.
- auto *NNS = NestedNameSpecifier::Create(S.Context, nullptr, Std);
+ auto *NNS = NestedNameSpecifier::Create(S.Context, nullptr, StdExp);
NNS = NestedNameSpecifier::Create(S.Context, NNS, false,
CoroTrait.getTypePtr());
PromiseType = S.Context.getElaboratedType(ETK_None, NNS, PromiseType);
@@ -345,6 +345,7 @@
}
return BuildCoreturnStmt(Loc, E);
}
+
StmtResult Sema::BuildCoreturnStmt(SourceLocation Loc, Expr *E) {
auto *Coroutine = checkCoroutineContext(*this, Loc, "co_return");
if (!Coroutine)