Instead of storing an ASTContext* in FunctionProtoTypes with computed noexcept specifiers, unique FunctionProtoTypes with a ContextualFoldingSet, as suggested by John McCall.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127568 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index f655105..04c21bc 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -3091,7 +3091,7 @@
// Check out noexcept specs.
if (EST == EST_ComputedNoexcept) {
- FunctionProtoType::NoexceptResult NR = Proto->getNoexceptSpec();
+ FunctionProtoType::NoexceptResult NR = Proto->getNoexceptSpec(Context);
assert(NR != FunctionProtoType::NR_NoNoexcept &&
"Must have noexcept result for EST_ComputedNoexcept.");
assert(NR != FunctionProtoType::NR_Dependent &&
diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp
index 01ee712..285f400 100644
--- a/lib/Sema/SemaExceptionSpec.cpp
+++ b/lib/Sema/SemaExceptionSpec.cpp
@@ -313,8 +313,8 @@
if (OldEST == EST_None && NewEST == EST_None)
return false;
- FunctionProtoType::NoexceptResult OldNR = Old->getNoexceptSpec();
- FunctionProtoType::NoexceptResult NewNR = New->getNoexceptSpec();
+ FunctionProtoType::NoexceptResult OldNR = Old->getNoexceptSpec(Context);
+ FunctionProtoType::NoexceptResult NewNR = New->getNoexceptSpec(Context);
if (OldNR == FunctionProtoType::NR_BadNoexcept ||
NewNR == FunctionProtoType::NR_BadNoexcept)
return false;
@@ -460,7 +460,7 @@
// omissions we make here.
// We also shortcut checking if a noexcept expression was bad.
- FunctionProtoType::NoexceptResult SuperNR =Superset->getNoexceptSpec();
+ FunctionProtoType::NoexceptResult SuperNR =Superset->getNoexceptSpec(Context);
if (SuperNR == FunctionProtoType::NR_BadNoexcept ||
SuperNR == FunctionProtoType::NR_Dependent)
return false;
@@ -479,7 +479,7 @@
return true;
}
- FunctionProtoType::NoexceptResult SubNR = Subset->getNoexceptSpec();
+ FunctionProtoType::NoexceptResult SubNR = Subset->getNoexceptSpec(Context);
if (SubNR == FunctionProtoType::NR_BadNoexcept ||
SubNR == FunctionProtoType::NR_Dependent)
return false;
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index a1cd43a..ea93449 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -2423,7 +2423,7 @@
FoundAssign = true;
const FunctionProtoType *CPT
= Operator->getType()->getAs<FunctionProtoType>();
- if (!CPT->isNothrow()) {
+ if (!CPT->isNothrow(Self.Context)) {
AllNoThrow = false;
break;
}
@@ -2465,7 +2465,7 @@
= Constructor->getType()->getAs<FunctionProtoType>();
// FIXME: check whether evaluating default arguments can throw.
// For now, we'll be conservative and assume that they can throw.
- if (!CPT->isNothrow() || CPT->getNumArgs() > 1) {
+ if (!CPT->isNothrow(Self.Context) || CPT->getNumArgs() > 1) {
AllNoThrow = false;
break;
}
@@ -2500,7 +2500,7 @@
= Constructor->getType()->getAs<FunctionProtoType>();
// TODO: check whether evaluating default arguments can throw.
// For now, we'll be conservative and assume that they can throw.
- return CPT->isNothrow() && CPT->getNumArgs() == 0;
+ return CPT->isNothrow(Self.Context) && CPT->getNumArgs() == 0;
}
}
}