[clang-tools-extra] r337601 - [clangd] Fix racy use-after-scope in unittest
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 20 11:45:25 PDT 2018
Author: d0k
Date: Fri Jul 20 11:45:25 2018
New Revision: 337601
URL: http://llvm.org/viewvc/llvm-project?rev=337601&view=rev
Log:
[clangd] Fix racy use-after-scope in unittest
This only shows up with asan when the stars align in a bad way.
Modified:
clang-tools-extra/trunk/unittests/clangd/TUSchedulerTests.cpp
Modified: clang-tools-extra/trunk/unittests/clangd/TUSchedulerTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/TUSchedulerTests.cpp?rev=337601&r1=337600&r2=337601&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/TUSchedulerTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/TUSchedulerTests.cpp Fri Jul 20 11:45:25 2018
@@ -251,6 +251,7 @@ TEST_F(TUSchedulerTests, ManyUpdates) {
}
TEST_F(TUSchedulerTests, EvictedAST) {
+ std::atomic<int> BuiltASTCounter(0);
ASTRetentionPolicy Policy;
Policy.MaxRetainedASTs = 2;
TUScheduler S(
@@ -267,8 +268,6 @@ TEST_F(TUSchedulerTests, EvictedAST) {
auto Bar = testPath("bar.cpp");
auto Baz = testPath("baz.cpp");
- std::atomic<int> BuiltASTCounter;
- BuiltASTCounter = false;
// Build one file in advance. We will not access it later, so it will be the
// one that the cache will evict.
S.update(Foo, getInputs(Foo, SourceContents), WantDiagnostics::Yes,
More information about the cfe-commits
mailing list