[clang] 268f0d4 - [ASTMatchers] Simplify isDefaultedHelper (NFC) (#137571)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 27 21:50:48 PDT 2025
Author: Kazu Hirata
Date: 2025-04-27T21:50:45-07:00
New Revision: 268f0d4ebe47d73c361f8f2bce051d58994a33bc
URL: https://github.com/llvm/llvm-project/commit/268f0d4ebe47d73c361f8f2bce051d58994a33bc
DIFF: https://github.com/llvm/llvm-project/commit/268f0d4ebe47d73c361f8f2bce051d58994a33bc.diff
LOG: [ASTMatchers] Simplify isDefaultedHelper (NFC) (#137571)
We can use "constexpt if" to combine the two variants of functions.
---------
Co-authored-by: Jakub Kuderski <kubakuderski at gmail.com>
Added:
Modified:
clang/include/clang/ASTMatchers/ASTMatchersInternal.h
Removed:
################################################################################
diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
index 8290645768aa9..71dfc49b7fcca 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -871,14 +871,11 @@ IteratorT matchesFirstInPointerRange(const MatcherT &Matcher, IteratorT Start,
return End;
}
-template <typename T, std::enable_if_t<!std::is_base_of<FunctionDecl, T>::value>
- * = nullptr>
-inline bool isDefaultedHelper(const T *) {
+template <typename T> inline bool isDefaultedHelper(const T *FD) {
+ if constexpr (std::is_base_of_v<FunctionDecl, T>)
+ return FD->isDefaulted();
return false;
}
-inline bool isDefaultedHelper(const FunctionDecl *FD) {
- return FD->isDefaulted();
-}
// Metafunction to determine if type T has a member called getDecl.
template <typename T>
More information about the cfe-commits
mailing list