diff --git a/clang/lib/AST/ByteCode/InterpState.h b/clang/lib/AST/ByteCode/InterpState.h index 1814d273ec1c6..a13244bf383ae 100644 --- a/clang/lib/AST/ByteCode/InterpState.h +++ b/clang/lib/AST/ByteCode/InterpState.h @@ -68,6 +68,9 @@ class InterpState final : public State, public SourceMapper { return Parent.getEvalStatus(); } ASTContext &getASTContext() const override { return Ctx.getASTContext(); } + const LangOptions &getLangOpts() const { + return Ctx.getASTContext().getLangOpts(); + } // Forward status checks and updates to the walker. bool keepEvaluatingAfterFailure() const override { diff --git a/clang/lib/AST/ByteCode/State.cpp b/clang/lib/AST/ByteCode/State.cpp index dc3d0da7a4a46..323231fbf8236 100644 --- a/clang/lib/AST/ByteCode/State.cpp +++ b/clang/lib/AST/ByteCode/State.cpp @@ -112,10 +112,6 @@ OptionalDiagnostic State::diag(SourceLocation Loc, diag::kind DiagId, return OptionalDiagnostic(); } -const LangOptions &State::getLangOpts() const { - return getASTContext().getLangOpts(); -} - void State::addCallStack(unsigned Limit) { // Determine which calls to skip, if any. unsigned ActiveCalls = getCallStackDepth() - 1; diff --git a/clang/lib/AST/ByteCode/State.h b/clang/lib/AST/ByteCode/State.h index a834eed142de0..0695c61c07a05 100644 --- a/clang/lib/AST/ByteCode/State.h +++ b/clang/lib/AST/ByteCode/State.h @@ -151,8 +151,6 @@ class State { /// Directly reports a diagnostic message. DiagnosticBuilder report(SourceLocation Loc, diag::kind DiagId); - const LangOptions &getLangOpts() const; - /// Whether or not we're in a context where the front end requires a /// constant value. bool InConstantContext = false; diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 12e4e25bd29c4..81748c42c319b 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -945,6 +945,7 @@ namespace { } ASTContext &getASTContext() const override { return Ctx; } + const LangOptions &getLangOpts() const { return Ctx.getLangOpts(); } void setEvaluatingDecl(APValue::LValueBase Base, APValue &Value, EvaluatingDeclKind EDK = EvaluatingDeclKind::Ctor) {