Go to the documentation of this file.
13 #ifndef LLVM_CLANG_AST_INTERP_SOURCE_H
14 #define LLVM_CLANG_AST_INTERP_SOURCE_H
18 #include "llvm/Support/Endian.h"
35 assert(Ptr !=
nullptr && RHS.Ptr !=
nullptr &&
"Invalid code pointer");
40 assert(Ptr !=
nullptr &&
"Invalid code pointer");
47 template <
typename T> std::enable_if_t<!std::is_pointer<T>::value, T>
read() {
48 using namespace llvm::support;
49 T
Value = endian::read<T, endianness::native, 1>(Ptr);
56 CodePtr(
const char *Ptr) : Ptr(Ptr) {}
76 const Expr *asExpr()
const;
78 operator bool()
const {
return !Source.isNull(); }
81 llvm::PointerUnion<const Decl *, const Stmt *> Source;
84 using SourceMap = std::vector<std::pair<unsigned, SourceInfo>>;
CodePtr operator-(size_t RHS) const
Encodes a location in the source.
int32_t operator-(const CodePtr &RHS) const
SourceInfo(const Decl *D)
Describes the statement/declaration an opcode was generated from.
const Stmt * asStmt() const
bool operator!=(const CodePtr &RHS) const
const Decl * asDecl() const
std::enable_if_t<!std::is_pointer< T >::value, T > read()
Reads data and advances the pointer.
Decl - This represents one declaration (or definition), e.g.
std::vector< std::pair< unsigned, SourceInfo > > SourceMap
Pointer into the code segment.
Stmt - This represents one statement.
SourceInfo(const Stmt *E)
This represents one expression.
CodePtr & operator+=(int32_t Offset)
Interface for classes which map locations to sources.