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