Skip to content

Commit

Permalink
Add 'isPODType' AST matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
hach-que committed Jun 23, 2024
1 parent 477e6e2 commit 03ed76f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions clang/include/clang/ASTMatchers/ASTMatchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -4131,6 +4131,23 @@ AST_POLYMORPHIC_MATCHER_P(
return Inner.matches(source->getTypeLoc(), Finder, Builder);
}

/// Matches if the matched type is a Plain Old Data (POD) type.
///
/// Given
/// \code
/// class Y
/// {
/// public:
/// int a;
/// std::string b;
/// };
/// \endcode
/// fieldDecl(hasType(qualType(isPODType())))
/// matches Y::a
AST_MATCHER(QualType, isPODType) {
return Node.isPODType(Finder->getASTContext());
}

/// Matches if the matched type is represented by the given string.
///
/// Given
Expand Down
1 change: 1 addition & 0 deletions clang/lib/ASTMatchers/Dynamic/Registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ RegistryMaps::RegistryMaps() {
REGISTER_MATCHER(hasTypeLoc);
REGISTER_MATCHER(hasUnaryOperand);
REGISTER_MATCHER(hasUnarySelector);
REGISTER_MATCHER(isPODType);
REGISTER_MATCHER(hasUnderlyingDecl);
REGISTER_MATCHER(hasUnderlyingType);
REGISTER_MATCHER(hasUnqualifiedDesugaredType);
Expand Down

0 comments on commit 03ed76f

Please sign in to comment.