diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 11 | ||||
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 10 |
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 7072443829..c01097e363 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -5023,15 +5023,8 @@ QualType Sema::CheckIndirectionOperand(Expr *Op, SourceLocation OpLoc) { if (const PointerType *PT = Ty->getAs<PointerType>()) return PT->getPointeeType(); - if (const ObjCObjectPointerType *OPT = Ty->getAsObjCObjectPointerType()) { - QualType PTy = OPT->getPointeeType(); - if (LangOpts.ObjCNonFragileABI && PTy->isObjCInterfaceType()) { - Diag(OpLoc, diag::err_indirection_requires_nonfragile_object) - << Ty << Op->getSourceRange(); - return QualType(); - } - return PTy; - } + if (const ObjCObjectPointerType *OPT = Ty->getAsObjCObjectPointerType()) + return OPT->getPointeeType(); Diag(OpLoc, diag::err_typecheck_indirection_requires_pointer) << Ty << Op->getSourceRange(); diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index ae59aec565..76113107ba 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -26,7 +26,15 @@ using namespace clang; Sema::OwningStmtResult Sema::ActOnExprStmt(FullExprArg expr) { Expr *E = expr->takeAs<Expr>(); assert(E && "ActOnExprStmt(): missing expression"); - + if (E->getType()->isObjCInterfaceType()) { + if (LangOpts.ObjCNonFragileABI) + Diag(E->getLocEnd(), diag::err_indirection_requires_nonfragile_object) + << E->getType(); + else + Diag(E->getLocEnd(), diag::err_direct_interface_unsupported) + << E->getType(); + return StmtError(); + } // C99 6.8.3p2: The expression in an expression statement is evaluated as a // void expression for its side effects. Conversion to void allows any // operand, even incomplete types. |