[PATCH] D53674: [CodeGen] Fix assertion on referencing constexpr Obj-C object with ARC.
Volodymyr Sapsai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 24 14:43:11 PDT 2018
vsapsai created this revision.
vsapsai added reviewers: ahatanak, rjmccall.
Herald added a subscriber: dexonsmith.
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 in using the similar approach for non-references of
non-odr-used variables. `EmitScalarExpr` will try to emit constant if
possible and we can use resulting `llvm::Value *` without performing
`EmitLValue`.
rdar://problem/40650504
https://reviews.llvm.org/D53674
Files:
clang/lib/CodeGen/CGObjC.cpp
clang/test/CodeGenObjCXX/arc-constexpr.mm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53674.170990.patch
Type: text/x-patch
Size: 5567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181024/f8209d88/attachment.bin>
More information about the cfe-commits
mailing list