[PATCH] Change llvm::sys::Mutex implementation to use STL-provided mutexes.

Aaron Ballman aaron at aaronballman.com
Thu May 29 14:34:13 PDT 2014


I am definitely in favor of this goal, presuming all of our supported
systems implements a sane <mutex>.

FWIW, I tested with MSVC 2012 Update 4 and MSVC 2013 Update 2, and
both compile cleanly. However, I am getting some test cases failing
that do not fail on ToT for me. All LLVM tests pass with both MSVCs,
but Clang tests are not all passing.

57>  Running the Clang regression tests
57>  -- Testing: 7263 tests, 32 threads --
57>  FAIL: Clang :: Index/TestClassDecl.m (3190 of 7263)
57>  ******************** TEST 'Clang :: Index/TestClassDecl.m' FAILED
********************
57>  Script:
57>  --
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE -write-pch
E:\llvm\2013\tools\clang\test\Index\Output\TestClassDecl.m.tmp.ast
-fobjc-nonfragile-abi -fblocks -x objective-c
E:\llvm\llvm\tools\clang\test\Index\TestClassDecl.m
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE -test-file-scan
E:\llvm\2013\tools\clang\test\Index\Output\TestClassDecl.m.tmp.ast
E:\llvm\llvm\tools\clang\test\Index\TestClassDecl.m |
E:/llvm/2013/Debug/bin\FileCheck.EXE -check-prefix=CHECK-scan
E:\llvm\llvm\tools\clang\test\Index\TestClassDecl.m
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE -test-load-tu
E:\llvm\2013\tools\clang\test\Index\Output\TestClassDecl.m.tmp.ast
local | E:/llvm/2013/Debug/bin\FileCheck.EXE -check-prefix=CHECK-load
E:\llvm\llvm\tools\clang\test\Index\TestClassDecl.m
57>  --
57>  Exit Code: -1073741819
57>
57>  Command Output (stdout):
57>  --
57>  Command 0: "E:/llvm/2013/Debug/bin\c-index-test.EXE" "-write-pch"
"E:\llvm\2013\tools\clang\test\Index\Output\TestClassDecl.m.tmp.ast"
"-fobjc-nonfragile-abi" "-fblocks" "-x" "objective-c"
"E:\llvm\llvm\tools\clang\test\Index\TestClassDecl.m"
57>  Command 0 Result: -1073741819
57>  Command 0 Output:
57>
57>
57>  Command 0 Stderr:
57>
57>
57>
57>  --
57>
57>  ********************
57>  FAIL: Clang :: Index/TestClassForwardDecl.m (3191 of 7263)
57>  ******************** TEST 'Clang :: Index/TestClassForwardDecl.m'
FAILED ********************
57>  Script:
57>  --
57>  E:/llvm/2013/Debug/bin/clang.EXE -cc1 -internal-isystem
E:\llvm\2013\Debug\bin\..\lib\clang\3.5.0\include -triple
x86_64-apple-darwin10 -fblocks -emit-pch -x objective-c
E:\llvm\llvm\tools\clang\test\Index\TestClassForwardDecl.m -o
E:\llvm\2013\tools\clang\test\Index\Output\TestClassForwardDecl.m.tmp.ast
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE -test-file-scan
E:\llvm\2013\tools\clang\test\Index\Output\TestClassForwardDecl.m.tmp.ast
E:\llvm\llvm\tools\clang\test\Index\TestClassForwardDecl.m |
E:/llvm/2013/Debug/bin\FileCheck.EXE -check-prefix=CHECK-scan
E:\llvm\llvm\tools\clang\test\Index\TestClassForwardDecl.m
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE -test-load-tu
E:\llvm\2013\tools\clang\test\Index\Output\TestClassForwardDecl.m.tmp.ast
local | E:/llvm/2013/Debug/bin\FileCheck.EXE -check-prefix=CHECK-load
E:\llvm\llvm\tools\clang\test\Index\TestClassForwardDecl.m
57>  --
57>  Exit Code: 2
57>
57>  Command Output (stdout):
57>  --
57>  Command 0: "E:/llvm/2013/Debug/bin/clang.EXE" "-cc1"
"-internal-isystem"
"E:\llvm\2013\Debug\bin\..\lib\clang\3.5.0\include" "-triple"
"x86_64-apple-darwin10" "-fblocks" "-emit-pch" "-x" "objective-c"
"E:\llvm\llvm\tools\clang\test\Index\TestClassForwardDecl.m" "-o"
"E:\llvm\2013\tools\clang\test\Index\Output\TestClassForwardDecl.m.tmp.ast"
57>  Command 0 Result: 0
57>  Command 0 Output:
57>
57>
57>  Command 0 Stderr:
57>
57>
57>  Command 1: "E:/llvm/2013/Debug/bin\c-index-test.EXE"
"-test-file-scan"
"E:\llvm\2013\tools\clang\test\Index\Output\TestClassForwardDecl.m.tmp.ast"
"E:\llvm\llvm\tools\clang\test\Index\TestClassForwardDecl.m"
57>  Command 1 Result: -1073741819
57>  Command 1 Output:
57>
57>
57>  Command 1 Stderr:
57>
57>
57>  Command 2: "E:/llvm/2013/Debug/bin\FileCheck.EXE"
"-check-prefix=CHECK-scan"
"E:\llvm\llvm\tools\clang\test\Index\TestClassForwardDecl.m"
57>  Command 2 Result: 2
57>  Command 2 Output:
57>
57>
57>  Command 2 Stderr:
57>CUSTOMBUILD : FileCheck error : '-' is empty.
57>
57>
57>
57>
57>  --
57>
57>  ********************
57>  FAIL: Clang :: Index/annotate-attribute.cpp (3193 of 7263)
57>  ******************** TEST 'Clang :: Index/annotate-attribute.cpp'
FAILED ********************
57>  Script:
57>  --
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE -test-load-source all
E:\llvm\llvm\tools\clang\test\Index\annotate-attribute.cpp |
E:/llvm/2013/Debug/bin\FileCheck.EXE
E:\llvm\llvm\tools\clang\test\Index\annotate-attribute.cpp
57>  --
57>  Exit Code: 1
57>
57>  Command Output (stdout):
57>  --
57>  Command 0: "E:/llvm/2013/Debug/bin\c-index-test.EXE"
"-test-load-source" "all"
"E:\llvm\llvm\tools\clang\test\Index\annotate-attribute.cpp"
57>  Command 0 Result: -1073741819
57>  Command 0 Output:
57>
57>
57>  Command 0 Stderr:
57>
57>
57>  Command 1: "E:/llvm/2013/Debug/bin\FileCheck.EXE"
"E:\llvm\llvm\tools\clang\test\Index\annotate-attribute.cpp"
57>  Command 1 Result: 1
57>  Command 1 Output:
57>
57>
57>  Command 1 Stderr:
57>  E:\llvm\llvm\tools\clang\test\Index\annotate-attribute.cpp:28:16:
error: expected string not found in input
57>
57>  // CHECK-NEXT: attribute(annotate)=investigations Extent=[10:24 - 10:50]
57>
57>                 ^
57>
57>  <stdin>:182:100: note: scanning from here
57>
57>  // CHECK: annotate-attribute.cpp:10:1: CXXAccessSpecifier=:10:1
(Definition) Extent=[10:1 - 10:53] [access=private]
57>
57>
                                 ^
