diff options
author | Nikola Smiljanic <popizdeh@gmail.com> | 2014-06-06 02:58:59 +0000 |
---|---|---|
committer | Nikola Smiljanic <popizdeh@gmail.com> | 2014-06-06 02:58:59 +0000 |
commit | 69fdc9ff89813e679b578e3953131515ddfcac32 (patch) | |
tree | b621e3dac15e3c158f93c9718d67271a0fa39c11 /clang/lib/Parse/ParseDecl.cpp | |
parent | df540cbf92d11cc43d269e033e79cff9ea61a7cb (diff) | |
download | bcm5719-llvm-69fdc9ff89813e679b578e3953131515ddfcac32.tar.gz bcm5719-llvm-69fdc9ff89813e679b578e3953131515ddfcac32.zip |
PR11306 - Variadic template fix-it suggestion. Recover from misplaced or redundant ellipsis in parameter pack.
llvm-svn: 210304
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 53851929a0c..65ec44c5775 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -4661,19 +4661,6 @@ void Parser::ParseDeclaratorInternal(Declarator &D, } } -static void diagnoseMisplacedEllipsis(Parser &P, Declarator &D, - SourceLocation EllipsisLoc) { - if (EllipsisLoc.isValid()) { - FixItHint Insertion; - if (!D.getEllipsisLoc().isValid()) { - Insertion = FixItHint::CreateInsertion(D.getIdentifierLoc(), "..."); - D.setEllipsisLoc(EllipsisLoc); - } - P.Diag(EllipsisLoc, diag::err_misplaced_ellipsis_in_declaration) - << FixItHint::CreateRemoval(EllipsisLoc) << Insertion << !D.hasName(); - } -} - /// ParseDirectDeclarator /// direct-declarator: [C99 6.7.5] /// [C99] identifier @@ -4753,7 +4740,8 @@ void Parser::ParseDirectDeclarator(Declarator &D) { // The ellipsis was put in the wrong place. Recover, and explain to // the user what they should have done. ParseDeclarator(D); - diagnoseMisplacedEllipsis(*this, D, EllipsisLoc); + if (EllipsisLoc.isValid()) + DiagnoseMisplacedEllipsisInDeclarator(EllipsisLoc, D); return; } else D.setEllipsisLoc(EllipsisLoc); @@ -5004,7 +4992,7 @@ void Parser::ParseParenDeclarator(Declarator &D) { // An ellipsis cannot be placed outside parentheses. if (EllipsisLoc.isValid()) - diagnoseMisplacedEllipsis(*this, D, EllipsisLoc); + DiagnoseMisplacedEllipsisInDeclarator(EllipsisLoc, D); return; } |