summaryrefslogtreecommitdiffstats
path: root/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-10-24 13:29:21 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-10-24 13:29:21 +0000
commit967c079082473b3b351656d8cc124354bcd56de8 (patch)
tree336e07fca3e63c5603cbfedda7bc857b7981b177 /clang/lib/ASTMatchers/ASTMatchersInternal.cpp
parent79f1590ef4ef0ead6e54a04f5013c707a38b187d (diff)
downloadbcm5719-llvm-967c079082473b3b351656d8cc124354bcd56de8.tar.gz
bcm5719-llvm-967c079082473b3b351656d8cc124354bcd56de8.zip
ASTMatchers: Peel off a layer of indirection from true matcher. NFC.
llvm-svn: 220560
Diffstat (limited to 'clang/lib/ASTMatchers/ASTMatchersInternal.cpp')
-rw-r--r--clang/lib/ASTMatchers/ASTMatchersInternal.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
index c0052bd8977..06ec76753bd 100644
--- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -71,17 +71,15 @@ class IdDynMatcher : public DynMatcherInterface {
/// We only ever need one instance of this matcher, so we create a global one
/// and reuse it to reduce the overhead of the matcher and increase the chance
/// of cache hits.
-struct TrueMatcherImpl {
- TrueMatcherImpl() : Instance(new Impl) {}
- const IntrusiveRefCntPtr<DynMatcherInterface> Instance;
-
- class Impl : public DynMatcherInterface {
- public:
- bool dynMatches(const ast_type_traits::DynTypedNode &, ASTMatchFinder *,
- BoundNodesTreeBuilder *) const override {
- return true;
- }
- };
+class TrueMatcherImpl : public DynMatcherInterface {
+public:
+ TrueMatcherImpl() {
+ Retain(); // Reference count will never become zero.
+ }
+ bool dynMatches(const ast_type_traits::DynTypedNode &, ASTMatchFinder *,
+ BoundNodesTreeBuilder *) const override {
+ return true;
+ }
};
static llvm::ManagedStatic<TrueMatcherImpl> TrueMatcherInstance;
@@ -107,7 +105,7 @@ DynTypedMatcher DynTypedMatcher::constructVariadic(
DynTypedMatcher DynTypedMatcher::trueMatcher(
ast_type_traits::ASTNodeKind NodeKind) {
- return DynTypedMatcher(NodeKind, NodeKind, TrueMatcherInstance->Instance);
+ return DynTypedMatcher(NodeKind, NodeKind, &*TrueMatcherInstance);
}
DynTypedMatcher DynTypedMatcher::dynCastTo(
OpenPOWER on IntegriCloud