teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.
The change LGTM but the test could just be a unit test instead of doing the
whole compile->start->attach->expr command cycle.
You can just add this to the `TestClangASTContext.cpp` to test the (nested)
desugaring and the three types you covered (and one of the switch statements).
static QualType makeConstInt(clang::ASTContext &ctxt) {
QualType result(ctxt.IntTy);
result.addConst();
return result;
}
TEST_F(TestClangASTContext, TestGetTypeClassDeclType) {
clang::ASTContext &ctxt = *m_ast->getASTContext();
auto *nullptr_expr = new (ctxt) CXXNullPtrLiteralExpr(ctxt.NullPtrTy,
SourceLocation());
QualType t = ctxt.getDecltypeType(nullptr_expr, makeConstInt(ctxt));
EXPECT_EQ(lldb::eTypeClassBuiltin, m_ast->GetTypeClass(t.getAsOpaquePtr()));
}
TEST_F(TestClangASTContext, TestGetTypeClassTypeOf) {
clang::ASTContext &ctxt = *m_ast->getASTContext();
QualType t = ctxt.getTypeOfType(makeConstInt(ctxt));
EXPECT_EQ(lldb::eTypeClassBuiltin, m_ast->GetTypeClass(t.getAsOpaquePtr()));
}
TEST_F(TestClangASTContext, TestGetTypeClassTypeOfExpr) {
clang::ASTContext &ctxt = *m_ast->getASTContext();
auto *nullptr_expr = new (ctxt) CXXNullPtrLiteralExpr(ctxt.NullPtrTy,
SourceLocation());
QualType t = ctxt.getTypeOfExprType(nullptr_expr);
EXPECT_EQ(lldb::eTypeClassBuiltin, m_ast->GetTypeClass(t.getAsOpaquePtr()));
}
TEST_F(TestClangASTContext, TestGetTypeClassNested) {
clang::ASTContext &ctxt = *m_ast->getASTContext();
QualType t_base = ctxt.getTypeOfType(makeConstInt(ctxt));
QualType t = ctxt.getTypeOfType(t_base);
EXPECT_EQ(lldb::eTypeClassBuiltin, m_ast->GetTypeClass(t.getAsOpaquePtr()));
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71405/new/
https://reviews.llvm.org/D71405
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits