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