summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-09-03 00:43:07 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-09-03 00:43:07 +0000
commitf15d4b6050a96c3261ceeda7aacdb4a2168de0ab (patch)
treed8240f03f4fced45920bd6bbf2bb930db7cfeafb /clang/lib/Sema
parentef3cf2a576d5e31ca5bb39a664e092496b6ed082 (diff)
downloadbcm5719-llvm-f15d4b6050a96c3261ceeda7aacdb4a2168de0ab.tar.gz
bcm5719-llvm-f15d4b6050a96c3261ceeda7aacdb4a2168de0ab.zip
This patch does the following.
1) Issue digsnostics in non-fragile ABI, when an expression evaluates to an interface type (except when it is used to access a non-fragile ivar). 2) Issue unsupported error in fragile ABI when an expression evaluates to an interface type (except when it is used to access a fragile ivar). llvm-svn: 80860
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp11
-rw-r--r--clang/lib/Sema/SemaStmt.cpp10
2 files changed, 11 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 7072443829a..c01097e363c 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/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/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index ae59aec5658..76113107ba8 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud