Frame.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //===--- Frame.h - Call frame for the VM and AST Walker ---------*- C++ -*-===//
  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. // Defines the base class of interpreter and evaluator stack frames.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_CLANG_AST_INTERP_FRAME_H
  13. #define LLVM_CLANG_AST_INTERP_FRAME_H
  14. #include "clang/Basic/SourceLocation.h"
  15. #include "llvm/Support/raw_ostream.h"
  16. namespace clang {
  17. class FunctionDecl;
  18. namespace interp {
  19. /// Base class for stack frames, shared between VM and walker.
  20. class Frame {
  21. public:
  22. virtual ~Frame();
  23. /// Generates a human-readable description of the call site.
  24. virtual void describe(llvm::raw_ostream &OS) = 0;
  25. /// Returns a pointer to the caller frame.
  26. virtual Frame *getCaller() const = 0;
  27. /// Returns the location of the call site.
  28. virtual SourceLocation getCallLocation() const = 0;
  29. /// Returns the called function's declaration.
  30. virtual const FunctionDecl *getCallee() const = 0;
  31. };
  32. } // namespace interp
  33. } // namespace clang
  34. #endif