[cfe-dev] How to determine what memory locations a variable points to?

fzb behrang.farnaz at gmail.com
Wed Dec 10 20:22:47 PST 2014


I'm writing some checkers using Clang and as part of my work I need to know
what memory locations a variable points to. For example for this code I'm
wondering if there is any way I could know that variable out in main
function points to "point"?

class foo {
    char* x;
  public:
    foo (char*);
    char* getx () {return x;}
};

foo::foo (char* a) {
  x = a;
}

int main () {
  char *c = "point";
  foo f(c);
  char* out = f.getx();
  return 0;
}



--
View this message in context: http://clang-developers.42468.n3.nabble.com/How-to-determine-what-memory-locations-a-variable-points-to-tp4042871.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list