[llvm-bugs] [Bug 38166] New: AST should explain the implicitness of the casts better
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jul 13 16:20:26 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38166
Bug ID: 38166
Summary: AST should explain the implicitness of the casts
better
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: lebedev.ri at gmail.com
CC: llvm-bugs at lists.llvm.org
Related to #38017.
We can't actually distinguish whether the implicit cast is implicit in source
code, or is part of explicit cast.
We can't use ASTContext::getParents() (partly performance, partly semantics).
But we also sometimes don't visit the ExplicitCastExpr.
<zygoloid> CodeGenFunction::EmitMaterializeTemporaryExpr calls
skipRValueSubobjectAdjustments, which steps over the CK_NoOp cast
<zygoloid> OK, so we could fix that, or we could add some state to the CastExpr
so you can tell whether it's an "implicitly doing bad things" cast kind
<zygoloid> or maybe a CastKind; we could use CK_UncheckedIntegralCast for
"integral cast where the user explicitly asked for it" versus CK_IntegralCast
for "integral cast that was performed implicitly"
<zygoloid> i don't think "is part of explicit cast" is quite right; given
"struct X { X(char); }", X(some_int) should still be checked
<zygoloid> but perhaps "enum E : char {}; E(some_int)" is more borderline
<LebedevRI> which solution does sound best to you? the ast one, or something
involving skipRValueSubobjectAdjustments() ? /me needs to know how to title the
bug
<zygoloid> I think it makes sense to make skipRValueSubobjectAdjustments skip
the minimum amount of stuff necessary to get to the expression constructing the
temporary
<zygoloid> but I'd be OK with having a new cast kind for this, because in the
generalized Clang model (including UBSan) the cast has different semantics
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180713/aed82fc7/attachment.html>
More information about the llvm-bugs
mailing list