xref: /freebsd-src/contrib/llvm-project/clang/lib/AST/Interp/Frame.h (revision a7dea1671b87c07d2d266f836bfa8b58efc7c134)
1*a7dea167SDimitry Andric //===--- Frame.h - Call frame for the VM and AST Walker ---------*- C++ -*-===//
2*a7dea167SDimitry Andric //
3*a7dea167SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*a7dea167SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*a7dea167SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*a7dea167SDimitry Andric //
7*a7dea167SDimitry Andric //===----------------------------------------------------------------------===//
8*a7dea167SDimitry Andric //
9*a7dea167SDimitry Andric // Defines the base class of interpreter and evaluator stack frames.
10*a7dea167SDimitry Andric //
11*a7dea167SDimitry Andric //===----------------------------------------------------------------------===//
12*a7dea167SDimitry Andric 
13*a7dea167SDimitry Andric #ifndef LLVM_CLANG_AST_INTERP_FRAME_H
14*a7dea167SDimitry Andric #define LLVM_CLANG_AST_INTERP_FRAME_H
15*a7dea167SDimitry Andric 
16*a7dea167SDimitry Andric #include "clang/Basic/SourceLocation.h"
17*a7dea167SDimitry Andric #include "llvm/Support/raw_ostream.h"
18*a7dea167SDimitry Andric 
19*a7dea167SDimitry Andric namespace clang {
20*a7dea167SDimitry Andric class FunctionDecl;
21*a7dea167SDimitry Andric 
22*a7dea167SDimitry Andric namespace interp {
23*a7dea167SDimitry Andric 
24*a7dea167SDimitry Andric /// Base class for stack frames, shared between VM and walker.
25*a7dea167SDimitry Andric class Frame {
26*a7dea167SDimitry Andric public:
27*a7dea167SDimitry Andric   virtual ~Frame();
28*a7dea167SDimitry Andric 
29*a7dea167SDimitry Andric   /// Generates a human-readable description of the call site.
30*a7dea167SDimitry Andric   virtual void describe(llvm::raw_ostream &OS) = 0;
31*a7dea167SDimitry Andric 
32*a7dea167SDimitry Andric   /// Returns a pointer to the caller frame.
33*a7dea167SDimitry Andric   virtual Frame *getCaller() const = 0;
34*a7dea167SDimitry Andric 
35*a7dea167SDimitry Andric   /// Returns the location of the call site.
36*a7dea167SDimitry Andric   virtual SourceLocation getCallLocation() const = 0;
37*a7dea167SDimitry Andric 
38*a7dea167SDimitry Andric   /// Returns the called function's declaration.
39*a7dea167SDimitry Andric   virtual const FunctionDecl *getCallee() const = 0;
40*a7dea167SDimitry Andric };
41*a7dea167SDimitry Andric 
42*a7dea167SDimitry Andric } // namespace interp
43*a7dea167SDimitry Andric } // namespace clang
44*a7dea167SDimitry Andric 
45*a7dea167SDimitry Andric #endif
46