[PATCH] D70729: Workaround for EvalInfo ctor for MSVC 2017
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 26 10:21:50 PST 2019
yaxunl created this revision.
yaxunl added reviewers: rjmccall, hliao.
Current EvalInfo ctor causes EnableNewConstInterp to be true even though
it is supposed to be false on MSVC 2017. This is because a virtual function
getLangOpts() is called in member initializer lists, whereas on MSVC
member ctors are called before function virtual function pointers are
initialized.
https://docs.microsoft.com/en-us/cpp/cpp/constructors-cpp?view=vs-2019#order_of_construction
This patch fixes that.
https://reviews.llvm.org/D70729
Files:
clang/lib/AST/ExprConstant.cpp
Index: clang/lib/AST/ExprConstant.cpp
===================================================================
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -921,10 +921,10 @@
EvalInfo(const ASTContext &C, Expr::EvalStatus &S, EvaluationMode Mode)
: Ctx(const_cast<ASTContext &>(C)), EvalStatus(S), CurrentCall(nullptr),
CallStackDepth(0), NextCallIndex(1),
- StepsLeft(getLangOpts().ConstexprStepLimit),
- ForceNewConstInterp(getLangOpts().ForceNewConstInterp),
+ StepsLeft(C.getLangOpts().ConstexprStepLimit),
+ ForceNewConstInterp(C.getLangOpts().ForceNewConstInterp),
EnableNewConstInterp(ForceNewConstInterp ||
- getLangOpts().EnableNewConstInterp),
+ C.getLangOpts().EnableNewConstInterp),
BottomFrame(*this, SourceLocation(), nullptr, nullptr, nullptr),
EvaluatingDecl((const ValueDecl *)nullptr),
EvaluatingDeclValue(nullptr), HasActiveDiagnostic(false),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70729.231098.patch
Type: text/x-patch
Size: 1050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191126/c8a84deb/attachment.bin>
More information about the cfe-commits
mailing list