Skip to content

Commit bf5909a

Browse files
kazutakahiratakuhar
authored andcommitted
[ASTMatchers] Simplify isDefaultedHelper (NFC) (llvm#137571)
We can use "constexpt if" to combine the two variants of functions. --------- Co-authored-by: Jakub Kuderski <[email protected]>
1 parent 9768f68 commit bf5909a

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_v<FunctionDecl, T>)
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)