[clang] cd62604 - Revert "ManagedStatic: remove from ASTMatchersInternal.h"

Nicolai Hähnle via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 27 06:46:57 PDT 2022


Author: Nicolai Hähnle
Date: 2022-07-27T15:46:21+02:00
New Revision: cd62604d19aea56d79a919e799d899b0636bd6b4

URL: https://github.com/llvm/llvm-project/commit/cd62604d19aea56d79a919e799d899b0636bd6b4
DIFF: https://github.com/llvm/llvm-project/commit/cd62604d19aea56d79a919e799d899b0636bd6b4.diff

LOG: Revert "ManagedStatic: remove from ASTMatchersInternal.h"

This reverts commit 7132bcdc428d79258901af0156ace240952b6745.

It is the likely cause of a clang-tools-extra test regression. Reverting
until I can investigate what's going on.

Added: 
    

Modified: 
    clang/include/clang/ASTMatchers/ASTMatchersInternal.h
    clang/lib/ASTMatchers/ASTMatchersInternal.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
index 6ee82321723e4..49de9a458c3db 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -59,6 +59,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/iterator.h"
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Regex.h"
 #include <algorithm>
 #include <cassert>
@@ -1930,8 +1931,8 @@ template <typename Matcher, Matcher (*Func)()> class MemoizedMatcher {
 
 public:
   static const Matcher &getInstance() {
-    static Wrapper Instance;
-    return Instance.M;
+    static llvm::ManagedStatic<Wrapper> Instance;
+    return Instance->M;
   }
 };
 

diff  --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
index f3c9f6d468f5c..4c438f9e4879f 100644
--- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -28,6 +28,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Regex.h"
 #include "llvm/Support/WithColor.h"
 #include "llvm/Support/raw_ostream.h"


        


More information about the cfe-commits mailing list