1//=== SemaProxy.cpp - Sema proxy for effectual constant evaluation --------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements a proxy to the Sema class that can be provided to the
10// constant evaluator, thereby facilitating evaluations capable of acting on and
11// querying the AST.
12//
13//===----------------------------------------------------------------------===//
14
15#include "clang/Sema/SemaProxy.h"
16#include "clang/AST/Decl.h"
17#include "clang/Sema/Sema.h"
18
19namespace clang {
20namespace sema {
21
22void EvalProxy::instantiateFunctionDefinition(
23 SourceLocation PointOfInstantiation, FunctionDecl *Function) {
24 // If the function is a specialization of a member function template which has
25 // been declared a friend by another class, 'Function' might be a Decl marked
26 // as an explicit specialization. Walking to the most recent Decl seems to
27 // find a node that is understood to be implicitly instantiable.
28 Function = Function->getMostRecentDecl();
29
30 SemaRef.InstantiateFunctionDefinition(
31 PointOfInstantiation, Function, /*Recursive=*/true,
32 /*DefinitionRequired=*/true, /*AtEndOfTU=*/false);
33}
34
35} // namespace sema
36} // namespace clang
37