diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-08-19 23:14:54 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-08-19 23:14:54 +0000 |
commit | 20cf19141f4a6260f9f4cb33093e66721f12630b (patch) | |
tree | 2cb7fe8ed2a08d3c322f5424690780383f77f01e /clang/lib/Parse/ParseDecl.cpp | |
parent | da94af763bf7b1a966d05907fa062bd660cdd90f (diff) | |
download | bcm5719-llvm-20cf19141f4a6260f9f4cb33093e66721f12630b.tar.gz bcm5719-llvm-20cf19141f4a6260f9f4cb33093e66721f12630b.zip |
Keep track of the right paren ')' source location in a function declarator.
llvm-svn: 79489
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 9958bdf5668..d3d2cf06e35 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -2451,7 +2451,8 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, delete AttrList; } - SourceLocation Loc = ConsumeParen(); // Eat the closing ')'. + SourceLocation RParenLoc = ConsumeParen(); // Eat the closing ')'. + SourceLocation EndLoc = RParenLoc; // cv-qualifier-seq[opt]. DeclSpec DS; @@ -2463,13 +2464,13 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, if (getLang().CPlusPlus) { ParseTypeQualifierListOpt(DS, false /*no attributes*/); if (!DS.getSourceRange().getEnd().isInvalid()) - Loc = DS.getSourceRange().getEnd(); + EndLoc = DS.getSourceRange().getEnd(); // Parse exception-specification[opt]. if (Tok.is(tok::kw_throw)) { hasExceptionSpec = true; ThrowLoc = Tok.getLocation(); - ParseExceptionSpecification(Loc, Exceptions, ExceptionRanges, + ParseExceptionSpecification(EndLoc, Exceptions, ExceptionRanges, hasAnyExceptionSpec); assert(Exceptions.size() == ExceptionRanges.size() && "Produced different number of exception types and ranges."); @@ -2488,8 +2489,8 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, Exceptions.data(), ExceptionRanges.data(), Exceptions.size(), - LParenLoc, D), - Loc); + LParenLoc, RParenLoc, D), + EndLoc); return; } @@ -2629,7 +2630,8 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, PrototypeScope.Exit(); // If we have the closing ')', eat it. - SourceLocation Loc = MatchRHSPunctuation(tok::r_paren, LParenLoc); + SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc); + SourceLocation EndLoc = RParenLoc; DeclSpec DS; bool hasExceptionSpec = false; @@ -2641,13 +2643,13 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, // Parse cv-qualifier-seq[opt]. ParseTypeQualifierListOpt(DS, false /*no attributes*/); if (!DS.getSourceRange().getEnd().isInvalid()) - Loc = DS.getSourceRange().getEnd(); + EndLoc = DS.getSourceRange().getEnd(); // Parse exception-specification[opt]. if (Tok.is(tok::kw_throw)) { hasExceptionSpec = true; ThrowLoc = Tok.getLocation(); - ParseExceptionSpecification(Loc, Exceptions, ExceptionRanges, + ParseExceptionSpecification(EndLoc, Exceptions, ExceptionRanges, hasAnyExceptionSpec); assert(Exceptions.size() == ExceptionRanges.size() && "Produced different number of exception types and ranges."); @@ -2663,8 +2665,9 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, hasAnyExceptionSpec, Exceptions.data(), ExceptionRanges.data(), - Exceptions.size(), LParenLoc, D), - Loc); + Exceptions.size(), + LParenLoc, RParenLoc, D), + EndLoc); } /// ParseFunctionDeclaratorIdentifierList - While parsing a function declarator @@ -2740,7 +2743,7 @@ void Parser::ParseFunctionDeclaratorIdentifierList(SourceLocation LParenLoc, /*TypeQuals*/0, /*exception*/false, SourceLocation(), false, 0, 0, 0, - LParenLoc, D), + LParenLoc, RLoc, D), RLoc); } |