[cfe-commits] r170058 - in /cfe/trunk: lib/Sema/SemaCast.cpp test/SemaObjC/warn-cast-of-sel-expr.m
Fariborz Jahanian
fjahanian at apple.com
Wed Dec 12 16:42:07 PST 2012
Author: fjahanian
Date: Wed Dec 12 18:42:06 2012
New Revision: 170058
URL: http://llvm.org/viewvc/llvm-project?rev=170058&view=rev
Log:
objc: DOn't complain if a (SEL) expression is typecast
to (SEL). Fixes // rdar://12859590
Modified:
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/test/SemaObjC/warn-cast-of-sel-expr.m
Modified: cfe/trunk/lib/Sema/SemaCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCast.cpp?rev=170058&r1=170057&r2=170058&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCast.cpp Wed Dec 12 18:42:06 2012
@@ -1479,6 +1479,8 @@
static void DiagnoseCastOfObjCSEL(Sema &Self, const ExprResult &SrcExpr,
QualType DestType) {
QualType SrcType = SrcExpr.get()->getType();
+ if (Self.Context.hasSameType(SrcType, DestType))
+ return;
if (const PointerType *SrcPtrTy = SrcType->getAs<PointerType>())
if (SrcPtrTy->isObjCSelType()) {
QualType DT = DestType;
Modified: cfe/trunk/test/SemaObjC/warn-cast-of-sel-expr.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/warn-cast-of-sel-expr.m?rev=170058&r1=170057&r2=170058&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/warn-cast-of-sel-expr.m (original)
+++ cfe/trunk/test/SemaObjC/warn-cast-of-sel-expr.m Wed Dec 12 18:42:06 2012
@@ -18,4 +18,7 @@
(void *const)s; // ok
(const void *const)s; // ok
+
+// rdar://12859590
+(SEL)sel_registerName("foo"); // ok
}
More information about the cfe-commits
mailing list