003 File Manager
Current Path:
/usr/src/contrib/llvm-project/clang/lib/AST/Interp
usr
/
src
/
contrib
/
llvm-project
/
clang
/
lib
/
AST
/
Interp
/
📁
..
📄
Boolean.h
(4.12 KB)
📄
ByteCodeEmitter.cpp
(5.38 KB)
📄
ByteCodeEmitter.h
(3.13 KB)
📄
ByteCodeExprGen.cpp
(16.6 KB)
📄
ByteCodeExprGen.h
(10.2 KB)
📄
ByteCodeGenError.cpp
(483 B)
📄
ByteCodeGenError.h
(1.36 KB)
📄
ByteCodeStmtGen.cpp
(7.21 KB)
📄
ByteCodeStmtGen.h
(2.39 KB)
📄
Context.cpp
(3.28 KB)
📄
Context.h
(2.39 KB)
📄
Descriptor.cpp
(10.31 KB)
📄
Descriptor.h
(7.82 KB)
📄
Disasm.cpp
(1.95 KB)
📄
EvalEmitter.cpp
(7.6 KB)
📄
EvalEmitter.h
(3.7 KB)
📄
Frame.cpp
(464 B)
📄
Frame.h
(1.28 KB)
📄
Function.cpp
(1.73 KB)
📄
Function.h
(4.91 KB)
📄
Integral.h
(8.38 KB)
📄
Interp.cpp
(11.54 KB)
📄
Interp.h
(30.64 KB)
📄
InterpBlock.cpp
(1.91 KB)
📄
InterpBlock.h
(4.11 KB)
📄
InterpFrame.cpp
(5.32 KB)
📄
InterpFrame.h
(4.54 KB)
📄
InterpStack.cpp
(1.81 KB)
📄
InterpStack.h
(3.43 KB)
📄
InterpState.cpp
(2.03 KB)
📄
InterpState.h
(3.29 KB)
📄
Opcode.h
(817 B)
📄
Opcodes.td
(11.02 KB)
📄
Pointer.cpp
(4.97 KB)
📄
Pointer.h
(11.08 KB)
📄
PrimType.cpp
(648 B)
📄
PrimType.h
(4.66 KB)
📄
Program.cpp
(11.29 KB)
📄
Program.h
(6.66 KB)
📄
Record.cpp
(1.54 KB)
📄
Record.h
(3.76 KB)
📄
Source.cpp
(1.15 KB)
📄
Source.h
(3.25 KB)
📄
State.cpp
(5.34 KB)
📄
State.h
(4.01 KB)
Editing: Source.h
//===--- Source.h - Source location provider for the VM --------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Defines a program which organises and links multiple bytecode functions. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_AST_INTERP_SOURCE_H #define LLVM_CLANG_AST_INTERP_SOURCE_H #include "clang/AST/Decl.h" #include "clang/AST/Stmt.h" #include "llvm/Support/Endian.h" namespace clang { namespace interp { class Function; /// Pointer into the code segment. class CodePtr { public: CodePtr() : Ptr(nullptr) {} CodePtr &operator+=(int32_t Offset) { Ptr += Offset; return *this; } int32_t operator-(const CodePtr &RHS) const { assert(Ptr != nullptr && RHS.Ptr != nullptr && "Invalid code pointer"); return Ptr - RHS.Ptr; } CodePtr operator-(size_t RHS) const { assert(Ptr != nullptr && "Invalid code pointer"); return CodePtr(Ptr - RHS); } bool operator!=(const CodePtr &RHS) const { return Ptr != RHS.Ptr; } /// Reads data and advances the pointer. template <typename T> T read() { T Value = ReadHelper<T>(Ptr); Ptr += sizeof(T); return Value; } private: /// Constructor used by Function to generate pointers. CodePtr(const char *Ptr) : Ptr(Ptr) {} /// Helper to decode a value or a pointer. template <typename T> static std::enable_if_t<!std::is_pointer<T>::value, T> ReadHelper(const char *Ptr) { using namespace llvm::support; return endian::read<T, endianness::native, 1>(Ptr); } template <typename T> static std::enable_if_t<std::is_pointer<T>::value, T> ReadHelper(const char *Ptr) { using namespace llvm::support; auto Punned = endian::read<uintptr_t, endianness::native, 1>(Ptr); return reinterpret_cast<T>(Punned); } private: friend class Function; /// Pointer into the code owned by a function. const char *Ptr; }; /// Describes the statement/declaration an opcode was generated from. class SourceInfo { public: SourceInfo() {} SourceInfo(const Stmt *E) : Source(E) {} SourceInfo(const Decl *D) : Source(D) {} SourceLocation getLoc() const; const Stmt *asStmt() const { return Source.dyn_cast<const Stmt *>(); } const Decl *asDecl() const { return Source.dyn_cast<const Decl *>(); } const Expr *asExpr() const; operator bool() const { return !Source.isNull(); } private: llvm::PointerUnion<const Decl *, const Stmt *> Source; }; using SourceMap = std::vector<std::pair<unsigned, SourceInfo>>; /// Interface for classes which map locations to sources. class SourceMapper { public: virtual ~SourceMapper() {} /// Returns source information for a given PC in a function. virtual SourceInfo getSource(Function *F, CodePtr PC) const = 0; /// Returns the expression if an opcode belongs to one, null otherwise. const Expr *getExpr(Function *F, CodePtr PC) const; /// Returns the location from which an opcode originates. SourceLocation getLocation(Function *F, CodePtr PC) const; }; } // namespace interp } // namespace clang #endif
Upload File
Create Folder