[LLVMdev] How To Get The Name of the type the popinter is pointing to

Óscar Fuentes ofv at wanadoo.es
Thu Sep 20 19:12:09 PDT 2012

amitjai <amitjaiswal.knit at gmail.com> writes:

> I want to know the type of pointer .
> for example 
> if we have 
> int *p,
> struct node *w
> char *q
> then i want int for p,char for q , struct node for w.

Is your question related to Clang? If yes, you'll better ask on Clang's
mailing list ( cfe-dev, see http://clang.llvm.org/ )

If your question is about LLVM, let's suppose `v' is a pointer to a
llvm::Value instance or one of its derivatives, then

llvm::outs() << *v << '\n';

will print on the console a reprentation of the Value, including its
Type, while

llvm::outs() << *v->getType() << '\n';

will print a representation of its Type.


More information about the llvm-dev mailing list