[clang] [clang-tools-extra] [llvm] [clang] WIP: Improved Context Declaration tracking (PR #107942)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 10 08:04:48 PDT 2024
================
@@ -19998,9 +20054,9 @@ bool Sema::DiagIfReachable(SourceLocation Loc, ArrayRef<const Stmt *> Stmts,
// static data member is not syntactically a constant evaluated constant,
// but nonetheless is always required to be a constant expression, so we
// can skip diagnosing.
- // FIXME: Using the mangling context here is a hack.
- if (auto *VD = dyn_cast_or_null<VarDecl>(
- ExprEvalContexts.back().ManglingContextDecl)) {
+ if (auto ContextDecl = currentEvaluationContext().ContextDecl;
+ auto *VD =
+ dyn_cast_or_null<VarDecl>(ContextDecl ? *ContextDecl : nullptr)) {
----------------
zyn0217 wrote:
dyn_cast_if_present, if we have to touch it anyway :)
https://github.com/llvm/llvm-project/pull/107942
More information about the cfe-commits
mailing list