CppInterOp
C++ Language Interoperability Layer
Loading...
Searching...
No Matches
Classes | Functions | Variables
CppInterOp::Tracing Namespace Reference

Classes

struct  is_handle_vector
 Detect vector-of-handle types. More...
 
struct  is_handle_vector< std::vector< Cpp::DeclRef > >
 
struct  is_handle_vector< std::vector< Cpp::FuncRef > >
 
struct  is_pointer_vector
 Matches std::vector<T*> for any pointer element type. More...
 
struct  is_pointer_vector< std::vector< T * > >
 
struct  OutParam
 Marks a function parameter as an output container (e.g. More...
 
struct  ReproBuffer
 Internal helper to stringify arguments into a C++ call format. More...
 
struct  TraceData
 Holds all the data that is only needed when tracing is active. More...
 
class  TraceInfo
 
class  TraceRegion
 

Functions

void InitTracing ()
 Activate tracing.
 
static void WriteVersionComment (llvm::raw_ostream &OS, const std::string &Version)
 Helper: emit version info as comment lines.
 
static std::string GetCppInterOpLibPath ()
 dladdr-based path to libclangCppInterOp, used as the dispatch-mode fallback.
 
static void WriteBuildContext (llvm::raw_ostream &OS)
 Stream Cpp::GetBuildInfo() into the prologue as // comments.
 
static void WriteReproducerPrologue (llvm::raw_ostream &OS, llvm::StringRef Title, const std::string &Version, llvm::StringRef Footnote)
 Emit a prologue compilable in two modes selected by -D: default <CppInterOp/CppInterOp.h>, static-link -DCPPINTEROP_USE_DISPATCH <CppInterOp/Dispatch.h>, dlopen-based The dispatch path reads CPPINTEROP_LIBRARY_PATH and falls back to the dladdr-captured libclangCppInterOp path (when available).
 
std::string StartTracing (bool WriteOnStdErr=true)
 Begin recording a traced region.
 
void StopTracing (const std::string &Version="")
 End the traced region and write the reproducer file containing only the calls made between StartTracing() and this call.
 
template<typename Container >
OutParam MakeOutParam (const Container &C)
 Create an OutParam for any container.
 
template<typename T >
OutParam MakeOutParam (T *)
 Scalar pointer overload (e.g.
 

Variables

TraceInfoTheTraceInfo = nullptr
 Process-global tracer pointer.
 
template<typename T >
constexpr bool is_pointer_vector_v = is_pointer_vector<T>::value
 
template<typename T >
constexpr bool is_handle_v
 Detect opaque handle structs (Cpp::DeclRef, Cpp::TypeRef, etc.)
 
template<typename T >
constexpr bool is_handle_vector_v = is_handle_vector<T>::value
 

Function Documentation

◆ GetCppInterOpLibPath()

static std::string CppInterOp::Tracing::GetCppInterOpLibPath ( )
static

dladdr-based path to libclangCppInterOp, used as the dispatch-mode fallback.

Empty for statically-linked images (where dladdr returns the executable, not a real shared object) so the reproducer falls through to CPPINTEROP_LIBRARY_PATH.

Definition at line 103 of file Tracing.cpp.

References Cpp::GetVersion().

Referenced by WriteReproducerPrologue().

◆ InitTracing()

void CppInterOp::Tracing::InitTracing ( )

◆ MakeOutParam() [1/2]

template<typename Container >
OutParam CppInterOp::Tracing::MakeOutParam ( const Container &  C)

◆ MakeOutParam() [2/2]

template<typename T >
OutParam CppInterOp::Tracing::MakeOutParam ( T *  )

Scalar pointer overload (e.g.

bool* HadError). Rendered as nullptr at the call site – replay only needs the call sequence.

Definition at line 300 of file Tracing.h.

References CppInterOp::Tracing::OutParam::IsScalarPointer.

◆ StartTracing()

std::string CppInterOp::Tracing::StartTracing ( bool  WriteOnStdErr = true)
inline

Begin recording a traced region.

If tracing is not yet active, activates it. Returns the path where StopTracing() will write the reproducer.

Parameters
WriteOnStdErrif true, also emit the reproducer to stderr on stop.

Definition at line 226 of file Tracing.h.

References InitTracing(), CppInterOp::Tracing::TraceInfo::StartRegion(), and TheTraceInfo.

◆ StopTracing()

void CppInterOp::Tracing::StopTracing ( const std::string &  Version = "")
inline

End the traced region and write the reproducer file containing only the calls made between StartTracing() and this call.

Definition at line 234 of file Tracing.h.

References CppInterOp::Tracing::TraceInfo::StopRegion(), and TheTraceInfo.

◆ WriteBuildContext()

static void CppInterOp::Tracing::WriteBuildContext ( llvm::raw_ostream &  OS)
static

Stream Cpp::GetBuildInfo() into the prologue as // comments.

Definition at line 118 of file Tracing.cpp.

References Cpp::GetBuildInfo().

Referenced by WriteReproducerPrologue().

◆ WriteReproducerPrologue()

static void CppInterOp::Tracing::WriteReproducerPrologue ( llvm::raw_ostream &  OS,
llvm::StringRef  Title,
const std::string &  Version,
llvm::StringRef  Footnote 
)
static

Emit a prologue compilable in two modes selected by -D: default <CppInterOp/CppInterOp.h>, static-link -DCPPINTEROP_USE_DISPATCH <CppInterOp/Dispatch.h>, dlopen-based The dispatch path reads CPPINTEROP_LIBRARY_PATH and falls back to the dladdr-captured libclangCppInterOp path (when available).

Definition at line 137 of file Tracing.cpp.

References GetCppInterOpLibPath(), WriteBuildContext(), and WriteVersionComment().

Referenced by CppInterOp::Tracing::TraceInfo::StopRegion(), and CppInterOp::Tracing::TraceInfo::writeToFile().

◆ WriteVersionComment()

static void CppInterOp::Tracing::WriteVersionComment ( llvm::raw_ostream &  OS,
const std::string &  Version 
)
static

Helper: emit version info as comment lines.

Definition at line 88 of file Tracing.cpp.

Referenced by WriteReproducerPrologue().

Variable Documentation

◆ is_handle_v

template<typename T >
constexpr bool CppInterOp::Tracing::is_handle_v
inlineconstexpr
Initial value:
=
std::is_same_v<T, Cpp::DeclRef> || std::is_same_v<T, Cpp::TypeRef> ||
std::is_same_v<T, Cpp::FuncRef> || std::is_same_v<T, Cpp::ObjectRef> ||
std::is_same_v<T, Cpp::InterpRef> || std::is_same_v<T, Cpp::ConstDeclRef> ||
std::is_same_v<T, Cpp::ConstTypeRef> ||
std::is_same_v<T, Cpp::ConstFuncRef>

Detect opaque handle structs (Cpp::DeclRef, Cpp::TypeRef, etc.)

Definition at line 496 of file Tracing.h.

◆ is_handle_vector_v

template<typename T >
constexpr bool CppInterOp::Tracing::is_handle_vector_v = is_handle_vector<T>::value
inlineconstexpr

Definition at line 510 of file Tracing.h.

◆ is_pointer_vector_v

template<typename T >
constexpr bool CppInterOp::Tracing::is_pointer_vector_v = is_pointer_vector<T>::value
inlineconstexpr

Definition at line 492 of file Tracing.h.

◆ TheTraceInfo

TraceInfo * CppInterOp::Tracing::TheTraceInfo = nullptr