this is a bugfix for this
added a constant copy of argument to CallStackFrame.
and use it in describeCall instead of the modifiable version od arguments.
added test for the diagnostic
Paths
| Differential D60561
[clang] fixing diagnostics of constexpr callstack AbandonedPublic Authored by Tyker on Apr 11 2019, 4:17 AM.
Details
Diff Detail Event Timeline• Quuxplusone added inline comments.
Comment Actions @Quuxplusone edited based of feedback i simplified the test but didn't put the original because this one test arguments for variable and literal and there may be corner case differences Comment Actions This seems liable to be moderately expensive, especially for large argument values, and it's a cost that is unnecessary in the common case where evaluation succeeds. I wonder if we'd be better off speculatively trying the entire evaluation without storing any such values, and rerunning the evaluation to collect diagnostics only when we find that evaluation would fail (and we're in a context where the caller actually wants the diagnostics). Comment Actions @rsmith i don't think collecting theses values is expansive compared to evaluating the expression. Comment Actions
To help make an informed decision you can grab a big TU (I usually use SemaDecl.cpp or all of Boost) and then run -fsyntax-only on it. With a tool like perf stat you can get pretty good results. Comment Actions the impact was much higher than i expected, around 1% slower in average on 50 compilation of SemaDecl with -fsyntax-only. Comment Actions
Good to know, thanks for doing the measurement ! Comment Actions i changed the way arguments are stored. to make it more controllable.
Revision Contents
Diff 195056 clang/lib/AST/ExprConstant.cpp
clang/test/SemaCXX/constant-expression-cxx1y.cpp
|
Please don't use a typedef for this. Follow the style of the surrounding lines.
(The pointer member itself should not be const-qualified. Compare to const LValue *This; two declarations above.)