summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseCXXInlineMethods.cpp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2015-01-30 14:21:35 +0000
committerNathan Sidwell <nathan@acm.org>2015-01-30 14:21:35 +0000
commit55d53fe79f0613bc48af9fba0e3bc7b9c0a224f7 (patch)
treef6f56f7c1c2363bda0ae265398cb7a7052c7004f /clang/lib/Parse/ParseCXXInlineMethods.cpp
parent1efa12d6d8b68188854bdf618bb297e0e8a77d0c (diff)
downloadbcm5719-llvm-55d53fe79f0613bc48af9fba0e3bc7b9c0a224f7.tar.gz
bcm5719-llvm-55d53fe79f0613bc48af9fba0e3bc7b9c0a224f7.zip
Code cleanup
Parser::ParseLexedMethodDeclaration: Use local var for Param Sema::MergeCXXFunctionDecls: Use hasInheritedDefaultArg llvm-svn: 227577
Diffstat (limited to 'clang/lib/Parse/ParseCXXInlineMethods.cpp')
-rw-r--r--clang/lib/Parse/ParseCXXInlineMethods.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp
index 59b491abfd1..6f13b9dc29c 100644
--- a/clang/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp
@@ -306,9 +306,9 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
ParseScope PrototypeScope(this, Scope::FunctionPrototypeScope |
Scope::FunctionDeclarationScope | Scope::DeclScope);
for (unsigned I = 0, N = LM.DefaultArgs.size(); I != N; ++I) {
+ auto Param = LM.DefaultArgs[I].Param;
// Introduce the parameter into scope.
- Actions.ActOnDelayedCXXMethodParameter(getCurScope(),
- LM.DefaultArgs[I].Param);
+ Actions.ActOnDelayedCXXMethodParameter(getCurScope(), Param);
if (CachedTokens *Toks = LM.DefaultArgs[I].Toks) {
// Mark the end of the default argument so that we know when to stop when
// we parse it later on.
@@ -318,7 +318,7 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
DefArgEnd.setKind(tok::eof);
DefArgEnd.setLocation(LastDefaultArgToken.getLocation().getLocWithOffset(
LastDefaultArgToken.getLength()));
- DefArgEnd.setEofData(LM.DefaultArgs[I].Param);
+ DefArgEnd.setEofData(Param);
Toks->push_back(DefArgEnd);
// Parse the default argument from its saved token stream.
@@ -336,7 +336,7 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
// used.
EnterExpressionEvaluationContext Eval(Actions,
Sema::PotentiallyEvaluatedIfUsed,
- LM.DefaultArgs[I].Param);
+ Param);
ExprResult DefArgResult;
if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace)) {
@@ -346,11 +346,9 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
DefArgResult = ParseAssignmentExpression();
DefArgResult = Actions.CorrectDelayedTyposInExpr(DefArgResult);
if (DefArgResult.isInvalid()) {
- Actions.ActOnParamDefaultArgumentError(LM.DefaultArgs[I].Param,
- EqualLoc);
+ Actions.ActOnParamDefaultArgumentError(Param, EqualLoc);
} else {
- if (Tok.isNot(tok::eof) ||
- Tok.getEofData() != LM.DefaultArgs[I].Param) {
+ if (Tok.isNot(tok::eof) || Tok.getEofData() != Param) {
// The last two tokens are the terminator and the saved value of
// Tok; the last token in the default argument is the one before
// those.
@@ -359,7 +357,7 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
<< SourceRange(Tok.getLocation(),
(*Toks)[Toks->size() - 3].getLocation());
}
- Actions.ActOnParamDefaultArgument(LM.DefaultArgs[I].Param, EqualLoc,
+ Actions.ActOnParamDefaultArgument(Param, EqualLoc,
DefArgResult.get());
}
@@ -368,7 +366,7 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
while (Tok.isNot(tok::eof))
ConsumeAnyToken();
- if (Tok.is(tok::eof) && Tok.getEofData() == LM.DefaultArgs[I].Param)
+ if (Tok.is(tok::eof) && Tok.getEofData() == Param)
ConsumeAnyToken();
delete Toks;
OpenPOWER on IntegriCloud