我在VisitBinaryOperator()Clang 的覆盖方法中有以下代码:
Expr* lhs = E->getLHS();
Expr* rhs = E->getRHS();
lhs我想从表达式和中提取整数变量名称及其值rhs。
假设我有,x = 10;那么我想从中x获取标识符。
如果我有, 那么我想从中获取标识符并作为子表达式lhs10rhsx = x + 10;xlhsx + 10rhs
同样对于类型,: int identifier当我转储lhs类型时我会得到这个
QualType type_lhs = lhs->getType();
type_lhs->dump();
如何为 clang 做到这一点?