hintonda created this revision.
hintonda added reviewers: sepavloff, rsmith, aaron.ballman.
hintonda added a subscriber: cfe-commits.
Treat invalid noexcept specifications in the same way we
treat invalid throw specifications, by not resetting the exception
type to EST_None, and testing isUsable instead of isInvalid.
Rational: In order to add source locations for exception
specifications (see https://reviews.llvm.org/D20428) we need to
maintain the correct exception type, otherwise, FunctionDecl types
won't include space for source ranges, but the associated
TypeSourceInfo type will, causing ASTContext::adjustExceptionSpec to
assert once source ranges have been added.
https://reviews.llvm.org/D28258
Files:
lib/Parse/ParseDeclCXX.cpp
lib/Sema/TreeTransform.h
Index: lib/Sema/TreeTransform.h
===================================================================
--- lib/Sema/TreeTransform.h
+++ lib/Sema/TreeTransform.h
@@ -5041,20 +5041,20 @@
EnterExpressionEvaluationContext Unevaluated(getSema(),
Sema::ConstantEvaluated);
ExprResult NoexceptExpr = getDerived().TransformExpr(ESI.NoexceptExpr);
- if (NoexceptExpr.isInvalid())
+ if (!NoexceptExpr.isUsable())
return true;
// FIXME: This is bogus, a noexcept expression is not a condition.
NoexceptExpr = getSema().CheckBooleanCondition(Loc, NoexceptExpr.get());
- if (NoexceptExpr.isInvalid())
+ if (!NoexceptExpr.isUsable())
return true;
if (!NoexceptExpr.get()->isValueDependent()) {
NoexceptExpr = getSema().VerifyIntegerConstantExpression(
NoexceptExpr.get(), nullptr,
diag::err_noexcept_needs_constant_expression,
/*AllowFold*/false);
- if (NoexceptExpr.isInvalid())
+ if (!NoexceptExpr.isUsable())
return true;
}
Index: lib/Parse/ParseDeclCXX.cpp
===================================================================
--- lib/Parse/ParseDeclCXX.cpp
+++ lib/Parse/ParseDeclCXX.cpp
@@ -3544,8 +3544,6 @@
NoexceptExpr =
Actions.CheckBooleanCondition(KeywordLoc, NoexceptExpr.get());
NoexceptRange = SourceRange(KeywordLoc, T.getCloseLocation());
- } else {
- NoexceptType = EST_None;
}
} else {
// There is no argument.
Index: lib/Sema/TreeTransform.h
===================================================================
--- lib/Sema/TreeTransform.h
+++ lib/Sema/TreeTransform.h
@@ -5041,20 +5041,20 @@
EnterExpressionEvaluationContext Unevaluated(getSema(),
Sema::ConstantEvaluated);
ExprResult NoexceptExpr = getDerived().TransformExpr(ESI.NoexceptExpr);
- if (NoexceptExpr.isInvalid())
+ if (!NoexceptExpr.isUsable())
return true;
// FIXME: This is bogus, a noexcept expression is not a condition.
NoexceptExpr = getSema().CheckBooleanCondition(Loc, NoexceptExpr.get());
- if (NoexceptExpr.isInvalid())
+ if (!NoexceptExpr.isUsable())
return true;
if (!NoexceptExpr.get()->isValueDependent()) {
NoexceptExpr = getSema().VerifyIntegerConstantExpression(
NoexceptExpr.get(), nullptr,
diag::err_noexcept_needs_constant_expression,
/*AllowFold*/false);
- if (NoexceptExpr.isInvalid())
+ if (!NoexceptExpr.isUsable())
return true;
}
Index: lib/Parse/ParseDeclCXX.cpp
===================================================================
--- lib/Parse/ParseDeclCXX.cpp
+++ lib/Parse/ParseDeclCXX.cpp
@@ -3544,8 +3544,6 @@
NoexceptExpr =
Actions.CheckBooleanCondition(KeywordLoc, NoexceptExpr.get());
NoexceptRange = SourceRange(KeywordLoc, T.getCloseLocation());
- } else {
- NoexceptType = EST_None;
}
} else {
// There is no argument.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits