aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseObjc.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-09-11 21:27:45 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-09-11 21:27:45 +0000
commit10d65cd8c8974d71ade0f926ab0578fc7dc325e9 (patch)
tree7e4e41a8e3e9636c4ebe374d647b754d05235fac /lib/Parse/ParseObjc.cpp
parente9f1f234932e80bb83be9b094e163ca4c47a3086 (diff)
objective-C: warn if selector has nothing but bare
':' in its name. // rdar://8366823 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163650 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r--lib/Parse/ParseObjc.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 6d5f35a799..2bcb7a786a 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1032,6 +1032,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
AttributePool allParamAttrs(AttrFactory);
bool warnSelectorName = false;
+ bool warnHasNoName = true;
while (1) {
ParsedAttributes paramAttrs(AttrFactory);
Sema::ObjCArgInfo ArgInfo;
@@ -1109,7 +1110,8 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
Diag(Tok, diag::warn_missing_argument_name); // missing argument name.
warnSelectorName = true;
}
-
+ else
+ warnHasNoName = false;
// We have a selector or a colon, continue parsing.
}
@@ -1150,8 +1152,11 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
Selector Sel = PP.getSelectorTable().getSelector(KeyIdents.size(),
&KeyIdents[0]);
- if (warnSelectorName)
+ if (warnSelectorName) {
+ if (warnHasNoName)
+ Diag(mLoc, diag::warn_selector_with_bare_colon);
Diag(mLoc, diag::note_missing_argument_name) << Sel.getAsString();
+ }
Decl *Result
= Actions.ActOnMethodDeclaration(getCurScope(), mLoc, Tok.getLocation(),