Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check pointer to pointer type in LLVM

Tags:

c++

llvm

clang

How to check an operand is pointer to pointer type in LLVM? We can check is operand pointer or not, but how to check is it pointing to a pointer? I am using Clang to generate intermediate code and using C++ for source file.

like image 260
neel Avatar asked Oct 14 '12 05:10

neel


1 Answers

You can invoke Type::getContainedType(int) to get access to the pointee type. So it should look like this:

bool isPointerToPointer(const Value* V) {
    const Type* T = V->getType();
    return T->isPointerTy() && T->getContainedType(0)->isPointerTy();
}
like image 95
Oak Avatar answered Sep 30 '22 06:09

Oak