[CodeGen] Fix assertion on referencing constexpr Obj-C object with ARC.
Failed assertion is > Assertion failed: ((ND->isUsed(false) || !isa<VarDecl>(ND) || !E->getLocation().isValid()) && "Should not use decl without marking it used!"), function EmitDeclRefLValue, file llvm-project/clang/lib/CodeGen/CGExpr.cpp, line 2437. `EmitDeclRefLValue` mentions > // A DeclRefExpr for a reference initialized by a constant expression can > // appear without being odr-used. Directly emit the constant initializer. The fix is to use the similar approach for non-references as for references. It is achieved by trying to emit a constant before we attempt to load non-odr-used variable as LValue. rdar://problem/40650504 Reviewers: ahatanak, rjmccall Reviewed By: rjmccall Subscribers: dexonsmith, erik.pilkington, cfe-commits Differential Revision: https://reviews.llvm.org/D53674 llvm-svn: 345903
Loading
Please sign in to comment