Closed EmmetZC closed 8 years ago
To modify the pointee type of a pointer type in Clang, I believe you need to reconstruct the type "from scratch." This can be a little tricky, but getPointerType
is probably the place to start: http://clang.llvm.org/doxygen/classclang_1_1ASTContext.html#a3574cad49cba0fc48ab7b4c953e7e31e
Got it. I was hoping there might be an easier way besides "unwrapping the type and then wrapping it again". XD
Anyway, thanks a lot for giving me the hint, getPointType()
, which does help!
Hi, sampsyo.
I want to implement an annotation which does not ensure Pointer Invariance and allows un-annotated pointers to be infected by annotated pointer, as the code shows below:
To achieve this, I need to change the PointeeType of the LHS of BinAssginExpr
a = p
in functionvoid VisitBinAssign(BinaryOperator *E)
, which I don't know how.So, do you have any ideas about how to modify the
PointeeType
of anExpr
?Emmet