57>
57>  <stdin>:183:41: note: possible intended match here
57>
57>  // CHECK: annotate-attribute.cpp:10:24:
attribute(annotate)=investigations Extent=
57>
57>                                          ^
57>
57>
57>
57>
57>  --
57>
57>  ********************
57>  FAIL: Clang :: Index/annotate-module.m (3196 of 7263)
57>  ******************** TEST 'Clang :: Index/annotate-module.m'
FAILED ********************
57>  Script:
57>  --
57>  rm -rf E:\llvm\2013\tools\clang\test\Index\Output\annotate-module.m.tmp.cache
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-module.m:2:1:5:1
E:\llvm\llvm\tools\clang\test\Index\annotate-module.m
-fmodules-cache-path=E:\llvm\2013\tools\clang\test\Index\Output\annotate-module.m.tmp.cache
-fmodules -F E:\llvm\llvm\tools\clang\test\Index/../Modules/Inputs
  | E:/llvm/2013/Debug/bin\FileCheck.EXE
E:\llvm\llvm\tools\clang\test\Index\annotate-module.m
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index/../Modules/Inputs/Module.framework/Headers/Sub.h:1:1:3:1
E:\llvm\llvm\tools\clang\test\Index\annotate-module.m
-fmodules-cache-path=E:\llvm\2013\tools\clang\test\Index\Output\annotate-module.m.tmp.cache
-fmodules -F E:\llvm\llvm\tools\clang\test\Index/../Modules/Inputs
  | E:/llvm/2013/Debug/bin\FileCheck.EXE
