Hi,
I’m working on a clang-tidy checker, and I want to be able to evaluate a static condition on a class I’m matching, do you know if that’s possible?
I have a templated integral_constant<bool, my_condition>, and I want to know the value for a given T. In more accurate details, here’s the code:
In the application code:
typedef std::integral_constant<bool, sizeof(MyCondition(
static_cast<const T*>(0))) ==
sizeof(char)>
my_great_condition;
In the clang checker:
bool IsTypeWithMyCondition(const clang::QualType &type,
const MatchFinder::MatchResult &result) {
return !ast_matchers::match(
qualType(
hasUnqualifiedDesugaredType(recordType(hasDeclaration(
cxxRecordDecl(isDerivedFrom(“::MyBaseClass”))))))
.bind(“type”),
type, *result.Context)
.empty();
}
I would like to additionally match that my_great_condition evaluates to true. Do you know how I can achieve that?
Thanks,