Better $cquery/vars

This commit is contained in:
Fangrui Song 2018-01-20 23:30:25 -08:00
parent bf7ffb3c9d
commit e4d4c7b139

View File

@ -56,17 +56,30 @@ ClangType ClangType::get_canonical() const {
} }
ClangType ClangType::strip_qualifiers() const { ClangType ClangType::strip_qualifiers() const {
// CXRefQualifierKind qualifiers = clang_Type_getCXXRefQualifier(cx_type) CXType cx = cx_type;
switch (cx_type.kind) { while (1) {
switch (cx.kind) {
default:
break;
case CXType_ConstantArray:
case CXType_DependentSizedArray:
case CXType_IncompleteArray:
case CXType_VariableArray:
cx = clang_getElementType(cx);
continue;
case CXType_BlockPointer:
case CXType_LValueReference: case CXType_LValueReference:
case CXType_MemberPointer:
case CXType_ObjCObjectPointer:
case CXType_Pointer: case CXType_Pointer:
case CXType_RValueReference: case CXType_RValueReference:
return clang_getPointeeType(cx_type); cx = clang_getPointeeType(cx);
default: continue;
}
break; break;
} }
return cx_type; return cx;
} }
std::string ClangType::get_spelling() const { std::string ClangType::get_spelling() const {