1 #ifndef ROSE_RTIHELPERS_H
2 #define ROSE_RTIHELPERS_H
10 #include <boost/lexical_cast.hpp>
17 #include <valgrind/valgrind.h>
18 #include <valgrind/memcheck.h>
20 static void doUninitializedFieldCheck(
const char* fieldName,
void* fieldPointer,
size_t fieldSize,
void* wholeObject,
const char* className) {
21 if (VALGRIND_CHECK_READABLE(fieldPointer, fieldSize)) {
22 fprintf(stderr,
"Warning: uninitialized field p_%s of object %p of class %s\n", fieldName, wholeObject, className);
29 std::ostringstream ss;
36 std::ostringstream ss;
38 for (
typename std::vector<T>::const_iterator i = x.begin(); i != x.end(); ++i) {
if (i != x.begin()) ss <<
", "; ss << (*i);}
46 std::ostringstream ss;
48 for (
typename std::vector<std::pair<T,T> >::const_iterator i = x.begin(); i != x.end(); ++i) {
if (i != x.begin()) ss <<
", "; ss << i->first <<
"->" << i->second;}
55 std::ostringstream ss;
60 ss << i->first <<
"->" << i->second;
70 std::ostringstream ss;
73 printf (
"Warning: SgSharedVector iterator support is not finished! \n");
83 std::ostringstream ss;
85 for (std::vector<bool>::const_iterator i = x.begin(); i != x.end(); ++i) {
if (i != x.begin()) ss <<
", "; ss << (*i ?
"T" :
"F");}
92 std::ostringstream ss;
94 for (
typename std::list<T>::const_iterator i = x.begin(); i != x.end(); ++i) {
if (i != x.begin()) ss <<
", "; ss << (*i);}
101 std::ostringstream ss;
103 for (
typename std::set<T>::const_iterator i = x.begin(); i != x.end(); ++i) {
if (i != x.begin()) ss <<
", "; ss << (*i);}
108 template <
typename K,
typename V>
110 std::ostringstream ss;
112 for (
typename std::map<K, V>::const_iterator i = x.begin(); i != x.end(); ++i) {
if (i != x.begin()) ss <<
", "; ss << i->first <<
"->" <<
toStringForRTI(i->second);}
118 template <
typename K>
119 static std::string
toStringForRTI(
const std::map<K, std::set<PreprocessingInfo*> >& x) {
120 std::ostringstream ss;
122 for (
typename std::map<K, std::set<PreprocessingInfo*> >::const_iterator i = x.begin(); i != x.end(); ++i) {
if (i != x.begin()) ss <<
", "; ss << i->first <<
"->" <<
toStringForRTI(i->second);}
128 template <
typename K,
typename V>
130 std::ostringstream ss;
132 for (
typename std::multimap<K, V>::const_iterator i = x.begin(); i != x.end(); ++i) {
if (i != x.begin()) ss <<
", "; ss << i->first <<
"->" << i->second;}
138 static std::string
toStringForRTI(
const std::map<std::pair<
int,std::pair<int,int> >, uint64_t > & x) {
139 std::ostringstream ss;
148 static std::string
toStringForRTI(
const std::map<uint64_t ,std::pair<
int,std::pair<int,int> > > & x) {
149 std::ostringstream ss;
162 #ifdef ROSE_USING_GRAPH_IR_NODES_FOR_BACKWARD_COMPATABILITY
166 std::ostringstream ss;
176 std::ostringstream ss;
185 std::ostringstream ss;
194 std::ostringstream ss;
203 std::ostringstream ss;
212 std::ostringstream ss;
221 static std::string
toStringForRTI(
const rose_undirected_graph_hash_multimap & x)
223 std::ostringstream ss;
233 static std::string
toStringForRTI(
const rose_directed_graph_hash_multimap & x)
235 std::ostringstream ss;
243 #ifdef ROSE_USING_GRAPH_IR_NODES_FOR_BACKWARD_COMPATABILITY
248 std::ostringstream ss;
260 static std::string
toStringForRTI(
const std::map<int, SgGraphNode*> & x)
262 std::ostringstream ss;
265 for (std::map<int, SgGraphNode*>::const_iterator i = x.begin(); i != x.end(); ++i) {
if (i != x.begin()) ss <<
", "; ss << i->first <<
"->" << i->second;}
275 static std::string
toStringForRTI(
const rose_undirected_graph_hash_multimap & x)
277 std::ostringstream ss;
329 std::ostringstream os;
330 os <<
" ( " << x.
x <<
", " << x.
y <<
", " << x.
z <<
" ) ";
337 template <
typename Sym>
338 static std::string toStringForRTISymbol(Sym* sym) {
339 std::ostringstream ss;
342 ss <<
": varsym " << sym->get_name().str() <<
" declared at 0x" << std::hex << (sym->get_declaration());
352 static std::string
toStringForRTI(
const SgSymbolHashBase::iterator&) {
return "<no output operator defined for this type>";}
355 void doRTI(
const char* fieldNameBase,
void* fieldPtr,
size_t fieldSize,
void* thisPtr,
const char* className,
const char* typeString,
const char* fieldName,
const std::string& fieldContents,
RTIMemberData& memberData);
357 #endif // ROSE_RTIHELPERS_H