我正在使用 clang 3.8.1 libtooling 库。我已经为 C++ 自动类型编写了访问者。当我尝试获取推导类型时,我得到 NULL-TYPE。
有人遇到过类似的问题吗?请告诉我铿锵的自动类型扣除,因为它让我无处可去。
示例代码:
bool ASTPrinter::VisitAutoTypeLoc(AutoTypeLoc TL) {
std::string deducedTypeSig = TL.getType().getAsString();
if (TL.getTypePtr()->isDeduced()) {
deducedTypeSig = TL.getTypePtr()->getDeducedType().getAsString();
}
}