[clang-tools-extra] r360336 - [clangd] Fix a TSAN warning in TUSchedulerTests

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Thu May 9 05:21:28 PDT 2019


Author: ibiryukov
Date: Thu May  9 05:21:28 2019
New Revision: 360336

URL: http://llvm.org/viewvc/llvm-project?rev=360336&view=rev
Log:
[clangd] Fix a TSAN warning in TUSchedulerTests

Modified:
    clang-tools-extra/trunk/clangd/unittests/TUSchedulerTests.cpp

Modified: clang-tools-extra/trunk/clangd/unittests/TUSchedulerTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/TUSchedulerTests.cpp?rev=360336&r1=360335&r2=360336&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/unittests/TUSchedulerTests.cpp (original)
+++ clang-tools-extra/trunk/clangd/unittests/TUSchedulerTests.cpp Thu May  9 05:21:28 2019
@@ -673,10 +673,14 @@ TEST_F(TUSchedulerTests, TUStatus) {
       AllStatus.push_back(Status);
     }
 
-    std::vector<TUStatus> AllStatus;
+    std::vector<TUStatus> allStatus() {
+      std::lock_guard<std::mutex> Lock(Mutex);
+      return AllStatus;
+    }
 
   private:
     std::mutex Mutex;
+    std::vector<TUStatus> AllStatus;
   } CaptureTUStatus;
   MockFSProvider FS;
   MockCompilationDatabase CDB;
@@ -693,7 +697,7 @@ TEST_F(TUSchedulerTests, TUStatus) {
 
   ASSERT_TRUE(Server.blockUntilIdleForTest());
 
-  EXPECT_THAT(CaptureTUStatus.AllStatus,
+  EXPECT_THAT(CaptureTUStatus.allStatus(),
               ElementsAre(
                   // Statuses of "Update" action.
                   TUState(TUAction::RunningAction, "Update"),




More information about the cfe-commits mailing list