Skip to content

Commit 1f4e0a2

Browse files
[ASTMatchers] Simplify isDefaultedHelper (NFC)
We can use "constexpt if" to combine the two variants of functions.
1 parent a129ca7 commit 1f4e0a2

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

clang/include/clang/ASTMatchers/ASTMatchersInternal.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -871,14 +871,11 @@ IteratorT matchesFirstInPointerRange(const MatcherT &Matcher, IteratorT Start,
871871
return End;
872872
}
873873

874-
template <typename T, std::enable_if_t<!std::is_base_of<FunctionDecl, T>::value>
875-
* = nullptr>
876-
inline bool isDefaultedHelper(const T *) {
874+
template <typename T> inline bool isDefaultedHelper(const T *FD) {
875+
if constexpr (std::is_base_of<FunctionDecl, T>::value)
876+
return FD->isDefaulted();
877877
return false;
878878
}
879-
inline bool isDefaultedHelper(const FunctionDecl *FD) {
880-
return FD->isDefaulted();
881-
}
882879

883880
// Metafunction to determine if type T has a member called getDecl.
884881
template <typename T>

0 commit comments

Comments
 (0)