File tree Expand file tree Collapse file tree 4 files changed +44
-0
lines changed Expand file tree Collapse file tree 4 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ AST_MATCHER(FunctionDecl, hasOtherDeclarations) {
41
41
void UseConstraintsCheck::registerMatchers (MatchFinder *Finder) {
42
42
Finder->addMatcher (
43
43
functionTemplateDecl (
44
+ // Skip external libraries included as system headers
45
+ unless (isExpansionInSystemHeader ()),
44
46
has (functionDecl (unless (hasOtherDeclarations ()), isDefinition (),
45
47
hasReturnTypeLoc (typeLoc ().bind (" return" )))
46
48
.bind (" function" )))
@@ -57,6 +59,8 @@ matchEnableIfSpecializationImplTypename(TypeLoc TheType) {
57
59
return std::nullopt;
58
60
}
59
61
TheType = Dep.getQualifierLoc ().getTypeLoc ();
62
+ if (TheType.isNull ())
63
+ return std::nullopt;
60
64
}
61
65
62
66
if (const auto SpecializationLoc =
Original file line number Diff line number Diff line change @@ -322,6 +322,10 @@ Changes in existing checks
322
322
don't remove parentheses used in ``sizeof `` calls when they have array index
323
323
accesses as arguments.
324
324
325
+ - Improved :doc: `modernize-use-constraints
326
+ <clang-tidy/checks/modernize/use-constraints>` check by fixing a crash that
327
+ occurred in some scenarios and excluding system headers from analysis.
328
+
325
329
- Improved :doc: `modernize-use-nullptr
326
330
<clang-tidy/checks/modernize/use-nullptr>` check to include support for C23,
327
331
which also has introduced the ``nullptr `` keyword.
Original file line number Diff line number Diff line change @@ -68,3 +68,7 @@ The tool will replace the above code with,
68
68
// The tool will not emit a diagnostic or attempt to replace the code.
69
69
template <typename T, std::enable_if_t<T::some_trait, int> = 0>
70
70
struct my_class {};
71
+
72
+ .. note ::
73
+
74
+ System headers are not analyzed by this check.
Original file line number Diff line number Diff line change @@ -724,3 +724,35 @@ void not_last_param() {
724
724
}
725
725
726
726
} // namespace enable_if_trailing_type_parameter
727
+
728
+
729
+ // Issue fixes:
730
+
731
+ namespace PR91872 {
732
+
733
+ enum expression_template_option { value1, value2 };
734
+
735
+ template <typename T> struct number_category {
736
+ static const int value = 0 ;
737
+ };
738
+
739
+ constexpr int number_kind_complex = 1 ;
740
+
741
+ template <typename T, expression_template_option ExpressionTemplates>
742
+ struct number {
743
+ using type = T;
744
+ };
745
+
746
+ template <typename T> struct component_type {
747
+ using type = T;
748
+ };
749
+
750
+ template <class T , expression_template_option ExpressionTemplates>
751
+ inline typename std::enable_if<
752
+ number_category<T>::value == number_kind_complex,
753
+ component_type<number<T, ExpressionTemplates>>>::type::type
754
+ abs (const number<T, ExpressionTemplates> &v) {
755
+ return {};
756
+ }
757
+
758
+ }
You can’t perform that action at this time.
0 commit comments