diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-01-27 01:30:16 +0000 | 
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-01-27 01:30:16 +0000 | 
| commit | dff0be70ba808e68562d9150e02d74179cbb7b26 (patch) | |
| tree | 8a09e3a7df1e98328807f96bceb9dc75978989bc /clang/lib | |
| parent | 9864b5ec5f3553a4f66fa7448e88c228b7b2404f (diff) | |
| download | bcm5719-llvm-dff0be70ba808e68562d9150e02d74179cbb7b26.tar.gz bcm5719-llvm-dff0be70ba808e68562d9150e02d74179cbb7b26.zip | |
Cope with parenthesized function declarators when emitting a
diagnostic about ref-qualifiers where they do not belong.
llvm-svn: 124344
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaType.cpp | 12 | 
1 files changed, 10 insertions, 2 deletions
| diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 64d5c428f3d..9e1d067fda8 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1901,8 +1901,16 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S,        if (FnTy->getRefQualifier()) {          if (D.isFunctionDeclarator()) { -          SourceLocation Loc -            = D.getTypeObject(D.getNumTypeObjects()-1).Fun.getRefQualifierLoc(); +          SourceLocation Loc = D.getIdentifierLoc(); +          for (unsigned I = 0, N = D.getNumTypeObjects(); I != N; ++I) { +            const DeclaratorChunk &Chunk = D.getTypeObject(N-I-1); +            if (Chunk.Kind == DeclaratorChunk::Function && +                Chunk.Fun.hasRefQualifier()) { +              Loc = Chunk.Fun.getRefQualifierLoc(); +              break; +            } +          } +            Diag(Loc, diag::err_invalid_ref_qualifier_function_type)              << (FnTy->getRefQualifier() == RQ_LValue)              << FixItHint::CreateRemoval(Loc); | 

