diff options
author | Abramo Bagnara <abramo.bagnara@bugseng.com> | 2012-10-15 21:05:46 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo.bagnara@bugseng.com> | 2012-10-15 21:05:46 +0000 |
commit | 2fc03caee8089d57b64fe638c11fbcf320039b77 (patch) | |
tree | a811a21980ae9318603b690fb4077b57e5325041 /clang/lib/Parse/ParseDecl.cpp | |
parent | bbd469bef315c36ca0eae73eceb160174fee9f12 (diff) | |
download | bcm5719-llvm-2fc03caee8089d57b64fe638c11fbcf320039b77.tar.gz bcm5719-llvm-2fc03caee8089d57b64fe638c11fbcf320039b77.zip |
Fixed FunctionTypeLoc range for trailing return type.
llvm-svn: 165974
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 3ef4f38ad03..3e4d92abe8f 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -4582,7 +4582,10 @@ void Parser::ParseFunctionDeclarator(Declarator &D, Actions.ActOnStartFunctionDeclarator(); - SourceLocation StartLoc, EndLoc; + /* LocalEndLoc is the end location for the local FunctionTypeLoc. + EndLoc is the end location for the function declarator. + They differ for trailing return types. */ + SourceLocation StartLoc, LocalEndLoc, EndLoc; SourceLocation LParenLoc, RParenLoc; LParenLoc = Tracker.getOpenLocation(); StartLoc = LParenLoc; @@ -4595,6 +4598,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D, Tracker.consumeClose(); RParenLoc = Tracker.getCloseLocation(); + LocalEndLoc = RParenLoc; EndLoc = RParenLoc; } else { if (Tok.isNot(tok::r_paren)) @@ -4607,6 +4611,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D, // If we have the closing ')', eat it. Tracker.consumeClose(); RParenLoc = Tracker.getCloseLocation(); + LocalEndLoc = RParenLoc; EndLoc = RParenLoc; if (getLangOpts().CPlusPlus) { @@ -4663,13 +4668,15 @@ void Parser::ParseFunctionDeclarator(Declarator &D, MaybeParseCXX0XAttributes(FnAttrs); // Parse trailing-return-type[opt]. + LocalEndLoc = EndLoc; if (getLangOpts().CPlusPlus0x && Tok.is(tok::arrow)) { Diag(Tok, diag::warn_cxx98_compat_trailing_return_type); if (D.getDeclSpec().getTypeSpecType() == TST_auto) StartLoc = D.getDeclSpec().getTypeSpecTypeLoc(); - EndLoc = Tok.getLocation(); + LocalEndLoc = Tok.getLocation(); SourceRange Range; TrailingReturnType = ParseTrailingReturnType(Range); + EndLoc = Range.getEnd(); } } } @@ -4691,7 +4698,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D, DynamicExceptions.size(), NoexceptExpr.isUsable() ? NoexceptExpr.get() : 0, - StartLoc, EndLoc, D, + StartLoc, LocalEndLoc, D, TrailingReturnType), FnAttrs, EndLoc); |