[clang] [clang] In Sema use new parentEvaluationContext function (PR #93338)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Sat May 25 23:55:23 PDT 2024


================
@@ -5153,6 +5153,12 @@ class Sema final : public SemaBase {
     return ExprEvalContexts.back();
   };
 
+  ExpressionEvaluationContextRecord &parentEvaluationContext() {
+    assert(ExprEvalContexts.size() >= 2 &&
+           "Must be in an expression evaluation context");
+    return ExprEvalContexts[ExprEvalContexts.size() - 2];
+  };
+
   const ExpressionEvaluationContextRecord &parentEvaluationContext() const {
----------------
Endilll wrote:

You should implement const overload in terms of non-const overload you just added via `const_cast` on `this` to avoid duplication.

https://github.com/llvm/llvm-project/pull/93338


More information about the cfe-commits mailing list