diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-09-17 23:09:59 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-09-17 23:09:59 +0000 |
commit | 03ebd3b4af9e4ab8e14a3f136d8a28df463f54ec (patch) | |
tree | 9ecc40c5f3a7766fd4e48ed30e8e1a29a2311654 /lib/Parse/ParseObjc.cpp | |
parent | 9d8c9d345a41b782943fd84fe20e9ebd3c568c5d (diff) |
objective-C: improve on warnings about misplacement of method
argument names. // rdar://12263549
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164077 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 48c5efac6b..d321baf836 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -1032,7 +1032,6 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, Scope::FunctionPrototypeScope|Scope::DeclScope); AttributePool allParamAttrs(AttrFactory); - bool warnSelectorName = false; while (1) { ParsedAttributes paramAttrs(AttrFactory); Sema::ObjCArgInfo ArgInfo; @@ -1103,11 +1102,12 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, SelIdent = ParseObjCSelectorPiece(selLoc); if (!SelIdent && Tok.isNot(tok::colon)) break; - if (MethodDefinition && !SelIdent) { + if (!SelIdent) { SourceLocation ColonLoc = Tok.getLocation(); if (PP.getLocForEndOfToken(ArgInfo.NameLoc) == ColonLoc) { - warnSelectorName = true; - Diag(ArgInfo.NameLoc, diag::missing_selector_name); + Diag(ArgInfo.NameLoc, diag::warn_missing_selector_name) << ArgInfo.Name; + Diag(ArgInfo.NameLoc, diag::note_missing_selector_name) << ArgInfo.Name; + Diag(ColonLoc, diag::note_force_empty_selector_name) << ArgInfo.Name; } } // We have a selector or a colon, continue parsing. @@ -1150,22 +1150,6 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, Selector Sel = PP.getSelectorTable().getSelector(KeyIdents.size(), &KeyIdents[0]); - if (warnSelectorName) { - SmallVector<IdentifierInfo *, 12> DiagKeyIdents; - for (unsigned i = 0, size = KeyIdents.size(); i < size; i++) - if (KeyIdents[i]) - DiagKeyIdents.push_back(KeyIdents[i]); - else { - std::string name = "Name"; - name += llvm::utostr(i+1); - IdentifierInfo *NamedMissingId = &PP.getIdentifierTable().get(name); - DiagKeyIdents.push_back(NamedMissingId); - } - Selector NewSel = - PP.getSelectorTable().getSelector(DiagKeyIdents.size(), &DiagKeyIdents[0]); - Diag(mLoc, diag::note_missing_argument_name) - << NewSel.getAsString() << Sel.getAsString(); - } Decl *Result = Actions.ActOnMethodDeclaration(getCurScope(), mLoc, Tok.getLocation(), mType, DSRet, ReturnType, |