E:\llvm\llvm\tools\clang\test\Index\annotate-module.m
-check-prefix=CHECK-MOD
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-cursor-at=E:\llvm\llvm\tools\clang\test\Index\annotate-module.m:3:11
E:\llvm\llvm\tools\clang\test\Index\annotate-module.m
-fmodules-cache-path=E:\llvm\2013\tools\clang\test\Index\Output\annotate-module.m.tmp.cache
-fmodules -F E:\llvm\llvm\tools\clang\test\Index/../Modules/Inputs
 | E:/llvm/2013/Debug/bin\FileCheck.EXE
E:\llvm\llvm\tools\clang\test\Index\annotate-module.m
-check-prefix=CHECK-CURSOR
57>  --
57>  Exit Code: 2
57>
57>  Command Output (stdout):
57>  --
57>  Command 0: "rm" "-rf"
"E:\llvm\2013\tools\clang\test\Index\Output\annotate-module.m.tmp.cache"
57>  Command 0 Result: 0
57>  Command 0 Output:
57>
57>
57>  Command 0 Stderr:
57>
57>
57>  Command 1: "E:/llvm/2013/Debug/bin\c-index-test.EXE"
"-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-module.m:2:1:5:1"
"E:\llvm\llvm\tools\clang\test\Index\annotate-module.m"
"-fmodules-cache-path=E:\llvm\2013\tools\clang\test\Index\Output\annotate-module.m.tmp.cache"
"-fmodules" "-F"
"E:\llvm\llvm\tools\clang\test\Index/../Modules/Inputs"
57>  Command 1 Result: -1073741819
57>  Command 1 Output:
57>
57>
57>  Command 1 Stderr:
57>
57>
57>  Command 2: "E:/llvm/2013/Debug/bin\FileCheck.EXE"
"E:\llvm\llvm\tools\clang\test\Index\annotate-module.m"
57>  Command 2 Result: 2
57>  Command 2 Output:
57>
57>
57>  Command 2 Stderr:
57>CUSTOMBUILD : FileCheck error : '-' is empty.
57>
57>
57>
57>
57>  --
57>
57>  ********************
57>  FAIL: Clang :: Index/annotate-tokens-cxx0x.cpp (3199 of 7263)
57>  ******************** TEST 'Clang ::
Index/annotate-tokens-cxx0x.cpp' FAILED ********************
57>  Script:
57>  --
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp:1:1:5:1
-fno-delayed-template-parsing -std=c++11
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp |
E:/llvm/2013/Debug/bin\FileCheck.EXE
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp:8:1:9:1
-std=c++11 E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp
| E:/llvm/2013/Debug/bin\FileCheck.EXE -check-prefix=CHECK-DECLTYPE
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp:13:1:14:1
-std=c++11 E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp
| E:/llvm/2013/Debug/bin\FileCheck.EXE -check-prefix=CHECK-TRAIT
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp:16:1:24:1
-std=c++11 E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp
| E:/llvm/2013/Debug/bin\FileCheck.EXE
-check-prefix=CHECK-WITH-OVERRIDE
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp:64:1:65:1
-std=c++11 E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp
| E:/llvm/2013/Debug/bin\FileCheck.EXE -check-prefix=CHECK-INITLIST
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp
57>  --
57>  Exit Code: 2
57>
57>  Command Output (stdout):
57>  --
57>  Command 0: "E:/llvm/2013/Debug/bin\c-index-test.EXE"
"-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp:1:1:5:1"
"-fno-delayed-template-parsing" "-std=c++11"
"E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp"
57>  Command 0 Result: -1073741819
57>  Command 0 Output:
57>
57>
57>  Command 0 Stderr:
57>
57>
57>  Command 1: "E:/llvm/2013/Debug/bin\FileCheck.EXE"
"E:\llvm\llvm\tools\clang\test\Index\annotate-tokens-cxx0x.cpp"
57>  Command 1 Result: 2
57>  Command 1 Output:
57>
57>
57>  Command 1 Stderr:
57>CUSTOMBUILD : FileCheck error : '-' is empty.
57>
57>
57>
57>
57>  --
57>
57>  ********************
57>  FAIL: Clang :: Index/annotate-tokens.c (3203 of 7263)
57>  ******************** TEST 'Clang :: Index/annotate-tokens.c'
FAILED ********************
57>  Script:
57>  --
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c:4:1:37:1
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c |
E:/llvm/2013/Debug/bin\FileCheck.EXE
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c:4:1:165:32
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c |
E:/llvm/2013/Debug/bin\FileCheck.EXE
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c:4:1:165:38
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c |
E:/llvm/2013/Debug/bin\FileCheck.EXE
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c:50:1:55:1
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c |
E:/llvm/2013/Debug/bin\FileCheck.EXE
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c
-check-prefix=CHECK-RANGE1
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c:54:1:59:1
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c |
E:/llvm/2013/Debug/bin\FileCheck.EXE
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c
-check-prefix=CHECK-RANGE2
57>  --
57>  Exit Code: 1
57>
57>  Command Output (stdout):
57>  --
57>  Command 0: "E:/llvm/2013/Debug/bin\c-index-test.EXE"
"-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c:4:1:37:1"
"E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c"
57>  Command 0 Result: -1073741819
57>  Command 0 Output:
57>
57>
57>  Command 0 Stderr:
57>
57>
57>  Command 1: "E:/llvm/2013/Debug/bin\FileCheck.EXE"
"E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c"
57>  Command 1 Result: 1
57>  Command 1 Output:
57>
57>
57>  Command 1 Stderr:
57>  E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.c:159:11:
error: expected string not found in input
57>
57>  // CHECK: Keyword: "__attribute__" [36:1 - 36:14]
FunctionDecl=test:36:63 (unavailable) (always unavailable: "")
57>
57>            ^
57>
57>  <stdin>:153:1: note: scanning from here
57>
57>  P
57>
57>  ^
57>
57>
57>
57>
57>  --
57>
57>  ********************
57>  FAIL: Clang :: Index/annotate-tokens.cpp (3204 of 7263)
57>  ******************** TEST 'Clang :: Index/annotate-tokens.cpp'
FAILED ********************
57>  Script:
57>  --
57>  E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.cpp:1:1:38:1
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.cpp
-fno-delayed-template-parsing | E:/llvm/2013/Debug/bin\FileCheck.EXE
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.cpp
57>  env LIBCLANG_DISABLE_CRASH_RECOVERY=1
E:/llvm/2013/Debug/bin\c-index-test.EXE
-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.cpp:32:1:32:13
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.cpp |
E:/llvm/2013/Debug/bin\FileCheck.EXE
E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.cpp
-check-prefix=CHECK2
57>  --
57>  Exit Code: 1
57>
57>  Command Output (stdout):
57>  --
57>  Command 0: "E:/llvm/2013/Debug/bin\c-index-test.EXE"
"-test-annotate-tokens=E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.cpp:1:1:38:1"
"E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.cpp"
"-fno-delayed-template-parsing"
57>  Command 0 Result: -1073741819
57>  Command 0 Output:
57>
57>
57>  Command 0 Stderr:
57>
57>
57>  Command 1: "E:/llvm/2013/Debug/bin\FileCheck.EXE"
"E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.cpp"
57>  Command 1 Result: 1
57>  Command 1 Output:
57>
57>
57>  Command 1 Stderr:
57>  E:\llvm\llvm\tools\clang\test\Index\annotate-tokens.cpp:179:11:
error: expected string not found in input
57>
57>  // CHECK: Punctuation: "::" [29:13 - 29:15] CXXMethod=foo:29:15
(Definition)
57>
57>            ^
57>
57>  <stdin>:139:1: note: scanning from here
57>
57>  Punctuation: "::"
57>
57>  ^
57>
57>
57>
57>
57>  --
57>
57>  ********************

The tests never finish running, quite likely there is a deadlock
somewhere. Unfortunately, I don't really have the time right now to
dig deeper and see what's going on, but it suggests we may not be able
to get away with a drop-in replacement using std::mutex and friends.

~Aaron



More information about the llvm-commits mailing list