ROSE 0.11.145.192
Classes | Namespaces | Macros | Functions
sageGeneric.h File Reference

This file implements generic (template) sage query functions Currently this includes functions for: More...

#include <Cxx_GrammarVisitorSupport.h>
#include <type_traits>
#include <typeinfo>
#include <sstream>
Include dependency graph for sageGeneric.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sg::ConstLike< T1, T2 >
 projects the constness of T1 on T2 More...
 
struct  sg::ConstLike< const T1, T2 >
 
struct  sg::ConditionalEnable< conv >
 
struct  sg::ConditionalEnable< false >
 
struct  sg::EnableConversion< U, T >
 
struct  sg::NotNull< T >
 experimental class for returning non-null pointers More...
 
struct  sg::DispatchHandler< _ReturnType >
 struct DispatchHandler More...
 
struct  sg::VisitDispatcher< RoseVisitor >
 
struct  sg::DefaultHandler< SageNode >
 struct DefaultHandler More...
 
struct  sg::AncestorTypeFinder< AncestorNode, QualSgNode >
 helper class for _ancestor More...
 
struct  sg::TypeRecovery< SageNode >
 
struct  sg::DispatchHelper< GVisitor >
 
struct  sg::DefaultTraversalSuccessors
 

Namespaces

namespace  sg
 This namespace contains template functions that operate on the ROSE AST.
 

Macros

#define WITH_BINARY_NODES   0
 
#define WITH_UNTYPED_NODES   0
 
#define SG_UNEXPECTED_NODE(X)   (sg::unexpected_node(X, __FILE__, __LINE__))
 
#define SG_DEREF(X)   (sg::deref(X, __FILE__, __LINE__))
 
#define SG_ASSERT_TYPE(SAGENODE, N)   (sg::assert_sage_type<SAGENODE>(N, __FILE__, __LINE__))
 
#define SG_ERROR_IF(COND, MSG)   (sg::report_error_if(COND, MSG, __FILE__, __LINE__))
 
#define GEN_VISIT(X)    void visit(X * n) { rv.handle(*n); }
 

Functions

void sg::report_error (std::string desc, const char *file=nullptr, size_t ln=0)
 
void sg::unexpected_node (const SgNode &n, const char *file=nullptr, size_t ln=0)
 
template<class T >
T & sg::deref (T *ptr, const char *file=0, size_t ln=0)
 dereferences an object (= checked dereference in debug mode)
 
template<class T , class U , bool = EnableConversion<U*,T*>::value || EnableConversion<T*,U*>::value>
bool sg::operator< (NotNull< T > lhs, NotNull< U > rhs)
 
template<class RoseVisitor >
std::remove_const< typenamestd::remove_reference< RoseVisitor >::type >::type sg::_dispatch (RoseVisitor &&rv, SgNode *n)
 
template<class RoseVisitor >
std::remove_const< typenamestd::remove_reference< RoseVisitor >::type >::type sg::dispatch (RoseVisitor &&rv, SgNode *n)
 uncovers the type of SgNode and passes it to an function "handle" in RoseVisitor.
 
template<class RoseVisitor >
std::remove_const< typenamestd::remove_reference< RoseVisitor >::type >::type sg::dispatch (RoseVisitor &&rv, const SgNode *n)
 
template<class AncestorNode , class QualSgNode >
AncestorNode * sg::_ancestor (QualSgNode &n)
 implements the ancestor search
 
template<class AncestorNode >
AncestorNode * sg::ancestor (SgNode *n)
 finds an ancestor node with a given type
 
template<class AncestorNode >
const AncestorNode * sg::ancestor (const SgNode *n)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<class AncestorNode >
AncestorNode & sg::ancestor (SgNode &n)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<class AncestorNode >
const AncestorNode & sg::ancestor (const SgNode &n)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<class SageNode >
auto sg::ancestor_path (const SgNode &n) -> SageNode *
 
template<class SageNode , class... SageNodes>
auto sg::ancestor_path (const SgNode &n) -> decltype(ancestor_path< SageNodes... >(n))
 
template<class SageNode , class SageChild >
void sg::swap_child (SageNode &lhs, SageNode &rhs, SageChild *(SageNode::*getter)() const, void(SageNode::*setter)(SageChild *))
 swaps children (of equal kind) between two ancestor nodes of the same type
 
template<class SageParent , class SageChild >
void sg::linkParentChild (SageParent &parent, SageChild &child, void(SageParent::*setter)(SageChild *))
 
template<class SageNode >
SageNode * sg::assert_sage_type (SgNode *n, const char *f=0, size_t ln=0)
 asserts that n has type SageNode
 
template<class SageNode >
const SageNode * sg::assert_sage_type (const SgNode *n, const char *f=0, size_t ln=0)
 asserts that n has type SageNode
 
template<class SageNode >
SageNode & sg::assert_sage_type (SgNode &n, const char *f=0, size_t ln=0)
 asserts that n has type SageNode
 
template<class SageNode >
const SageNode & sg::assert_sage_type (const SgNode &n, const char *f=0, size_t ln=0)
 asserts that n has type SageNode
 
template<class SageNode >
auto sg::ancestorPath (const SgNode &n) -> SageNode *
 returns the last parent in an ancestor path
 
template<class SageNode , class... SageNodes>
auto sg::ancestorPath (const SgNode &n) -> decltype(ancestorPath< SageNodes... >(n))
 returns the last parent in an ancestor path
 
template<class SageNode >
SageNode::base_node_type & sg::asBaseType (SageNode &n)
 returns the same node n upcasted to its base type
 
template<class SageNode >
const SageNode::base_node_type & sg::asBaseType (const SageNode &n)
 returns the same node n upcasted to its base type
 
template<class SageNode >
SageNode::base_node_type * sg::asBaseType (SageNode *n)
 returns the same node n upcasted to its base type
 
template<class SageNode >
const SageNode::base_node_type * sg::asBaseType (const SageNode *n)
 returns the same node n upcasted to its base type
 

Detailed Description

This file implements generic (template) sage query functions Currently this includes functions for:

Definition in file sageGeneric.h.

Macro Definition Documentation

◆ WITH_BINARY_NODES

#define WITH_BINARY_NODES   0

Definition at line 22 of file sageGeneric.h.

◆ WITH_UNTYPED_NODES

#define WITH_UNTYPED_NODES   0

Definition at line 23 of file sageGeneric.h.

◆ SG_UNEXPECTED_NODE

#define SG_UNEXPECTED_NODE (   X)    (sg::unexpected_node(X, __FILE__, __LINE__))

Definition at line 30 of file sageGeneric.h.

◆ SG_DEREF

#define SG_DEREF (   X)    (sg::deref(X, __FILE__, __LINE__))

Definition at line 31 of file sageGeneric.h.

◆ SG_ASSERT_TYPE

#define SG_ASSERT_TYPE (   SAGENODE,
 
)    (sg::assert_sage_type<SAGENODE>(N, __FILE__, __LINE__))

Definition at line 32 of file sageGeneric.h.

◆ SG_ERROR_IF

#define SG_ERROR_IF (   COND,
  MSG 
)    (sg::report_error_if(COND, MSG, __FILE__, __LINE__))

Definition at line 33 of file sageGeneric.h.

◆ GEN_VISIT

#define GEN_VISIT (   X)     void visit(X * n) { rv.handle(*n); }

Definition at line 226 of file sageGeneric.h.