Author: Akira Hatanaka Date: 2022-11-15T14:41:28-08:00 New Revision: 063a43b4fd9f869d57c20145302eb41068bfb54e
URL: https://github.com/llvm/llvm-project/commit/063a43b4fd9f869d57c20145302eb41068bfb54e DIFF: https://github.com/llvm/llvm-project/commit/063a43b4fd9f869d57c20145302eb41068bfb54e.diff LOG: [ObjC] Fix an assertion failure in EvaluateLValue Look through parentheses when determining whether the expression is a @selector expression. Added: Modified: clang/lib/AST/ExprConstant.cpp clang/test/SemaObjCXX/sel-address.mm Removed: ################################################################################ diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 34e75723b3f30..e17df5da5cb2d 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -8228,7 +8228,7 @@ static bool EvaluateLValue(const Expr *E, LValue &Result, EvalInfo &Info, bool InvalidBaseOK) { assert(!E->isValueDependent()); assert(E->isGLValue() || E->getType()->isFunctionType() || - E->getType()->isVoidType() || isa<ObjCSelectorExpr>(E)); + E->getType()->isVoidType() || isa<ObjCSelectorExpr>(E->IgnoreParens())); return LValueExprEvaluator(Info, Result, InvalidBaseOK).Visit(E); } diff --git a/clang/test/SemaObjCXX/sel-address.mm b/clang/test/SemaObjCXX/sel-address.mm index a1209abd4e687..e5661af341691 100644 --- a/clang/test/SemaObjCXX/sel-address.mm +++ b/clang/test/SemaObjCXX/sel-address.mm @@ -15,5 +15,6 @@ void h() { // Shouldn't crash. g(&@selector(foo)); + g(&(@selector(foo))); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits