[clang] [clang][NFC] Mark some ASTMatchers constructors constexpr. (PR #223903)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 15 20:55:50 PDT 2026
https://github.com/efriedma-quic updated https://github.com/llvm/llvm-project/pull/223903
>From 3eb0723985a3fa374e21b268e034afc7288efd9a Mon Sep 17 00:00:00 2001
From: Eli Friedman <efriedma at qti.qualcomm.com>
Date: Tue, 15 Sep 2026 19:45:35 -0700
Subject: [PATCH 1/2] [clang][NFC] Mark some ASTMatchers constructors
constexpr.
Suppresses a bunch of -Wglobal-constructors warnings in
ASTMatchersInternal.cpp .
---
clang/include/clang/ASTMatchers/ASTMatchersInternal.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
index cb12d10d628b6..efb3c4c334b4c 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -1307,7 +1307,7 @@ class VariadicDynCastAllOfMatcher
: public VariadicFunction<BindableMatcher<SourceT>, Matcher<TargetT>,
makeDynCastAllOfComposite<SourceT, TargetT>> {
public:
- VariadicDynCastAllOfMatcher() {}
+ constexpr VariadicDynCastAllOfMatcher() {}
};
/// A \c VariadicAllOfMatcher<T> object is a variadic functor that takes
@@ -1325,7 +1325,7 @@ class VariadicAllOfMatcher
: public VariadicFunction<BindableMatcher<T>, Matcher<T>,
makeAllOfComposite<T>> {
public:
- VariadicAllOfMatcher() {}
+ constexpr VariadicAllOfMatcher() {}
};
/// VariadicOperatorMatcher related types.
@@ -1886,7 +1886,7 @@ class TypeTraversePolymorphicMatcher {
struct Func
: public VariadicFunction<Self, Matcher<InnerTBase>, &Self::create> {
- Func() {}
+ constexpr Func() {}
};
private:
>From f7bf54047d9e044c9383ee94f9cfc4ec9cfc74da Mon Sep 17 00:00:00 2001
From: Eli Friedman <efriedma at qti.qualcomm.com>
Date: Tue, 15 Sep 2026 20:55:24 -0700
Subject: [PATCH 2/2] Delete dead variable.
---
clang/unittests/AST/ASTImporterGenericRedeclTest.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/clang/unittests/AST/ASTImporterGenericRedeclTest.cpp b/clang/unittests/AST/ASTImporterGenericRedeclTest.cpp
index 24e7fb6373f7f..d069252a5055b 100644
--- a/clang/unittests/AST/ASTImporterGenericRedeclTest.cpp
+++ b/clang/unittests/AST/ASTImporterGenericRedeclTest.cpp
@@ -130,8 +130,6 @@ struct ClassTemplateSpec {
}
};
-const internal::VariadicDynCastAllOfMatcher<Decl, VarTemplateDecl>
- varTemplateDecl;
const internal::VariadicDynCastAllOfMatcher<Decl, VarTemplateSpecializationDecl>
varTemplateSpecializationDecl;
More information about the cfe-commits
mailing list