diff options
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 4 | ||||
| -rw-r--r-- | clang/test/SemaObjC/arc.m | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 2e459626468..37f7d267d97 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -2080,9 +2080,7 @@ bool Expr::isUnusedResultAWarning(const Expr *&WarnE, SourceLocation &Loc, if (Ctx.getLangOpts().ObjCAutoRefCount && ME->isInstanceMessage() && !ME->getType()->isVoidType() && - ME->getSelector().getIdentifierInfoForSlot(0) && - ME->getSelector().getIdentifierInfoForSlot(0) - ->getName().startswith("init")) { + ME->getMethodFamily() == OMF_init) { WarnE = this; Loc = getExprLoc(); R1 = ME->getSourceRange(); diff --git a/clang/test/SemaObjC/arc.m b/clang/test/SemaObjC/arc.m index 2646adce94f..76a97f3ab3b 100644 --- a/clang/test/SemaObjC/arc.m +++ b/clang/test/SemaObjC/arc.m @@ -84,14 +84,17 @@ void test1(A *a) { // rdar://8861761 @interface B --(id)alloc; ++ (id)alloc; - (id)initWithInt: (int) i; +- (id)myInit __attribute__((objc_method_family(init))); @end void rdar8861761() { B *o1 = [[B alloc] initWithInt:0]; B *o2 = [B alloc]; [o2 initWithInt:0]; // expected-warning {{expression result unused}} + B *o3 = [[B alloc] myInit]; + [[B alloc] myInit]; // expected-warning {{expression result unused}} } // rdar://8925835 |

