Simplify code to equivalent code. No need to test for null after cast<>, use
takeAs<> instead of cast<>(.take()). Fix 80-column violation in whitespace after comment. llvm-svn: 191170
This commit is contained in:
parent
ed4265c24e
commit
0f29289bb4
|
@ -340,9 +340,7 @@ void Sema::ActOnParamUnparsedDefaultArgument(Decl *param,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ParmVarDecl *Param = cast<ParmVarDecl>(param);
|
ParmVarDecl *Param = cast<ParmVarDecl>(param);
|
||||||
if (Param)
|
Param->setUnparsedDefaultArg();
|
||||||
Param->setUnparsedDefaultArg();
|
|
||||||
|
|
||||||
UnparsedDefaultArgLocs[Param] = ArgLoc;
|
UnparsedDefaultArgLocs[Param] = ArgLoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,9 +351,7 @@ void Sema::ActOnParamDefaultArgumentError(Decl *param) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ParmVarDecl *Param = cast<ParmVarDecl>(param);
|
ParmVarDecl *Param = cast<ParmVarDecl>(param);
|
||||||
|
|
||||||
Param->setInvalidDecl();
|
Param->setInvalidDecl();
|
||||||
|
|
||||||
UnparsedDefaultArgLocs.erase(Param);
|
UnparsedDefaultArgLocs.erase(Param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11130,13 +11126,13 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S,
|
||||||
EnterExpressionEvaluationContext scope(*this, PotentiallyEvaluated);
|
EnterExpressionEvaluationContext scope(*this, PotentiallyEvaluated);
|
||||||
|
|
||||||
// C++ [except.handle]p16:
|
// C++ [except.handle]p16:
|
||||||
// The object declared in an exception-declaration or, if the
|
// The object declared in an exception-declaration or, if the
|
||||||
// exception-declaration does not specify a name, a temporary (12.2) is
|
// exception-declaration does not specify a name, a temporary (12.2) is
|
||||||
// copy-initialized (8.5) from the exception object. [...]
|
// copy-initialized (8.5) from the exception object. [...]
|
||||||
// The object is destroyed when the handler exits, after the destruction
|
// The object is destroyed when the handler exits, after the destruction
|
||||||
// of any automatic objects initialized within the handler.
|
// of any automatic objects initialized within the handler.
|
||||||
//
|
//
|
||||||
// We just pretend to initialize the object with itself, then make sure
|
// We just pretend to initialize the object with itself, then make sure
|
||||||
// it can be destroyed later.
|
// it can be destroyed later.
|
||||||
QualType initType = ExDeclType;
|
QualType initType = ExDeclType;
|
||||||
|
|
||||||
|
@ -11154,7 +11150,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S,
|
||||||
else {
|
else {
|
||||||
// If the constructor used was non-trivial, set this as the
|
// If the constructor used was non-trivial, set this as the
|
||||||
// "initializer".
|
// "initializer".
|
||||||
CXXConstructExpr *construct = cast<CXXConstructExpr>(result.take());
|
CXXConstructExpr *construct = result.takeAs<CXXConstructExpr>();
|
||||||
if (!construct->getConstructor()->isTrivial()) {
|
if (!construct->getConstructor()->isTrivial()) {
|
||||||
Expr *init = MaybeCreateExprWithCleanups(construct);
|
Expr *init = MaybeCreateExprWithCleanups(construct);
|
||||||
ExDecl->setInit(init);
|
ExDecl->setInit(init);
|
||||||
|
|
Loading…
Reference in New Issue