aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2015-09-15 23:17:17 +0000
committerNico Weber <nicolasweber@gmx.de>2015-09-15 23:17:17 +0000
commit9677562c8f31459cac6ed15e4036eb19dfdb8d3d (patch)
tree69b3df96568c1ceb4f3315d3e7d6cf918e61e1fc /clang/lib/AST/ExprConstant.cpp
parent6864cbced6756129e9aff63e7c41938de3bd1a29 (diff)
downloadllvm-9677562c8f31459cac6ed15e4036eb19dfdb8d3d.zip
llvm-9677562c8f31459cac6ed15e4036eb19dfdb8d3d.tar.gz
llvm-9677562c8f31459cac6ed15e4036eb19dfdb8d3d.tar.bz2
Don't crash when passing &@selector to a _Nonnull parameter. Fixes PR24774.
The root cause here is that ObjCSelectorExpr is an rvalue, yet it can have its address taken. That's kind of awkward, but fixing this is awkward in other ways, see https://llvm.org/bugs/show_bug.cgi?id=24774#c16 . For now, just fix the crash. llvm-svn: 247740
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 5eaf40e..2fb8c9c 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -4557,12 +4557,13 @@ public:
} // end anonymous namespace
/// Evaluate an expression as an lvalue. This can be legitimately called on
-/// expressions which are not glvalues, in two cases:
+/// expressions which are not glvalues, in three cases:
/// * function designators in C, and
/// * "extern void" objects
+/// * @selector() expressions in Objective-C
static bool EvaluateLValue(const Expr *E, LValue &Result, EvalInfo &Info) {
assert(E->isGLValue() || E->getType()->isFunctionType() ||
- E->getType()->isVoidType());
+ E->getType()->isVoidType() || isa<ObjCSelectorExpr>(E));
return LValueExprEvaluator(Info, Result).Visit(E);
}