[cfe-commits] r73495 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExprObjC.cpp
Fariborz Jahanian
fjahanian at apple.com
Tue Jun 16 09:25:00 PDT 2009
Author: fjahanian
Date: Tue Jun 16 11:25:00 2009
New Revision: 73495
URL: http://llvm.org/viewvc/llvm-project?rev=73495&view=rev
Log:
Implements -Wundeclared-selector for ObjC.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExprObjC.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=73495&r1=73494&r2=73495&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jun 16 11:25:00 2009
@@ -241,6 +241,9 @@
def warn_objc_property_attr_mutually_exclusive : Warning<
"property attributes '%0' and '%1' are mutually exclusive">,
InGroup<DiagGroup<"readonly-setter-attrs">>, DefaultIgnore;
+def warn_undeclared_selector : Warning<
+ "undeclared selector %0">,
+ InGroup<DiagGroup<"undeclared-selector">>, DefaultIgnore;
// C++ declarations
def err_static_assert_expression_is_not_constant : Error<
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=73495&r1=73494&r2=73495&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Tue Jun 16 11:25:00 2009
@@ -130,6 +130,14 @@
SourceLocation SelLoc,
SourceLocation LParenLoc,
SourceLocation RParenLoc) {
+ ObjCMethodDecl *Method = LookupInstanceMethodInGlobalPool(Sel,
+ SourceRange(LParenLoc, RParenLoc));
+ if (!Method)
+ Method = LookupFactoryMethodInGlobalPool(Sel,
+ SourceRange(LParenLoc, RParenLoc));
+ if (!Method)
+ Diag(SelLoc, diag::warn_undeclared_selector) << Sel;
+
QualType Ty = Context.getObjCSelType();
return new (Context) ObjCSelectorExpr(Ty, Sel, AtLoc, RParenLoc);
}
More information about the cfe-commits
mailing list