aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-06-17 21:45:48 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-06-17 21:45:48 +0000
commit949bd4b611f4be575d63da36c94c3662dfa4d459 (patch)
tree57538350139f61594d43a7ab5f06d28a0f1d3736 /lib
parent0c05a1bae9e8a57f56663991d0442a69df34a003 (diff)
Do not treat @selector as lvalue (unlike g++).
Patch by Nico Weber (pr7390). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106242 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/Expr.cpp1
-rw-r--r--lib/Sema/SemaExpr.cpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 1d715b004d..e36ae41ce4 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -1194,7 +1194,6 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const {
case ObjCIsaExprClass:
case StringLiteralClass: // C99 6.5.1p4
case ObjCEncodeExprClass: // @encode behaves like its string in every way.
- case ObjCSelectorExprClass: // @selector
return LV_Valid;
case ArraySubscriptExprClass: // C99 6.5.3p4 (e1[e2] == (*((e1)+(e2))))
// For vectors, make sure base is an lvalue (i.e. not a function call).
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index ae56018b99..fa403c78d0 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -6060,6 +6060,8 @@ QualType Sema::CheckAddressOfOperand(Expr *op, SourceLocation OpLoc) {
<< op->getType() << op->getSourceRange();
if (isSFINAEContext())
return QualType();
+ } else if (isa<ObjCSelectorExpr>(op)) {
+ return Context.getPointerType(op->getType());
} else if (lval != Expr::LV_Valid && lval != Expr::LV_IncompleteVoidType) {
// C99 6.5.3.2p1
// The operand must be either an l-value or a function designator