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