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: unassignedclangb...@nondot.org
Reporter: lebedev...@gmail.com
CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs