summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt52
-rw-r--r--test/Unit/lit.cfg.py (renamed from test/Unit/lit.cfg)0
-rw-r--r--test/Unit/lit.site.cfg.py.in (renamed from test/Unit/lit.site.cfg.in)2
-rw-r--r--test/clang-apply-replacements/Inputs/basic/file1.yaml41
-rw-r--r--test/clang-apply-replacements/Inputs/basic/file2.yaml17
-rw-r--r--test/clang-apply-replacements/Inputs/conflict/file1.yaml33
-rw-r--r--test/clang-apply-replacements/Inputs/conflict/file2.yaml33
-rw-r--r--test/clang-apply-replacements/Inputs/conflict/file3.yaml17
-rw-r--r--test/clang-apply-replacements/Inputs/crlf/file1.yaml17
-rw-r--r--test/clang-apply-replacements/Inputs/format/no.yaml17
-rw-r--r--test/clang-apply-replacements/Inputs/format/yes.yaml41
-rw-r--r--test/clang-apply-replacements/Inputs/identical/file1.yaml17
-rw-r--r--test/clang-apply-replacements/Inputs/identical/file2.yaml17
-rw-r--r--test/clang-apply-replacements/Inputs/order-dependent/file1.yaml17
-rw-r--r--test/clang-apply-replacements/Inputs/order-dependent/file2.yaml17
-rw-r--r--test/clang-change-namespace/Inputs/fake-std.h (renamed from test/change-namespace/Inputs/fake-std.h)0
-rw-r--r--test/clang-change-namespace/lambda-function.cpp (renamed from test/change-namespace/lambda-function.cpp)0
-rw-r--r--test/clang-change-namespace/macro.cpp (renamed from test/change-namespace/macro.cpp)0
-rw-r--r--test/clang-change-namespace/simple-move.cpp (renamed from test/change-namespace/simple-move.cpp)0
-rw-r--r--test/clang-change-namespace/white-list.cpp (renamed from test/change-namespace/white-list.cpp)0
-rw-r--r--test/clang-include-fixer/Inputs/database_template.json (renamed from test/include-fixer/Inputs/database_template.json)0
-rw-r--r--test/clang-include-fixer/Inputs/fake_yaml_db.yaml (renamed from test/include-fixer/Inputs/fake_yaml_db.yaml)2
-rw-r--r--test/clang-include-fixer/Inputs/merge/a.yaml (renamed from test/include-fixer/Inputs/merge/a.yaml)0
-rw-r--r--test/clang-include-fixer/Inputs/merge/b.yaml (renamed from test/include-fixer/Inputs/merge/b.yaml)0
-rw-r--r--test/clang-include-fixer/commandline_options.cpp (renamed from test/include-fixer/commandline_options.cpp)0
-rw-r--r--test/clang-include-fixer/exit_on_fatal.cpp (renamed from test/include-fixer/exit_on_fatal.cpp)0
-rw-r--r--test/clang-include-fixer/fixeddb.cpp (renamed from test/include-fixer/fixeddb.cpp)0
-rw-r--r--test/clang-include-fixer/include_path.cpp19
-rw-r--r--test/clang-include-fixer/merge.test (renamed from test/include-fixer/merge.test)0
-rw-r--r--test/clang-include-fixer/multiple_fixes.cpp13
-rw-r--r--test/clang-include-fixer/prefix_variable.cpp (renamed from test/include-fixer/prefix_variable.cpp)0
-rw-r--r--test/clang-include-fixer/query_symbol.cpp (renamed from test/include-fixer/query_symbol.cpp)0
-rw-r--r--test/clang-include-fixer/ranking.cpp (renamed from test/include-fixer/ranking.cpp)2
-rw-r--r--test/clang-include-fixer/yaml_fuzzy.cpp (renamed from test/include-fixer/yaml_fuzzy.cpp)2
-rw-r--r--test/clang-include-fixer/yamldb.cpp (renamed from test/include-fixer/yamldb.cpp)0
-rw-r--r--test/clang-include-fixer/yamldb_autodetect.cpp (renamed from test/include-fixer/yamldb_autodetect.cpp)0
-rw-r--r--test/clang-tidy/Inputs/Headers/stdio.h18
-rw-r--r--test/clang-tidy/Inputs/absl/time/time.h20
-rw-r--r--test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/a.h1
-rw-r--r--test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/b.h2
-rw-r--r--test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/c.h2
-rw-r--r--test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/module.modulemap3
-rw-r--r--test/clang-tidy/abseil-duration-addition.cpp98
-rw-r--r--test/clang-tidy/abseil-duration-conversion-cast.cpp95
-rw-r--r--test/clang-tidy/abseil-duration-unnecessary-conversion.cpp111
-rw-r--r--test/clang-tidy/abseil-time-comparison.cpp129
-rw-r--r--test/clang-tidy/abseil-time-subtraction.cpp117
-rw-r--r--test/clang-tidy/abseil-upgrade-duration-conversions.cpp33
-rw-r--r--test/clang-tidy/alternative-fixes.cpp9
-rw-r--r--test/clang-tidy/bugprone-argument-comment-literals.cpp124
-rw-r--r--test/clang-tidy/bugprone-exception-escape-openmp.cpp29
-rw-r--r--[-rwxr-xr-x]test/clang-tidy/bugprone-parent-virtual-call.cpp0
-rw-r--r--test/clang-tidy/bugprone-sizeof-expression.cpp29
-rw-r--r--test/clang-tidy/bugprone-string-constructor.cpp8
-rw-r--r--test/clang-tidy/bugprone-string-integer-assignment.cpp60
-rw-r--r--test/clang-tidy/bugprone-too-small-loop-variable-magniute-bits-upper-limit.cpp23
-rw-r--r--test/clang-tidy/bugprone-too-small-loop-variable.cpp6
-rwxr-xr-xtest/clang-tidy/check_clang_tidy.py7
-rw-r--r--test/clang-tidy/clang-tidy-diff.cpp1
-rw-r--r--test/clang-tidy/clang-tidy-mac-libcxx.cpp2
-rw-r--r--test/clang-tidy/cppcoreguidelines-macro-usage.cpp2
-rw-r--r--test/clang-tidy/expand-modular-headers-ppcallbacks.cpp35
-rw-r--r--test/clang-tidy/export-diagnostics.cpp13
-rw-r--r--test/clang-tidy/google-objc-function-naming.m10
-rw-r--r--test/clang-tidy/google-objc-global-variable-declaration.mm10
-rw-r--r--test/clang-tidy/google-runtime-int.m32
-rw-r--r--test/clang-tidy/llvm-prefer-isa-or-dyn-cast-in-conditionals.cpp132
-rw-r--r--test/clang-tidy/misc-non-private-member-variables-in-classes.cpp17
-rw-r--r--test/clang-tidy/modernize-avoid-bind.cpp44
-rw-r--r--test/clang-tidy/modernize-avoid-c-arrays-ignores-main.cpp18
-rw-r--r--test/clang-tidy/modernize-avoid-c-arrays-ignores-three-arg-main.cpp20
-rw-r--r--test/clang-tidy/modernize-redundant-void-arg.cpp7
-rw-r--r--test/clang-tidy/modernize-use-default-member-init-assignment.cpp8
-rw-r--r--test/clang-tidy/modernize-use-default-member-init.cpp18
-rw-r--r--test/clang-tidy/modernize-use-override-no-destructors.cpp16
-rw-r--r--test/clang-tidy/modernize-use-override-with-macro.cpp70
-rw-r--r--test/clang-tidy/modernize-use-override-with-no-macro-inscope.cpp28
-rw-r--r--test/clang-tidy/nolint.cpp3
-rw-r--r--test/clang-tidy/objc-property-declaration.m1
-rw-r--r--test/clang-tidy/objc-super-self.m86
-rw-r--r--test/clang-tidy/openmp-exception-escape.cpp132
-rw-r--r--test/clang-tidy/openmp-use-default-none.cpp160
-rw-r--r--test/clang-tidy/readability-avoid-underscore-in-googletest-name.cpp108
-rw-r--r--test/clang-tidy/readability-else-after-return.cpp12
-rw-r--r--test/clang-tidy/readability-misleading-indentation.cpp13
-rw-r--r--test/clang-tidy/readability-redundant-smartptr-get-msvc.cpp94
-rw-r--r--test/clang-tidy/readability-uppercase-literal-suffix-float16.cpp51
-rw-r--r--test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp28
-rw-r--r--test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp15
-rw-r--r--test/clang-tidy/run-clang-tidy.cpp1
-rw-r--r--test/clang-tidy/static-analyzer-config.cpp2
-rw-r--r--test/clangd/Inputs/BenchmarkHeader.h19
-rw-r--r--test/clangd/Inputs/BenchmarkSource.cpp1
-rw-r--r--test/clangd/Inputs/background-index/compile_commands.json5
-rw-r--r--test/clangd/Inputs/background-index/definition.jsonrpc51
-rw-r--r--test/clangd/Inputs/background-index/foo.cpp2
-rw-r--r--test/clangd/Inputs/background-index/foo.h4
-rw-r--r--test/clangd/Inputs/requests.json7
-rw-r--r--test/clangd/Inputs/symbols.test.yaml17
-rw-r--r--test/clangd/background-index.test20
-rw-r--r--test/clangd/compile-commands-path-in-initialize.test28
-rw-r--r--test/clangd/completion-auto-trigger.test106
-rw-r--r--test/clangd/completion-snippets.test56
-rw-r--r--test/clangd/completion.test72
-rw-r--r--test/clangd/crash-non-added-files.test34
-rw-r--r--test/clangd/delimited-input-comment-at-the-end.test11
-rw-r--r--test/clangd/diagnostic-category.test43
-rw-r--r--test/clangd/diagnostics.test28
-rw-r--r--test/clangd/did-change-configuration-params.test52
-rw-r--r--test/clangd/execute-command.test66
-rw-r--r--test/clangd/exit-with-shutdown.test6
-rw-r--r--test/clangd/exit-without-shutdown.test4
-rw-r--r--test/clangd/filestatus.test13
-rw-r--r--test/clangd/fixits-codeaction.test126
-rw-r--r--test/clangd/fixits-command.test210
-rw-r--r--test/clangd/fixits-embed-in-diagnostic.test67
-rw-r--r--test/clangd/formatting.test187
-rw-r--r--test/clangd/hover.test24
-rw-r--r--test/clangd/index-tools.test6
-rw-r--r--test/clangd/initialize-params-invalid.test12
-rw-r--r--test/clangd/initialize-params.test50
-rw-r--r--test/clangd/initialize-sequence.test21
-rw-r--r--test/clangd/input-mirror.test17
-rw-r--r--test/clangd/lit.local.cfg6
-rw-r--r--test/clangd/protocol.test110
-rw-r--r--test/clangd/references.test40
-rw-r--r--test/clangd/rename.test39
-rw-r--r--test/clangd/signature-help.test27
-rw-r--r--test/clangd/spaces-in-delimited-input.test13
-rw-r--r--test/clangd/symbol-info.test14
-rw-r--r--test/clangd/symbols.test84
-rw-r--r--test/clangd/test-uri-posix.test11
-rw-r--r--test/clangd/test-uri-windows.test11
-rw-r--r--test/clangd/textdocument-didchange-fail.test39
-rw-r--r--test/clangd/too_large.test7
-rw-r--r--test/clangd/trace.test25
-rw-r--r--test/clangd/unsupported-method.test16
-rw-r--r--test/clangd/xpc/initialize.test10
-rw-r--r--test/clangd/xrefs.test59
-rw-r--r--test/include-fixer/include_path.cpp19
-rw-r--r--test/include-fixer/multiple_fixes.cpp13
-rw-r--r--test/lit.cfg.py (renamed from test/lit.cfg)8
-rw-r--r--test/lit.site.cfg.py.in (renamed from test/lit.site.cfg.in)3
-rw-r--r--test/modularize/ProblemsInconsistent.modularize10
-rw-r--r--test/pp-trace/pp-trace-conditional.cpp50
-rw-r--r--test/pp-trace/pp-trace-filter.cpp17
-rw-r--r--test/pp-trace/pp-trace-ident.cpp2
-rw-r--r--test/pp-trace/pp-trace-include.cpp2
-rw-r--r--test/pp-trace/pp-trace-macro.cpp6
-rw-r--r--test/pp-trace/pp-trace-modules.cpp2
-rw-r--r--test/pp-trace/pp-trace-pragma-general.cpp2
-rw-r--r--test/pp-trace/pp-trace-pragma-ms.cpp2
-rw-r--r--test/pp-trace/pp-trace-pragma-opencl.cpp2
153 files changed, 2300 insertions, 2203 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index adeb0368..a2cedeaa 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -15,18 +15,20 @@ endif ()
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
-llvm_canonicalize_cmake_booleans(
- CLANG_ENABLE_STATIC_ANALYZER
- CLANGD_BUILD_XPC_SUPPORT)
+llvm_canonicalize_cmake_booleans(CLANG_ENABLE_STATIC_ANALYZER)
configure_lit_site_cfg(
- ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
- ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
+ ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+ ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
+ MAIN_CONFIG
+ ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
)
configure_lit_site_cfg(
- ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
- ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
+ ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
+ ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
+ MAIN_CONFIG
+ ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
)
option(CLANG_TOOLS_TEST_USE_VG "Run Clang tools' tests under Valgrind" OFF)
@@ -59,39 +61,23 @@ set(CLANG_TOOLS_TEST_DEPS
# For the clang-tidy libclang integration test.
c-index-test
# clang-tidy tests require it.
- clang-headers
+ clang-resource-headers
clang-tidy
+ # Clang-tidy tests need clang for building modules.
+ clang
)
-if(CLANGD_BUILD_XPC_SUPPORT)
- list(APPEND CLANG_TOOLS_TEST_DEPS clangd-xpc-test-client)
-endif()
-
-set(CLANGD_TEST_DEPS
- clangd
- ClangdTests
- # clangd-related tools which don't have tests, add them to the test to make
- # sure we don't introduce new changes that break their compilations.
- clangd-indexer
- dexp
- )
-
# Add lit test dependencies.
set(LLVM_UTILS_DEPS
FileCheck count not
)
foreach(dep ${LLVM_UTILS_DEPS})
if(TARGET ${dep})
- list(APPEND CLANGD_TEST_DEPS ${dep})
+ list(APPEND CLANG_TOOLS_TEST_DEPS ${dep})
endif()
endforeach()
-foreach(clangd_dep ${CLANGD_TEST_DEPS})
- list(APPEND CLANG_TOOLS_TEST_DEPS
- ${clangd_dep})
-endforeach()
-
add_lit_testsuite(check-clang-tools "Running the Clang extra tools' regression tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${CLANG_TOOLS_TEST_DEPS}
@@ -99,15 +85,3 @@ add_lit_testsuite(check-clang-tools "Running the Clang extra tools' regression t
)
set_target_properties(check-clang-tools PROPERTIES FOLDER "Clang extra tools' tests")
-
-# Setup an individual test for building and testing clangd-only stuff.
-# Note: all clangd tests have been covered in check-clang-tools, this is a
-# convenient target for clangd developers.
-# Exclude check-clangd from check-all.
-set(EXCLUDE_FROM_ALL ON)
-add_lit_testsuite(check-clangd "Running the Clangd regression tests"
- ${CMAKE_CURRENT_BINARY_DIR}/Unit/clangd;${CMAKE_CURRENT_BINARY_DIR}/clangd
- DEPENDS ${CLANGD_TEST_DEPS}
-)
-set_target_properties(check-clangd PROPERTIES FOLDER "Clangd tests")
-set(EXCLUDE_FROM_ALL OFF)
diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg.py
index b40e1cae..b40e1cae 100644
--- a/test/Unit/lit.cfg
+++ b/test/Unit/lit.cfg.py
diff --git a/test/Unit/lit.site.cfg.in b/test/Unit/lit.site.cfg.py.in
index 69a5cd5d..dc7ee330 100644
--- a/test/Unit/lit.site.cfg.in
+++ b/test/Unit/lit.site.cfg.py.in
@@ -6,4 +6,4 @@ config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
config.shlibdir = "@SHLIBDIR@"
config.target_triple = "@TARGET_TRIPLE@"
-lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/Unit/lit.cfg")
+lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/Unit/lit.cfg.py")
diff --git a/test/clang-apply-replacements/Inputs/basic/file1.yaml b/test/clang-apply-replacements/Inputs/basic/file1.yaml
index 3a5375e6..0703f62c 100644
--- a/test/clang-apply-replacements/Inputs/basic/file1.yaml
+++ b/test/clang-apply-replacements/Inputs/basic/file1.yaml
@@ -2,24 +2,25 @@
MainSourceFile: source1.cpp
Diagnostics:
- DiagnosticName: test-basic
- Message: Fix
- FilePath: $(path)/basic.h
- FileOffset: 242
- Replacements:
- - FilePath: $(path)/basic.h
- Offset: 242
- Length: 26
- ReplacementText: 'auto & elem : ints'
- - FilePath: $(path)/basic.h
- Offset: 276
- Length: 22
- ReplacementText: ''
- - FilePath: $(path)/basic.h
- Offset: 298
- Length: 1
- ReplacementText: elem
- - FilePath: $(path)/../basic/basic.h
- Offset: 148
- Length: 0
- ReplacementText: 'override '
+ DiagnosticMessage:
+ Message: Fix
+ FilePath: $(path)/basic.h
+ FileOffset: 242
+ Replacements:
+ - FilePath: $(path)/basic.h
+ Offset: 242
+ Length: 26
+ ReplacementText: 'auto & elem : ints'
+ - FilePath: $(path)/basic.h
+ Offset: 276
+ Length: 22
+ ReplacementText: ''
+ - FilePath: $(path)/basic.h
+ Offset: 298
+ Length: 1
+ ReplacementText: elem
+ - FilePath: $(path)/../basic/basic.h
+ Offset: 148
+ Length: 0
+ ReplacementText: 'override '
...
diff --git a/test/clang-apply-replacements/Inputs/basic/file2.yaml b/test/clang-apply-replacements/Inputs/basic/file2.yaml
index 8f6f65ad..de99d860 100644
--- a/test/clang-apply-replacements/Inputs/basic/file2.yaml
+++ b/test/clang-apply-replacements/Inputs/basic/file2.yaml
@@ -2,12 +2,13 @@
MainSourceFile: source2.cpp
Diagnostics:
- DiagnosticName: test-basic
- Message: Fix
- FilePath: $(path)/basic.h
- FileOffset: 148
- Replacements:
- - FilePath: $(path)/../basic/basic.h
- Offset: 298
- Length: 1
- ReplacementText: elem
+ DiagnosticMessage:
+ Message: Fix
+ FilePath: $(path)/basic.h
+ FileOffset: 148
+ Replacements:
+ - FilePath: $(path)/../basic/basic.h
+ Offset: 298
+ Length: 1
+ ReplacementText: elem
...
diff --git a/test/clang-apply-replacements/Inputs/conflict/file1.yaml b/test/clang-apply-replacements/Inputs/conflict/file1.yaml
index 85052736..8dccc567 100644
--- a/test/clang-apply-replacements/Inputs/conflict/file1.yaml
+++ b/test/clang-apply-replacements/Inputs/conflict/file1.yaml
@@ -2,20 +2,21 @@
MainSourceFile: source1.cpp
Diagnostics:
- DiagnosticName: test-conflict
- Message: Fix
- FilePath: $(path)/common.h
- FileOffset: 106
- Replacements:
- - FilePath: $(path)/common.h
- Offset: 106
- Length: 26
- ReplacementText: 'auto & i : ints'
- - FilePath: $(path)/common.h
- Offset: 140
- Length: 7
- ReplacementText: i
- - FilePath: $(path)/common.h
- Offset: 160
- Length: 12
- ReplacementText: ''
+ DiagnosticMessage:
+ Message: Fix
+ FilePath: $(path)/common.h
+ FileOffset: 106
+ Replacements:
+ - FilePath: $(path)/common.h
+ Offset: 106
+ Length: 26
+ ReplacementText: 'auto & i : ints'
+ - FilePath: $(path)/common.h
+ Offset: 140
+ Length: 7
+ ReplacementText: i
+ - FilePath: $(path)/common.h
+ Offset: 160
+ Length: 12
+ ReplacementText: ''
...
diff --git a/test/clang-apply-replacements/Inputs/conflict/file2.yaml b/test/clang-apply-replacements/Inputs/conflict/file2.yaml
index 32b35acf..d7339662 100644
--- a/test/clang-apply-replacements/Inputs/conflict/file2.yaml
+++ b/test/clang-apply-replacements/Inputs/conflict/file2.yaml
@@ -2,20 +2,21 @@
MainSourceFile: source2.cpp
Diagnostics:
- DiagnosticName: test-conflict
- Message: Fix
- FilePath: $(path)/common.h
- FileOffset: 106
- Replacements:
- - FilePath: $(path)/common.h
- Offset: 106
- Length: 26
- ReplacementText: 'int & elem : ints'
- - FilePath: $(path)/common.h
- Offset: 140
- Length: 7
- ReplacementText: elem
- - FilePath: $(path)/common.h
- Offset: 169
- Length: 1
- ReplacementText: nullptr
+ DiagnosticMessage:
+ Message: Fix
+ FilePath: $(path)/common.h
+ FileOffset: 106
+ Replacements:
+ - FilePath: $(path)/common.h
+ Offset: 106
+ Length: 26
+ ReplacementText: 'int & elem : ints'
+ - FilePath: $(path)/common.h
+ Offset: 140
+ Length: 7
+ ReplacementText: elem
+ - FilePath: $(path)/common.h
+ Offset: 169
+ Length: 1
+ ReplacementText: nullptr
...
diff --git a/test/clang-apply-replacements/Inputs/conflict/file3.yaml b/test/clang-apply-replacements/Inputs/conflict/file3.yaml
index 88543e0a..fee1108c 100644
--- a/test/clang-apply-replacements/Inputs/conflict/file3.yaml
+++ b/test/clang-apply-replacements/Inputs/conflict/file3.yaml
@@ -2,12 +2,13 @@
MainSourceFile: source1.cpp
Diagnostics:
- DiagnosticName: test-conflict
- Message: Fix
- FilePath: $(path)/common.h
- FileOffset: 169
- Replacements:
- - FilePath: $(path)/common.h
- Offset: 169
- Length: 0
- ReplacementText: "(int*)"
+ DiagnosticMessage:
+ Message: Fix
+ FilePath: $(path)/common.h
+ FileOffset: 169
+ Replacements:
+ - FilePath: $(path)/common.h
+ Offset: 169
+ Length: 0
+ ReplacementText: "(int*)"
...
diff --git a/test/clang-apply-replacements/Inputs/crlf/file1.yaml b/test/clang-apply-replacements/Inputs/crlf/file1.yaml
index 06b058e3..2c3d56e8 100644
--- a/test/clang-apply-replacements/Inputs/crlf/file1.yaml
+++ b/test/clang-apply-replacements/Inputs/crlf/file1.yaml
@@ -2,12 +2,13 @@
MainSourceFile: source1.cpp
Diagnostics:
- DiagnosticName: test-crlf
- Message: Fix
- FilePath: $(path)/crlf.cpp
- FileOffset: 79
- Replacements:
- - FilePath: $(path)/crlf.cpp
- Offset: 79
- Length: 1
- ReplacementText: nullptr
+ DiagnosticMessage:
+ Message: Fix
+ FilePath: $(path)/crlf.cpp
+ FileOffset: 79
+ Replacements:
+ - FilePath: $(path)/crlf.cpp
+ Offset: 79
+ Length: 1
+ ReplacementText: nullptr
...
diff --git a/test/clang-apply-replacements/Inputs/format/no.yaml b/test/clang-apply-replacements/Inputs/format/no.yaml
index 3118cc61..48aafd9d 100644
--- a/test/clang-apply-replacements/Inputs/format/no.yaml
+++ b/test/clang-apply-replacements/Inputs/format/no.yaml
@@ -2,12 +2,13 @@
MainSourceFile: no.cpp
Diagnostics:
- DiagnosticName: test-no
- Message: Fix
- FilePath: $(path)/no.cpp
- FileOffset: 94
- Replacements:
- - FilePath: $(path)/no.cpp
- Offset: 94
- Length: 3
- ReplacementText: 'auto '
+ DiagnosticMessage:
+ Message: Fix
+ FilePath: $(path)/no.cpp
+ FileOffset: 94
+ Replacements:
+ - FilePath: $(path)/no.cpp
+ Offset: 94
+ Length: 3
+ ReplacementText: 'auto '
...
diff --git a/test/clang-apply-replacements/Inputs/format/yes.yaml b/test/clang-apply-replacements/Inputs/format/yes.yaml
index 6ded4db3..337004d7 100644
--- a/test/clang-apply-replacements/Inputs/format/yes.yaml
+++ b/test/clang-apply-replacements/Inputs/format/yes.yaml
@@ -4,24 +4,25 @@
MainSourceFile: yes.cpp
Diagnostics:
- DiagnosticName: test-yes
- Message: Fix
- FilePath: $(path)/yes.cpp
- FileOffset: 494
- Replacements:
- - FilePath: $(path)/yes.cpp
- Offset: 494
- Length: 1
- ReplacementText: nullptr
- - FilePath: $(path)/yes.cpp
- Offset: 410
- Length: 1
- ReplacementText: nullptr
- - FilePath: $(path)/yes.cpp
- Offset: 454
- Length: 1
- ReplacementText: nullptr
- - FilePath: $(path)/yes.cpp
- Offset: 108
- Length: 38
- ReplacementText: 'auto '
+ DiagnosticMessage:
+ Message: Fix
+ FilePath: $(path)/yes.cpp
+ FileOffset: 494
+ Replacements:
+ - FilePath: $(path)/yes.cpp
+ Offset: 494
+ Length: 1
+ ReplacementText: nullptr
+ - FilePath: $(path)/yes.cpp
+ Offset: 410
+ Length: 1
+ ReplacementText: nullptr
+ - FilePath: $(path)/yes.cpp
+ Offset: 454
+ Length: 1
+ ReplacementText: nullptr
+ - FilePath: $(path)/yes.cpp
+ Offset: 108
+ Length: 38
+ ReplacementText: 'auto '
...
diff --git a/test/clang-apply-replacements/Inputs/identical/file1.yaml b/test/clang-apply-replacements/Inputs/identical/file1.yaml
index cf273c48..9e3de7b4 100644
--- a/test/clang-apply-replacements/Inputs/identical/file1.yaml
+++ b/test/clang-apply-replacements/Inputs/identical/file1.yaml
@@ -2,13 +2,14 @@
MainSourceFile: identical.cpp
Diagnostics:
- DiagnosticName: test-identical-insertion
- Message: Fix
- FilePath: $(path)/identical.cpp
- FileOffset: 12
- Replacements:
- - FilePath: $(path)/identical.cpp
- Offset: 12
- Length: 0
- ReplacementText: '0'
+ DiagnosticMessage:
+ Message: Fix
+ FilePath: $(path)/identical.cpp
+ FileOffset: 12
+ Replacements:
+ - FilePath: $(path)/identical.cpp
+ Offset: 12
+ Length: 0
+ ReplacementText: '0'
...
diff --git a/test/clang-apply-replacements/Inputs/identical/file2.yaml b/test/clang-apply-replacements/Inputs/identical/file2.yaml
index cf273c48..9e3de7b4 100644
--- a/test/clang-apply-replacements/Inputs/identical/file2.yaml
+++ b/test/clang-apply-replacements/Inputs/identical/file2.yaml
@@ -2,13 +2,14 @@
MainSourceFile: identical.cpp
Diagnostics:
- DiagnosticName: test-identical-insertion
- Message: Fix
- FilePath: $(path)/identical.cpp
- FileOffset: 12
- Replacements:
- - FilePath: $(path)/identical.cpp
- Offset: 12
- Length: 0
- ReplacementText: '0'
+ DiagnosticMessage:
+ Message: Fix
+ FilePath: $(path)/identical.cpp
+ FileOffset: 12
+ Replacements:
+ - FilePath: $(path)/identical.cpp
+ Offset: 12
+ Length: 0
+ ReplacementText: '0'
...
diff --git a/test/clang-apply-replacements/Inputs/order-dependent/file1.yaml b/test/clang-apply-replacements/Inputs/order-dependent/file1.yaml
index a8234388..939839d9 100644
--- a/test/clang-apply-replacements/Inputs/order-dependent/file1.yaml
+++ b/test/clang-apply-replacements/Inputs/order-dependent/file1.yaml
@@ -2,12 +2,13 @@
MainSourceFile: order-dependent.cpp
Diagnostics:
- DiagnosticName: test-order-dependent-insertion
- Message: Fix
- FilePath: $(path)/order-dependent.cpp
- FileOffset: 12
- Replacements:
- - FilePath: $(path)/order-dependent.cpp
- Offset: 12
- Length: 0
- ReplacementText: '0'
+ DiagnosticMessage:
+ Message: Fix
+ FilePath: $(path)/order-dependent.cpp
+ FileOffset: 12
+ Replacements:
+ - FilePath: $(path)/order-dependent.cpp
+ Offset: 12
+ Length: 0
+ ReplacementText: '0'
...
diff --git a/test/clang-apply-replacements/Inputs/order-dependent/file2.yaml b/test/clang-apply-replacements/Inputs/order-dependent/file2.yaml
index 634d3ca6..1219c3b0 100644
--- a/test/clang-apply-replacements/Inputs/order-dependent/file2.yaml
+++ b/test/clang-apply-replacements/Inputs/order-dependent/file2.yaml
@@ -2,12 +2,13 @@
MainSourceFile: order-dependent.cpp
Diagnostics:
- DiagnosticName: test-order-dependent-insertion
- Message: Fix
- FilePath: $(path)/order-dependent.cpp
- FileOffset: 12
- Replacements:
- - FilePath: $(path)/order-dependent.cpp
- Offset: 12
- Length: 0
- ReplacementText: '1'
+ DiagnosticMessage:
+ Message: Fix
+ FilePath: $(path)/order-dependent.cpp
+ FileOffset: 12
+ Replacements:
+ - FilePath: $(path)/order-dependent.cpp
+ Offset: 12
+ Length: 0
+ ReplacementText: '1'
...
diff --git a/test/change-namespace/Inputs/fake-std.h b/test/clang-change-namespace/Inputs/fake-std.h
index 24d3f977..24d3f977 100644
--- a/test/change-namespace/Inputs/fake-std.h
+++ b/test/clang-change-namespace/Inputs/fake-std.h
diff --git a/test/change-namespace/lambda-function.cpp b/test/clang-change-namespace/lambda-function.cpp
index 452983ea..452983ea 100644
--- a/test/change-namespace/lambda-function.cpp
+++ b/test/clang-change-namespace/lambda-function.cpp
diff --git a/test/change-namespace/macro.cpp b/test/clang-change-namespace/macro.cpp
index ba47de60..ba47de60 100644
--- a/test/change-namespace/macro.cpp
+++ b/test/clang-change-namespace/macro.cpp
diff --git a/test/change-namespace/simple-move.cpp b/test/clang-change-namespace/simple-move.cpp
index ea3c3d33..ea3c3d33 100644
--- a/test/change-namespace/simple-move.cpp
+++ b/test/clang-change-namespace/simple-move.cpp
diff --git a/test/change-namespace/white-list.cpp b/test/clang-change-namespace/white-list.cpp
index 48e3a78a..48e3a78a 100644
--- a/test/change-namespace/white-list.cpp
+++ b/test/clang-change-namespace/white-list.cpp
diff --git a/test/include-fixer/Inputs/database_template.json b/test/clang-include-fixer/Inputs/database_template.json
index ec71c562..ec71c562 100644
--- a/test/include-fixer/Inputs/database_template.json
+++ b/test/clang-include-fixer/Inputs/database_template.json
diff --git a/test/include-fixer/Inputs/fake_yaml_db.yaml b/test/clang-include-fixer/Inputs/fake_yaml_db.yaml
index b599005e..134b3758 100644
--- a/test/include-fixer/Inputs/fake_yaml_db.yaml
+++ b/test/clang-include-fixer/Inputs/fake_yaml_db.yaml
@@ -65,7 +65,7 @@ Name: bar
Contexts:
- ContextType: Namespace
ContextName: c
-FilePath: test/include-fixer/baz.h
+FilePath: test/clang-include-fixer/baz.h
Type: Class
Seen: 1
Used: 0
diff --git a/test/include-fixer/Inputs/merge/a.yaml b/test/clang-include-fixer/Inputs/merge/a.yaml
index 174db0e5..174db0e5 100644
--- a/test/include-fixer/Inputs/merge/a.yaml
+++ b/test/clang-include-fixer/Inputs/merge/a.yaml
diff --git a/test/include-fixer/Inputs/merge/b.yaml b/test/clang-include-fixer/Inputs/merge/b.yaml
index 86893208..86893208 100644
--- a/test/include-fixer/Inputs/merge/b.yaml
+++ b/test/clang-include-fixer/Inputs/merge/b.yaml
diff --git a/test/include-fixer/commandline_options.cpp b/test/clang-include-fixer/commandline_options.cpp
index 3cc77b49..3cc77b49 100644
--- a/test/include-fixer/commandline_options.cpp
+++ b/test/clang-include-fixer/commandline_options.cpp
diff --git a/test/include-fixer/exit_on_fatal.cpp b/test/clang-include-fixer/exit_on_fatal.cpp
index fc8c95a0..fc8c95a0 100644
--- a/test/include-fixer/exit_on_fatal.cpp
+++ b/test/clang-include-fixer/exit_on_fatal.cpp
diff --git a/test/include-fixer/fixeddb.cpp b/test/clang-include-fixer/fixeddb.cpp
index 90068dbf..90068dbf 100644
--- a/test/include-fixer/fixeddb.cpp
+++ b/test/clang-include-fixer/fixeddb.cpp
diff --git a/test/clang-include-fixer/include_path.cpp b/test/clang-include-fixer/include_path.cpp
new file mode 100644
index 00000000..9185b7af
--- /dev/null
+++ b/test/clang-include-fixer/include_path.cpp
@@ -0,0 +1,19 @@
+// RUN: mkdir -p %T/clang-include-fixer/include
+// RUN: mkdir -p %T/clang-include-fixer/symbols
+// RUN: mkdir -p %T/clang-include-fixer/build
+// RUN: mkdir -p %T/clang-include-fixer/src
+// RUN: sed 's|test_dir|%/T/clang-include-fixer|g' %S/Inputs/database_template.json > %T/clang-include-fixer/build/compile_commands.json
+// RUN: echo -e '#include "bar.h"\nb::a::bar f;' > %T/clang-include-fixer/src/bar.cpp
+// RUN: echo 'namespace b { namespace a { class bar {}; } }' > %T/clang-include-fixer/include/bar.h
+// RUN: cd %T/clang-include-fixer/build
+// RUN: find-all-symbols -output-dir=%T/clang-include-fixer/symbols -p=. %T/clang-include-fixer/src/bar.cpp
+// RUN: find-all-symbols -merge-dir=%T/clang-include-fixer/symbols %T/clang-include-fixer/build/find_all_symbols.yaml
+// RUN: FileCheck -input-file=%T/clang-include-fixer/build/find_all_symbols.yaml -check-prefix=CHECK-YAML %s
+//
+// RUN: echo 'b::a::bar f;' > %T/clang-include-fixer/src/bar.cpp
+// RUN: clang-include-fixer -db=yaml -input=%T/clang-include-fixer/build/find_all_symbols.yaml -minimize-paths=true -p=. %T/clang-include-fixer/src/bar.cpp
+// RUN: FileCheck -input-file=%T/clang-include-fixer/src/bar.cpp %s
+
+// CHECK-YAML: ..{{[/\\]}}include{{[/\\]}}bar.h
+// CHECK: #include "bar.h"
+// CHECK: b::a::bar f;
diff --git a/test/include-fixer/merge.test b/test/clang-include-fixer/merge.test
index 230d38da..230d38da 100644
--- a/test/include-fixer/merge.test
+++ b/test/clang-include-fixer/merge.test
diff --git a/test/clang-include-fixer/multiple_fixes.cpp b/test/clang-include-fixer/multiple_fixes.cpp
new file mode 100644
index 00000000..791417a3
--- /dev/null
+++ b/test/clang-include-fixer/multiple_fixes.cpp
@@ -0,0 +1,13 @@
+// REQUIRES: shell
+// RUN: sed -e 's#//.*$##' %s > %t.cpp
+// RUN: mkdir -p %T/clang-include-fixer/multiple-fixes
+// RUN: echo 'foo f;' > %T/clang-include-fixer/multiple-fixes/foo.cpp
+// RUN: echo 'bar b;' > %T/clang-include-fixer/multiple-fixes/bar.cpp
+// RUN: clang-include-fixer -db=fixed -input='foo= "foo.h";bar= "bar.h"' %T/clang-include-fixer/multiple-fixes/*.cpp --
+// RUN: FileCheck -input-file=%T/clang-include-fixer/multiple-fixes/bar.cpp %s -check-prefix=CHECK-BAR
+// RUN: FileCheck -input-file=%T/clang-include-fixer/multiple-fixes/foo.cpp %s -check-prefix=CHECK-FOO
+//
+// CHECK-FOO: #include "foo.h"
+// CHECK-FOO: foo f;
+// CHECK-BAR: #include "bar.h"
+// CHECK-BAR: bar b;
diff --git a/test/include-fixer/prefix_variable.cpp b/test/clang-include-fixer/prefix_variable.cpp
index b39cdb8d..b39cdb8d 100644
--- a/test/include-fixer/prefix_variable.cpp
+++ b/test/clang-include-fixer/prefix_variable.cpp
diff --git a/test/include-fixer/query_symbol.cpp b/test/clang-include-fixer/query_symbol.cpp
index 84c3a237..84c3a237 100644
--- a/test/include-fixer/query_symbol.cpp
+++ b/test/clang-include-fixer/query_symbol.cpp
diff --git a/test/include-fixer/ranking.cpp b/test/clang-include-fixer/ranking.cpp
index 2dabe16f..ee54d4c7 100644
--- a/test/include-fixer/ranking.cpp
+++ b/test/clang-include-fixer/ranking.cpp
@@ -2,7 +2,7 @@
// RUN: clang-include-fixer -query-symbol bar -db=yaml -input=%S/Inputs/fake_yaml_db.yaml -output-headers %s -- | FileCheck %s
// CHECK: "HeaderInfos": [
-// CHECK-NEXT: {"Header": "\"test/include-fixer/baz.h\"",
+// CHECK-NEXT: {"Header": "\"test/clang-include-fixer/baz.h\"",
// CHECK-NEXT: "QualifiedName": "c::bar"},
// CHECK-NEXT: {"Header": "\"../include/bar.h\"",
// CHECK-NEXT: "QualifiedName": "b::a::bar"},
diff --git a/test/include-fixer/yaml_fuzzy.cpp b/test/clang-include-fixer/yaml_fuzzy.cpp
index 705542dd..9a3daacb 100644
--- a/test/include-fixer/yaml_fuzzy.cpp
+++ b/test/clang-include-fixer/yaml_fuzzy.cpp
@@ -2,7 +2,7 @@
// RUN: clang-include-fixer -db=fuzzyYaml -input=%p/Inputs/fake_yaml_db.yaml %t.cpp --
// RUN: FileCheck %s -input-file=%t.cpp
-// include-fixer will add the include, but doesn't complete the symbol.
+// clang-include-fixer will add the include, but doesn't complete the symbol.
// CHECK: #include "foobar.h"
// CHECK: fba f;
diff --git a/test/include-fixer/yamldb.cpp b/test/clang-include-fixer/yamldb.cpp
index d17b4147..d17b4147 100644
--- a/test/include-fixer/yamldb.cpp
+++ b/test/clang-include-fixer/yamldb.cpp
diff --git a/test/include-fixer/yamldb_autodetect.cpp b/test/clang-include-fixer/yamldb_autodetect.cpp
index 1997390d..1997390d 100644
--- a/test/include-fixer/yamldb_autodetect.cpp
+++ b/test/clang-include-fixer/yamldb_autodetect.cpp
diff --git a/test/clang-tidy/Inputs/Headers/stdio.h b/test/clang-tidy/Inputs/Headers/stdio.h
new file mode 100644
index 00000000..eebe9fd9
--- /dev/null
+++ b/test/clang-tidy/Inputs/Headers/stdio.h
@@ -0,0 +1,18 @@
+//===--- stdio.h - Stub header for tests ------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _STDIO_H_
+#define _STDIO_H_
+
+// A header intended to contain C standard input and output library
+// declarations.
+
+int printf(const char *, ...);
+
+#endif // _STDIO_H_
+
diff --git a/test/clang-tidy/Inputs/absl/time/time.h b/test/clang-tidy/Inputs/absl/time/time.h
index 9d136a5d..5454f978 100644
--- a/test/clang-tidy/Inputs/absl/time/time.h
+++ b/test/clang-tidy/Inputs/absl/time/time.h
@@ -14,11 +14,14 @@ public:
Duration &operator/=(float r);
Duration &operator/=(double r);
template <typename T> Duration &operator/=(T r);
+
+ Duration &operator+(Duration d);
};
template <typename T> Duration operator*(Duration lhs, T rhs);
template <typename T> Duration operator*(T lhs, Duration rhs);
template <typename T> Duration operator/(Duration lhs, T rhs);
+int64_t operator/(Duration lhs, Duration rhs);
class Time{};
@@ -55,6 +58,21 @@ int64_t ToInt64Milliseconds(Duration d);
int64_t ToInt64Microseconds(Duration d);
int64_t ToInt64Nanoseconds(Duration d);
+int64_t ToUnixHours(Time t);
+int64_t ToUnixMinutes(Time t);
+int64_t ToUnixSeconds(Time t);
+int64_t ToUnixMillis(Time t);
+int64_t ToUnixMicros(Time t);
+int64_t ToUnixNanos(Time t);
+Time FromUnixHours(int64_t);
+Time FromUnixMinutes(int64_t);
+Time FromUnixSeconds(int64_t);
+Time FromUnixMillis(int64_t);
+Time FromUnixMicros(int64_t);
+Time FromUnixNanos(int64_t);
+
+Time Now();
+
// Relational Operators
constexpr bool operator<(Duration lhs, Duration rhs);
constexpr bool operator>(Duration lhs, Duration rhs);
@@ -69,4 +87,6 @@ inline Time operator+(Duration lhs, Time rhs);
inline Time operator-(Time lhs, Duration rhs);
inline Duration operator-(Time lhs, Time rhs);
+double FDivDuration(Duration num, Duration den);
+
} // namespace absl
diff --git a/test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/a.h b/test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/a.h
new file mode 100644
index 00000000..6651b4fa
--- /dev/null
+++ b/test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/a.h
@@ -0,0 +1 @@
+#define a
diff --git a/test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/b.h b/test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/b.h
new file mode 100644
index 00000000..446eda1a
--- /dev/null
+++ b/test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/b.h
@@ -0,0 +1,2 @@
+#include "a.h"
+#define b
diff --git a/test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/c.h b/test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/c.h
new file mode 100644
index 00000000..0d4c60df
--- /dev/null
+++ b/test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/c.h
@@ -0,0 +1,2 @@
+#include "b.h"
+#define c
diff --git a/test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/module.modulemap b/test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/module.modulemap
new file mode 100644
index 00000000..d04240af
--- /dev/null
+++ b/test/clang-tidy/Inputs/expand-modular-headers-ppcallbacks/module.modulemap
@@ -0,0 +1,3 @@
+module a { header "a.h" export * }
+module b { header "b.h" export * use a }
+module c { header "c.h" export * use b }
diff --git a/test/clang-tidy/abseil-duration-addition.cpp b/test/clang-tidy/abseil-duration-addition.cpp
new file mode 100644
index 00000000..33cfc58f
--- /dev/null
+++ b/test/clang-tidy/abseil-duration-addition.cpp
@@ -0,0 +1,98 @@
+// RUN: %check_clang_tidy %s abseil-duration-addition %t -- -- -I%S/Inputs
+
+#include "absl/time/time.h"
+
+void f() {
+ absl::Time t;
+ int i;
+
+ i = absl::ToUnixHours(t) + 5;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixHours(t + absl::Hours(5))
+ i = absl::ToUnixMinutes(t) + 5;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixMinutes(t + absl::Minutes(5))
+ i = absl::ToUnixSeconds(t) + 5;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixSeconds(t + absl::Seconds(5))
+ i = absl::ToUnixMillis(t) + 5;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixMillis(t + absl::Milliseconds(5))
+ i = absl::ToUnixMicros(t) + 5;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixMicros(t + absl::Microseconds(5))
+ i = absl::ToUnixNanos(t) + 5;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixNanos(t + absl::Nanoseconds(5))
+
+ i = 3 + absl::ToUnixHours(t);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixHours(absl::Hours(3) + t)
+ i = 3 + absl::ToUnixMinutes(t);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixMinutes(absl::Minutes(3) + t)
+ i = 3 + absl::ToUnixSeconds(t);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixSeconds(absl::Seconds(3) + t)
+ i = 3 + absl::ToUnixMillis(t);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixMillis(absl::Milliseconds(3) + t)
+ i = 3 + absl::ToUnixMicros(t);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixMicros(absl::Microseconds(3) + t)
+ i = 3 + absl::ToUnixNanos(t);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixNanos(absl::Nanoseconds(3) + t)
+
+ // Undoing inverse conversions
+ i = absl::ToUnixMicros(t) + absl::ToInt64Microseconds(absl::Seconds(1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixMicros(t + absl::Seconds(1))
+
+ // Parens
+ i = 3 + (absl::ToUnixHours(t));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixHours(absl::Hours(3) + t)
+
+ // Float folding
+ i = absl::ToUnixSeconds(t) + 5.0;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixSeconds(t + absl::Seconds(5))
+
+ // We can rewrite the argument of the duration conversion
+#define THIRTY absl::FromUnixSeconds(30)
+ i = absl::ToUnixSeconds(THIRTY) + 1;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixSeconds(THIRTY + absl::Seconds(1))
+#undef THIRTY
+
+ // Some other contexts
+ if (absl::ToUnixSeconds(t) + 1.0 > 10) {}
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixSeconds(t + absl::Seconds(1))
+
+ // These should not match
+ i = 5 + 6;
+ i = absl::ToUnixSeconds(t) - 1.0;
+ i = absl::ToUnixSeconds(t) * 1.0;
+ i = absl::ToUnixSeconds(t) / 1.0;
+ i += absl::ToInt64Microseconds(absl::Seconds(1));
+
+#define PLUS_FIVE(z) absl::ToUnixSeconds(z) + 5
+ i = PLUS_FIVE(t);
+#undef PLUS_FIVE
+}
+
+// Within a templated function
+template<typename T>
+void foo(absl::Time t) {
+ int i = absl::ToUnixNanos(t) + T{};
+ // CHECK-MESSAGES: [[@LINE-1]]:11: warning: perform addition in the duration domain [abseil-duration-addition]
+ // CHECK-FIXES: absl::ToUnixNanos(t + absl::Nanoseconds(T{}))
+}
+
+void g() {
+ absl::Time t;
+ foo<int>(t);
+ foo<double>(t);
+}
diff --git a/test/clang-tidy/abseil-duration-conversion-cast.cpp b/test/clang-tidy/abseil-duration-conversion-cast.cpp
new file mode 100644
index 00000000..260aa327
--- /dev/null
+++ b/test/clang-tidy/abseil-duration-conversion-cast.cpp
@@ -0,0 +1,95 @@
+// RUN: %check_clang_tidy %s abseil-duration-conversion-cast %t -- -- -I%S/Inputs
+
+#include "absl/time/time.h"
+
+void f() {
+ absl::Duration d1;
+ double x;
+ int i;
+
+ i = static_cast<int>(absl::ToDoubleHours(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to an integer rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToInt64Hours(d1);
+ x = static_cast<float>(absl::ToInt64Hours(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to a floating-piont number rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToDoubleHours(d1);
+ i = static_cast<int>(absl::ToDoubleMinutes(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to an integer rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToInt64Minutes(d1);
+ x = static_cast<float>(absl::ToInt64Minutes(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to a floating-piont number rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToDoubleMinutes(d1);
+ i = static_cast<int>(absl::ToDoubleSeconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to an integer rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToInt64Seconds(d1);
+ x = static_cast<float>(absl::ToInt64Seconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to a floating-piont number rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToDoubleSeconds(d1);
+ i = static_cast<int>(absl::ToDoubleMilliseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to an integer rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToInt64Milliseconds(d1);
+ x = static_cast<float>(absl::ToInt64Milliseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to a floating-piont number rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToDoubleMilliseconds(d1);
+ i = static_cast<int>(absl::ToDoubleMicroseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to an integer rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToInt64Microseconds(d1);
+ x = static_cast<float>(absl::ToInt64Microseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to a floating-piont number rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToDoubleMicroseconds(d1);
+ i = static_cast<int>(absl::ToDoubleNanoseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to an integer rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToInt64Nanoseconds(d1);
+ x = static_cast<float>(absl::ToInt64Nanoseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to a floating-piont number rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToDoubleNanoseconds(d1);
+
+ // Functional-style casts
+ i = int(absl::ToDoubleHours(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to an integer rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToInt64Hours(d1);
+ x = float(absl::ToInt64Microseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to a floating-piont number rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToDoubleMicroseconds(d1);
+
+ // C-style casts
+ i = (int) absl::ToDoubleHours(d1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to an integer rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToInt64Hours(d1);
+ x = (float) absl::ToInt64Microseconds(d1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: duration should be converted directly to a floating-piont number rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToDoubleMicroseconds(d1);
+
+ // Type aliasing
+ typedef int FancyInt;
+ typedef float FancyFloat;
+
+ FancyInt j = static_cast<FancyInt>(absl::ToDoubleHours(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:16: warning: duration should be converted directly to an integer rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToInt64Hours(d1);
+ FancyFloat k = static_cast<FancyFloat>(absl::ToInt64Microseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:18: warning: duration should be converted directly to a floating-piont number rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: absl::ToDoubleMicroseconds(d1);
+
+ // Macro handling
+ // We want to transform things in macro arguments
+#define EXTERNAL(x) (x) + 5
+ i = EXTERNAL(static_cast<int>(absl::ToDoubleSeconds(d1)));
+ // CHECK-MESSAGES: [[@LINE-1]]:16: warning: duration should be converted directly to an integer rather than through a type cast [abseil-duration-conversion-cast]
+ // CHECK-FIXES: EXTERNAL(absl::ToInt64Seconds(d1));
+#undef EXTERNAL
+
+ // We don't want to transform this which get split across macro boundaries
+#define SPLIT(x) static_cast<int>((x)) + 5
+ i = SPLIT(absl::ToDoubleSeconds(d1));
+#undef SPLIT
+
+ // We also don't want to transform things inside of a macro definition
+#define INTERNAL(x) static_cast<int>(absl::ToDoubleSeconds((x))) + 5
+ i = INTERNAL(d1);
+#undef INTERNAL
+
+ // These shouldn't be converted
+ i = static_cast<int>(absl::ToInt64Seconds(d1));
+ i = static_cast<float>(absl::ToDoubleSeconds(d1));
+}
diff --git a/test/clang-tidy/abseil-duration-unnecessary-conversion.cpp b/test/clang-tidy/abseil-duration-unnecessary-conversion.cpp
new file mode 100644
index 00000000..d32837f8
--- /dev/null
+++ b/test/clang-tidy/abseil-duration-unnecessary-conversion.cpp
@@ -0,0 +1,111 @@
+// RUN: %check_clang_tidy %s abseil-duration-unnecessary-conversion %t -- -- -I%S/Inputs
+
+#include "absl/time/time.h"
+
+void f() {
+ absl::Duration d1, d2;
+
+ // Floating point
+ d2 = absl::Hours(absl::ToDoubleHours(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Minutes(absl::ToDoubleMinutes(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Seconds(absl::ToDoubleSeconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Milliseconds(absl::ToDoubleMilliseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Microseconds(absl::ToDoubleMicroseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Nanoseconds(absl::ToDoubleNanoseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+
+ // Integer point
+ d2 = absl::Hours(absl::ToInt64Hours(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Minutes(absl::ToInt64Minutes(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Seconds(absl::ToInt64Seconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Milliseconds(absl::ToInt64Milliseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Microseconds(absl::ToInt64Microseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Nanoseconds(absl::ToInt64Nanoseconds(d1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+
+ d2 = absl::Hours(d1 / absl::Hours(1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Minutes(d1 / absl::Minutes(1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Seconds(d1 / absl::Seconds(1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Milliseconds(d1 / absl::Milliseconds(1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Microseconds(d1 / absl::Microseconds(1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Nanoseconds(d1 / absl::Nanoseconds(1));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+
+ d2 = absl::Hours(absl::FDivDuration(d1, absl::Hours(1)));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Minutes(absl::FDivDuration(d1, absl::Minutes(1)));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Seconds(absl::FDivDuration(d1, absl::Seconds(1)));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Milliseconds(absl::FDivDuration(d1, absl::Milliseconds(1)));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Microseconds(absl::FDivDuration(d1, absl::Microseconds(1)));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+ d2 = absl::Nanoseconds(absl::FDivDuration(d1, absl::Nanoseconds(1)));
+ // CHECK-MESSAGES: [[@LINE-1]]:8: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: d2 = d1
+
+ // As macro argument
+#define PLUS_FIVE_S(x) x + absl::Seconds(5)
+ d2 = PLUS_FIVE_S(absl::Seconds(absl::ToInt64Seconds(d1)));
+ // CHECK-MESSAGES: [[@LINE-1]]:20: warning: remove unnecessary absl::Duration conversions [abseil-duration-unnecessary-conversion]
+ // CHECK-FIXES: PLUS_FIVE_S(d1)
+#undef PLUS_FIVE_S
+
+ // Split by macro: should not change
+#define TOSECONDS(x) absl::Seconds(x)
+ d2 = TOSECONDS(absl::ToInt64Seconds(d1));
+#undef TOSECONDS
+
+ // Don't change something inside a macro definition
+#define VALUE(x) absl::Hours(absl::ToInt64Hours(x));
+ d2 = VALUE(d1);
+#undef VALUE
+
+ // These should not match
+ d2 = absl::Seconds(absl::ToDoubleMilliseconds(d1));
+ d2 = absl::Seconds(4);
+ int i = absl::ToInt64Milliseconds(d1);
+ d2 = absl::Hours(d1 / absl::Minutes(1));
+ d2 = absl::Seconds(d1 / absl::Seconds(30));
+ d2 = absl::Hours(absl::FDivDuration(d1, absl::Minutes(1)));
+ d2 = absl::Milliseconds(absl::FDivDuration(d1, absl::Milliseconds(20)));
+}
diff --git a/test/clang-tidy/abseil-time-comparison.cpp b/test/clang-tidy/abseil-time-comparison.cpp
new file mode 100644
index 00000000..ab03020c
--- /dev/null
+++ b/test/clang-tidy/abseil-time-comparison.cpp
@@ -0,0 +1,129 @@
+// RUN: %check_clang_tidy %s abseil-time-comparison %t -- -- -I%S/Inputs
+
+#include "absl/time/time.h"
+
+void f() {
+ double x;
+ absl::Duration d1, d2;
+ bool b;
+ absl::Time t1, t2;
+
+ // Check against the RHS
+ b = x > absl::ToUnixSeconds(t1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: absl::FromUnixSeconds(x) > t1;
+ b = x >= absl::ToUnixSeconds(t1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: absl::FromUnixSeconds(x) >= t1;
+ b = x == absl::ToUnixSeconds(t1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: absl::FromUnixSeconds(x) == t1;
+ b = x <= absl::ToUnixSeconds(t1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: absl::FromUnixSeconds(x) <= t1;
+ b = x < absl::ToUnixSeconds(t1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: absl::FromUnixSeconds(x) < t1;
+ b = x == absl::ToUnixSeconds(t1 - d2);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: absl::FromUnixSeconds(x) == t1 - d2;
+ b = absl::ToUnixSeconds(t1) > absl::ToUnixSeconds(t2);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: t1 > t2;
+
+ // Check against the LHS
+ b = absl::ToUnixSeconds(t1) < x;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: t1 < absl::FromUnixSeconds(x);
+ b = absl::ToUnixSeconds(t1) <= x;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: t1 <= absl::FromUnixSeconds(x);
+ b = absl::ToUnixSeconds(t1) == x;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: t1 == absl::FromUnixSeconds(x);
+ b = absl::ToUnixSeconds(t1) >= x;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: t1 >= absl::FromUnixSeconds(x);
+ b = absl::ToUnixSeconds(t1) > x;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: t1 > absl::FromUnixSeconds(x);
+
+ // Comparison against zero
+ b = absl::ToUnixSeconds(t1) < 0.0;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: t1 < absl::UnixEpoch();
+ b = absl::ToUnixSeconds(t1) < 0;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: t1 < absl::UnixEpoch();
+
+ // Scales other than Seconds
+ b = x > absl::ToUnixMicros(t1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: absl::FromUnixMicros(x) > t1;
+ b = x >= absl::ToUnixMillis(t1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: absl::FromUnixMillis(x) >= t1;
+ b = x == absl::ToUnixNanos(t1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: absl::FromUnixNanos(x) == t1;
+ b = x <= absl::ToUnixMinutes(t1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: absl::FromUnixMinutes(x) <= t1;
+ b = x < absl::ToUnixHours(t1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: absl::FromUnixHours(x) < t1;
+
+ // A long expression
+ bool some_condition;
+ int very_very_very_very_long_variable_name;
+ absl::Time SomeTime;
+ if (some_condition && very_very_very_very_long_variable_name
+ < absl::ToUnixSeconds(SomeTime)) {
+ // CHECK-MESSAGES: [[@LINE-2]]:25: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: if (some_condition && absl::FromUnixSeconds(very_very_very_very_long_variable_name) < SomeTime) {
+ return;
+ }
+
+ // A complex expression
+ int y;
+ b = (y + 5) * 10 > absl::ToUnixMillis(t1);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: absl::FromUnixMillis((y + 5) * 10) > t1;
+
+ // We should still transform the expression inside this macro invocation
+#define VALUE_IF(v, e) v ? (e) : 0
+ int a = VALUE_IF(1, 5 > absl::ToUnixSeconds(t1));
+ // CHECK-MESSAGES: [[@LINE-1]]:23: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: VALUE_IF(1, absl::FromUnixSeconds(5) > t1);
+#undef VALUE_IF
+
+#define VALUE_IF_2(e) (e)
+#define VALUE_IF(v, e) v ? VALUE_IF_2(e) : VALUE_IF_2(0)
+ int a2 = VALUE_IF(1, 5 > absl::ToUnixSeconds(t1));
+ // CHECK-MESSAGES: [[@LINE-1]]:24: warning: perform comparison in the time domain [abseil-time-comparison]
+ // CHECK-FIXES: VALUE_IF(1, absl::FromUnixSeconds(5) > t1);
+#undef VALUE_IF
+#undef VALUE_IF_2
+
+#define VALUE_IF_2(e) (e)
+#define VALUE_IF(v, e, type) (v ? VALUE_IF_2(absl::To##type##Seconds(e)) : 0)
+ int a3 = VALUE_IF(1, t1, Unix);
+#undef VALUE_IF
+#undef VALUE_IF_2
+
+#define VALUE_IF_2(e) (e)
+#define VALUE_IF(v, e, type) (v ? (5 > VALUE_IF_2(absl::To##type##Seconds(e))) : 0)
+ int a4 = VALUE_IF(1, t1, Unix);
+#undef VALUE_IF
+#undef VALUE_IF_2
+
+ // These should not match
+ b = 6 < 4;
+
+#define TODOUBLE(x) absl::ToUnixSeconds(x)
+ b = 5.0 > TODOUBLE(t1);
+#undef TODOUBLE
+#define THIRTY 30.0
+ b = THIRTY > absl::ToUnixSeconds(t1);
+#undef THIRTY
+}
diff --git a/test/clang-tidy/abseil-time-subtraction.cpp b/test/clang-tidy/abseil-time-subtraction.cpp
new file mode 100644
index 00000000..6f5d4b45
--- /dev/null
+++ b/test/clang-tidy/abseil-time-subtraction.cpp
@@ -0,0 +1,117 @@
+// RUN: %check_clang_tidy %s abseil-time-subtraction %t -- -- -I%S/Inputs
+
+#include "absl/time/time.h"
+
+void g(absl::Duration d);
+
+void f() {
+ absl::Time t;
+ int x, y;
+ absl::Duration d;
+
+ d = absl::Hours(absl::ToUnixHours(t) - x);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: d = (t - absl::FromUnixHours(x));
+ d = absl::Minutes(absl::ToUnixMinutes(t) - x);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: d = (t - absl::FromUnixMinutes(x));
+ d = absl::Seconds(absl::ToUnixSeconds(t) - x);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: d = (t - absl::FromUnixSeconds(x));
+ d = absl::Milliseconds(absl::ToUnixMillis(t) - x);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: d = (t - absl::FromUnixMillis(x));
+ d = absl::Microseconds(absl::ToUnixMicros(t) - x);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: d = (t - absl::FromUnixMicros(x));
+ d = absl::Nanoseconds(absl::ToUnixNanos(t) - x);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: d = (t - absl::FromUnixNanos(x));
+
+ y = x - absl::ToUnixHours(t);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: y = absl::ToInt64Hours(absl::FromUnixHours(x) - t);
+ y = x - absl::ToUnixMinutes(t);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: y = absl::ToInt64Minutes(absl::FromUnixMinutes(x) - t);
+ y = x - absl::ToUnixSeconds(t);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: y = absl::ToInt64Seconds(absl::FromUnixSeconds(x) - t);
+ y = x - absl::ToUnixMillis(t);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: y = absl::ToInt64Milliseconds(absl::FromUnixMillis(x) - t);
+ y = x - absl::ToUnixMicros(t);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: y = absl::ToInt64Microseconds(absl::FromUnixMicros(x) - t);
+ y = x - absl::ToUnixNanos(t);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: y = absl::ToInt64Nanoseconds(absl::FromUnixNanos(x) - t);
+
+ // Check parenthesis placement
+ d = 5 * absl::Seconds(absl::ToUnixSeconds(t) - x);
+ // CHECK-MESSAGES: [[@LINE-1]]:11: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: d = 5 * (t - absl::FromUnixSeconds(x));
+ d = absl::Seconds(absl::ToUnixSeconds(t) - x) / 5;
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: d = (t - absl::FromUnixSeconds(x)) / 5;
+
+ // No extra parens around arguments
+ g(absl::Seconds(absl::ToUnixSeconds(t) - x));
+ // CHECK-MESSAGES: [[@LINE-1]]:5: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: g(t - absl::FromUnixSeconds(x));
+ g(absl::Seconds(x - absl::ToUnixSeconds(t)));
+ // CHECK-MESSAGES: [[@LINE-1]]:5: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: g(absl::FromUnixSeconds(x) - t);
+
+ // More complex subexpressions
+ d = absl::Hours(absl::ToUnixHours(t) - 5 * x);
+ // CHECK-MESSAGES: [[@LINE-1]]:7: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: d = (t - absl::FromUnixHours(5 * x));
+
+ // These should not trigger; they are likely bugs
+ d = absl::Milliseconds(absl::ToUnixSeconds(t) - x);
+ d = absl::Seconds(absl::ToUnixMicros(t) - x);
+
+ // Various macro scenarios
+#define SUB(z, t1) z - absl::ToUnixSeconds(t1)
+ y = SUB(x, t);
+#undef SUB
+
+#define MILLIS(t1) absl::ToUnixMillis(t1)
+ y = x - MILLIS(t);
+#undef MILLIS
+
+#define HOURS(z) absl::Hours(z)
+ d = HOURS(absl::ToUnixHours(t) - x);
+#undef HOURS
+
+ // This should match the expression inside the macro invocation.
+#define SECONDS(z) absl::Seconds(z)
+ d = SECONDS(x - absl::ToUnixSeconds(t));
+ // CHECK-MESSAGES: [[@LINE-1]]:15: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: SECONDS(absl::ToInt64Seconds(absl::FromUnixSeconds(x) - t))
+#undef SECONDS
+}
+
+template<typename T>
+void func(absl::Time t, T x) {
+ absl::Duration d = absl::Seconds(absl::ToUnixSeconds(t) - x);
+ // CHECK-MESSAGES: [[@LINE-1]]:22: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: absl::Duration d = t - absl::FromUnixSeconds(x);
+}
+
+void g() {
+ func(absl::Now(), 5);
+}
+
+absl::Duration parens_in_return() {
+ absl::Time t;
+ int x;
+
+ return absl::Seconds(absl::ToUnixSeconds(t) - x);
+ // CHECK-MESSAGES: [[@LINE-1]]:10: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: return t - absl::FromUnixSeconds(x);
+ return absl::Seconds(x - absl::ToUnixSeconds(t));
+ // CHECK-MESSAGES: [[@LINE-1]]:10: warning: perform subtraction in the time domain [abseil-time-subtraction]
+ // CHECK-FIXES: return absl::FromUnixSeconds(x) - t;
+}
diff --git a/test/clang-tidy/abseil-upgrade-duration-conversions.cpp b/test/clang-tidy/abseil-upgrade-duration-conversions.cpp
index 7d8ad43e..fed0f8bd 100644
--- a/test/clang-tidy/abseil-upgrade-duration-conversions.cpp
+++ b/test/clang-tidy/abseil-upgrade-duration-conversions.cpp
@@ -430,3 +430,36 @@ void factoryInMacros() {
factoryTemplateAndMacro<ConvertibleTo<int>>();
TemplateFactoryInMacro(ConvertibleTo<int>());
}
+
+// This is a reduced test-case for PR39949 and manifested in this check.
+namespace std {
+template <typename _Tp>
+_Tp declval();
+
+template <typename _Functor, typename... _ArgTypes>
+struct __res {
+ template <typename... _Args>
+ static decltype(declval<_Functor>()(_Args()...)) _S_test(int);
+
+ template <typename...>
+ static void _S_test(...);
+
+ typedef decltype(_S_test<_ArgTypes...>(0)) type;
+};
+
+template <typename>
+struct function;
+
+template <typename... _ArgTypes>
+struct function<void(_ArgTypes...)> {
+ template <typename _Functor,
+ typename = typename __res<_Functor, _ArgTypes...>::type>
+ function(_Functor) {}
+};
+} // namespace std
+
+typedef std::function<void(void)> F;
+
+F foo() {
+ return F([] {});
+}
diff --git a/test/clang-tidy/alternative-fixes.cpp b/test/clang-tidy/alternative-fixes.cpp
new file mode 100644
index 00000000..d5cee68d
--- /dev/null
+++ b/test/clang-tidy/alternative-fixes.cpp
@@ -0,0 +1,9 @@
+// RUN: %check_clang_tidy %s "llvm-namespace-comment,clang-diagnostic-*" %t
+void foo(int a) {
+ if (a = 1) {
+ // CHECK-NOTES: [[@LINE-1]]:9: warning: using the result of an assignment as a condition without parentheses [clang-diagnostic-parentheses]
+ // CHECK-NOTES: [[@LINE-2]]:9: note: place parentheses around the assignment to silence this warning
+ // CHECK-NOTES: [[@LINE-3]]:9: note: use '==' to turn this assignment into an equality comparison
+ // CHECK-FIXES: if ((a = 1)) {
+ }
+}
diff --git a/test/clang-tidy/bugprone-argument-comment-literals.cpp b/test/clang-tidy/bugprone-argument-comment-literals.cpp
new file mode 100644
index 00000000..739c9a59
--- /dev/null
+++ b/test/clang-tidy/bugprone-argument-comment-literals.cpp
@@ -0,0 +1,124 @@
+// RUN: %check_clang_tidy %s bugprone-argument-comment %t -- \
+// RUN: -config="{CheckOptions: [{key: CommentBoolLiterals, value: 1},{key: CommentIntegerLiterals, value: 1}, {key: CommentFloatLiterals, value: 1}, {key: CommentUserDefinedLiterals, value: 1}, {key: CommentStringLiterals, value: 1}, {key: CommentNullPtrs, value: 1}, {key: CommentCharacterLiterals, value: 1}]}" --
+
+struct A {
+ void foo(bool abc);
+ void foo(bool abc, bool cde);
+ void foo(const char *, bool abc);
+ void foo(int iabc);
+ void foo(float fabc);
+ void foo(double dabc);
+ void foo(const char *strabc);
+ void fooW(const wchar_t *wstrabc);
+ void fooPtr(A *ptrabc);
+ void foo(char chabc);
+};
+
+#define FOO 1
+
+void g(int a);
+void h(double b);
+void i(const char *c);
+
+double operator"" _km(long double);
+
+void test() {
+ A a;
+
+ a.foo(true);
+ // CHECK-MESSAGES: [[@LINE-1]]:9: warning: argument comment missing for literal argument 'abc' [bugprone-argument-comment]
+ // CHECK-FIXES: a.foo(/*abc=*/true);
+
+ a.foo(false);
+ // CHECK-MESSAGES: [[@LINE-1]]:9: warning: argument comment missing for literal argument 'abc' [bugprone-argument-comment]
+ // CHECK-FIXES: a.foo(/*abc=*/false);
+
+ a.foo(true, false);
+ // CHECK-MESSAGES: [[@LINE-1]]:9: warning: argument comment missing for literal argument 'abc' [bugprone-argument-comment]
+ // CHECK-MESSAGES: [[@LINE-2]]:15: warning: argument comment missing for literal argument 'cde' [bugprone-argument-comment]
+ // CHECK-FIXES: a.foo(/*abc=*/true, /*cde=*/false);
+
+ a.foo(false, true);
+ // CHECK-MESSAGES: [[@LINE-1]]:9: warning: argument comment missing for literal argument 'abc' [bugprone-argument-comment]
+ // CHECK-MESSAGES: [[@LINE-2]]:16: warning: argument comment missing for literal argument 'cde' [bugprone-argument-comment]
+ // CHECK-FIXES: a.foo(/*abc=*/false, /*cde=*/true);
+
+ a.foo(/*abc=*/false, true);
+ // CHECK-MESSAGES: [[@LINE-1]]:24: warning: argument comment missing for literal argument 'cde' [bugprone-argument-comment]
+ // CHECK-FIXES: a.foo(/*abc=*/false, /*cde=*/true);
+
+ a.foo(false, /*cde=*/true);
+ // CHECK-MESSAGES: [[@LINE-1]]:9: warning: argument comment missing for literal argument 'abc' [bugprone-argument-comment]
+ // CHECK-FIXES: a.foo(/*abc=*/false, /*cde=*/true);
+
+ bool val1 = true;
+ bool val2 = false;
+ a.foo(val1, val2);
+
+ a.foo("", true);
+ // CHECK-MESSAGES: [[@LINE-1]]:13: warning: argument comment missing for literal argument 'abc' [bugprone-argument-comment]
+ // CHECK-FIXES: a.foo("", /*abc=*/true);
+
+ a.foo(0);
+ // CHECK-MESSAGES: [[@LINE-1]]:9: warning: argument comment missing for literal argument 'iabc' [bugprone-argument-comment]
+ // CHECK-FIXES: a.foo(/*iabc=*/0);
+
+ a.foo(1.0f);
+ // CHECK-MESSAGES: [[@LINE-1]]:9: warning: argument comment missing for literal argument 'fabc' [bugprone-argument-comment]
+ // CHECK-FIXES: a.foo(/*fabc=*/1.0f);
+
+ a.foo(1.0);
+ // CHECK-MESSAGES: [[@LINE-1]]:9: warning: argument comment missing for literal argument 'dabc' [bugprone-argument-comment]
+ // CHECK-FIXES: a.foo(/*dabc=*/1.0);
+
+ int val3 = 10;
+ a.foo(val3);
+
+ float val4 = 10.0;
+ a.foo(val4);
+
+ double val5 = 10.0;
+ a.foo(val5);
+
+ a.foo("Hello World");
+ // CHECK-MESSAGES: [[@LINE-1]]:9: warning: argument comment missing for literal argument 'strabc' [bugprone-argument-comment]
+ // CHECK-FIXES: a.foo(/*strabc=*/"Hello World");
+ //
+ a.fooW(L"Hello World");
+ // CHECK-MESSAGES: [[@LINE-1]]:10: warning: argument comment missing for literal argument 'wstrabc' [bugprone-argument-comment]
+ // CHECK-FIXES: a.fooW(/*wstrabc=*/L"Hello World");
+
+ a.fooPtr(nullptr);
+ // CHECK-MESSAGES: [[@LINE-1]]:12: warning: argument comment missing for literal argument 'ptrabc' [bugprone-argument-comment]
+ // CHECK-FIXES: a.fooPtr(/*ptrabc=*/nullptr);
+
+ a.foo(402.0_km);
+ // CHECK-MESSAGES: [[@LINE-1]]:9: warning: argument comment missing for literal argument 'dabc' [bugprone-argument-comment]
+ // CHECK-FIXES: a.foo(/*dabc=*/402.0_km);
+
+ a.foo('A');
+ // CHECK-MESSAGES: [[@LINE-1]]:9: warning: argument comment missing for literal argument 'chabc' [bugprone-argument-comment]
+ // CHECK-FIXES: a.foo(/*chabc=*/'A');
+
+ g(FOO);
+ h(1.0f);
+ // CHECK-MESSAGES: [[@LINE-1]]:5: warning: argument comment missing for literal argument 'b' [bugprone-argument-comment]
+ // CHECK-FIXES: h(/*b=*/1.0f);
+ i(__FILE__);
+
+ // FIXME Would like the below to add argument comments.
+ g((1));
+ // FIXME But we should not add argument comments here.
+ g(_Generic(0, int : 0));
+}
+
+void f(bool _with_underscores_);
+void ignores_underscores() {
+ f(false);
+ // CHECK-MESSAGES: [[@LINE-1]]:5: warning: argument comment missing for literal argument '_with_underscores_' [bugprone-argument-comment]
+ // CHECK-FIXES: f(/*_with_underscores_=*/false);
+
+ f(true);
+ // CHECK-MESSAGES: [[@LINE-1]]:5: warning: argument comment missing for literal argument
+ // CHECK-FIXES: f(/*_with_underscores_=*/true);
+}
diff --git a/test/clang-tidy/bugprone-exception-escape-openmp.cpp b/test/clang-tidy/bugprone-exception-escape-openmp.cpp
new file mode 100644
index 00000000..101c339b
--- /dev/null
+++ b/test/clang-tidy/bugprone-exception-escape-openmp.cpp
@@ -0,0 +1,29 @@
+// RUN: %check_clang_tidy %s bugprone-exception-escape %t -- -extra-arg=-fopenmp=libomp -extra-arg=-fexceptions --
+
+int thrower() {
+ throw 42;
+}
+
+void ok_parallel() {
+#pragma omp parallel
+ thrower();
+}
+
+void bad_for_header_XFAIL(const int a) noexcept {
+#pragma omp for
+ for (int i = 0; i < thrower(); i++)
+ ;
+ // FIXME: this really should be caught by bugprone-exception-escape.
+ // https://bugs.llvm.org/show_bug.cgi?id=41102
+}
+
+void ok_forloop(const int a) {
+#pragma omp for
+ for (int i = 0; i < a; i++)
+ thrower();
+}
+
+void some_exception_just_so_that_check_clang_tidy_shuts_up() noexcept {
+ thrower();
+}
+// CHECK-MESSAGES: :[[@LINE-3]]:6: warning: an exception may be thrown in function 'some_exception_just_so_that_check_clang_tidy_shuts_up' which should not throw exceptions
diff --git a/test/clang-tidy/bugprone-parent-virtual-call.cpp b/test/clang-tidy/bugprone-parent-virtual-call.cpp
index ad845886..ad845886 100755..100644
--- a/test/clang-tidy/bugprone-parent-virtual-call.cpp
+++ b/test/clang-tidy/bugprone-parent-virtual-call.cpp
diff --git a/test/clang-tidy/bugprone-sizeof-expression.cpp b/test/clang-tidy/bugprone-sizeof-expression.cpp
index 683ad083..57b73ea4 100644
--- a/test/clang-tidy/bugprone-sizeof-expression.cpp
+++ b/test/clang-tidy/bugprone-sizeof-expression.cpp
@@ -231,6 +231,35 @@ int Test5() {
return sum;
}
+int Test6() {
+ int sum = 0;
+
+ struct S A = AsStruct(), B = AsStruct();
+ struct S *P = &A, *Q = &B;
+ sum += sizeof(struct S) == P - Q;
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(...)' in pointer arithmetic
+ sum += 5 * sizeof(S) != P - Q;
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(...)' in pointer arithmetic
+ sum += sizeof(S) < P - Q;
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(...)' in pointer arithmetic
+ sum += 5 * sizeof(S) <= P - Q;
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(...)' in pointer arithmetic
+ sum += 5 * sizeof(*P) >= P - Q;
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(...)' in pointer arithmetic
+ sum += Q - P > 3 * sizeof(*P);
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(...)' in pointer arithmetic
+ sum += sizeof(S) + (P - Q);
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(...)' in pointer arithmetic
+ sum += 5 * sizeof(S) - (P - Q);
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(...)' in pointer arithmetic
+ sum += (P - Q) / sizeof(S);
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(...)' in pointer arithmetic
+ sum += (P - Q) / sizeof(*Q);
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(...)' in pointer arithmetic
+
+ return sum;
+}
+
int ValidExpressions() {
int A[] = {1, 2, 3, 4};
static const char str[] = "hello";
diff --git a/test/clang-tidy/bugprone-string-constructor.cpp b/test/clang-tidy/bugprone-string-constructor.cpp
index 3ab4f424..9e11a32a 100644
--- a/test/clang-tidy/bugprone-string-constructor.cpp
+++ b/test/clang-tidy/bugprone-string-constructor.cpp
@@ -65,3 +65,11 @@ void Valid() {
std::string s2("test", 3);
std::string s3("test");
}
+
+namespace instantiation_dependent_exprs {
+template<typename T>
+struct S {
+ bool x;
+ std::string f() { return x ? "a" : "b"; }
+};
+}
diff --git a/test/clang-tidy/bugprone-string-integer-assignment.cpp b/test/clang-tidy/bugprone-string-integer-assignment.cpp
index c4e13fc4..18fe5ef4 100644
--- a/test/clang-tidy/bugprone-string-integer-assignment.cpp
+++ b/test/clang-tidy/bugprone-string-integer-assignment.cpp
@@ -7,18 +7,29 @@ struct basic_string {
basic_string& operator=(basic_string);
basic_string& operator+=(T);
basic_string& operator+=(basic_string);
+ const T &operator[](int i) const;
+ T &operator[](int i);
};
typedef basic_string<char> string;
typedef basic_string<wchar_t> wstring;
+
+int tolower(int i);
+int toupper(int i);
}
+int tolower(int i);
+int toupper(int i);
+
typedef int MyArcaneChar;
+constexpr char kCharConstant = 'a';
+
int main() {
std::string s;
std::wstring ws;
int x = 5;
+ const char c = 'c';
s = 6;
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: an integer is interpreted as a character code when assigning {{.*}} [bugprone-string-integer-assignment]
@@ -47,7 +58,52 @@ int main() {
std::basic_string<MyArcaneChar> as;
as = 6;
-// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: an integer is interpreted as a chara
-// CHECK-FIXES: {{^}} as = 6;{{$}}
+ as = static_cast<MyArcaneChar>(6);
+ as = 'a';
+
+ s += toupper(x);
+ s += tolower(x);
+ s += (std::tolower(x));
+
+ s += c & s[1];
+ s += c ^ s[1];
+ s += c | s[1];
+
+ s[x] += 1;
+ s += s[x];
+ as += as[x];
+
+ // Likely character expressions.
+ s += x & 0xff;
+ s += 0xff & x;
+ s += x % 26;
+ s += 26 % x;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: an integer is interpreted as a chara
+ // CHECK-FIXES: {{^}} s += std::to_string(26 % x);{{$}}
+ s += c | 0x80;
+ s += c | 0x8000;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: an integer is interpreted as a chara
+ // CHECK-FIXES: {{^}} s += std::to_string(c | 0x8000);{{$}}
+ as += c | 0x8000;
+
+ s += 'a' + (x % 26);
+ s += kCharConstant + (x % 26);
+ s += 'a' + (s[x] & 0xf);
+ s += (x % 10) + 'b';
+
+ s += x > 255 ? c : x;
+ s += x > 255 ? 12 : x;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: an integer is interpreted as a chara
+ // CHECK-FIXES: {{^}} s += std::to_string(x > 255 ? 12 : x);{{$}}
+}
+
+namespace instantiation_dependent_exprs {
+template<typename T>
+struct S {
+ static constexpr T t = 0x8000;
+ std::string s;
+ void f(char c) { s += c | static_cast<int>(t); }
+};
+template S<int>;
}
diff --git a/test/clang-tidy/bugprone-too-small-loop-variable-magniute-bits-upper-limit.cpp b/test/clang-tidy/bugprone-too-small-loop-variable-magniute-bits-upper-limit.cpp
new file mode 100644
index 00000000..d602a1d0
--- /dev/null
+++ b/test/clang-tidy/bugprone-too-small-loop-variable-magniute-bits-upper-limit.cpp
@@ -0,0 +1,23 @@
+// RUN: %check_clang_tidy %s bugprone-too-small-loop-variable %t -- -- --target=x86_64-linux
+
+// MagnitudeBitsUpperLimit = 16 (default value)
+
+unsigned long size() { return 294967296l; }
+
+void voidFilteredOutForLoop1() {
+ for (long i = 0; i < size(); ++i) {
+ // no warning
+ }
+}
+
+void voidCaughtForLoop1() {
+ for (int i = 0; i < size(); ++i) {
+ // no warning
+ }
+}
+
+void voidCaughtForLoop2() {
+ for (short i = 0; i < size(); ++i) {
+ // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: loop variable has narrower type 'short' than iteration's upper bound 'unsigned long' [bugprone-too-small-loop-variable]
+ }
+}
diff --git a/test/clang-tidy/bugprone-too-small-loop-variable.cpp b/test/clang-tidy/bugprone-too-small-loop-variable.cpp
index f11dd499..5a633559 100644
--- a/test/clang-tidy/bugprone-too-small-loop-variable.cpp
+++ b/test/clang-tidy/bugprone-too-small-loop-variable.cpp
@@ -1,4 +1,8 @@
-// RUN: %check_clang_tidy %s bugprone-too-small-loop-variable %t -- -- --target=x86_64-linux
+// RUN: %check_clang_tidy %s bugprone-too-small-loop-variable %t -- \
+// RUN: -config="{CheckOptions: \
+// RUN: [{key: bugprone-too-small-loop-variable.MagnitudeBitsUpperLimit, \
+// RUN: value: 1024}]}" \
+// RUN: -- --target=x86_64-linux
long size() { return 294967296l; }
diff --git a/test/clang-tidy/check_clang_tidy.py b/test/clang-tidy/check_clang_tidy.py
index 9768011a..5d808f40 100755
--- a/test/clang-tidy/check_clang_tidy.py
+++ b/test/clang-tidy/check_clang_tidy.py
@@ -2,10 +2,9 @@
#
#===- check_clang_tidy.py - ClangTidy Test Helper ------------*- python -*--===#
#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------------------------------------------------------------------===#
diff --git a/test/clang-tidy/clang-tidy-diff.cpp b/test/clang-tidy/clang-tidy-diff.cpp
index 146287bf..2e18a43c 100644
--- a/test/clang-tidy/clang-tidy-diff.cpp
+++ b/test/clang-tidy/clang-tidy-diff.cpp
@@ -23,5 +23,4 @@ struct B : public A {
// CHECK-QUIET-NOT: warning:
};
// CHECK-SANITY-NOT: Suppressed
-// CHECK: Suppressed 1 warnings (1 due to line filter).
// CHECK-QUIET-NOT: Suppressed
diff --git a/test/clang-tidy/clang-tidy-mac-libcxx.cpp b/test/clang-tidy/clang-tidy-mac-libcxx.cpp
index 153a5d6e..d124a344 100644
--- a/test/clang-tidy/clang-tidy-mac-libcxx.cpp
+++ b/test/clang-tidy/clang-tidy-mac-libcxx.cpp
@@ -8,7 +8,7 @@
// RUN: cp -r %S/Inputs/mock-libcxx %t/
//
// Pretend clang is installed beside the mock library that we provided.
-// RUN: echo '[{"directory":"%t","command":"%t/mock-libcxx/bin/clang++ -stdlib=libc++ -target x86_64-apple-darwin -c test.cpp","file":"test.cpp"}]' | sed -e 's/\\/\//g' > %t/compile_commands.json
+// RUN: echo '[{"directory":"%t","command":"%t/mock-libcxx/bin/clang++ -stdlib=libc++ -std=c++11 -target x86_64-apple-darwin -c test.cpp","file":"test.cpp"}]' | sed -e 's/\\/\//g' > %t/compile_commands.json
// RUN: cp "%s" "%t/test.cpp"
// RUN: clang-tidy -header-filter='.*' -system-headers -checks='-*,modernize-use-using' "%t/test.cpp" | FileCheck %s
// CHECK: mock_vector:{{[0-9]+}}:{{[0-9]+}}: warning: use 'using' instead of 'typedef'
diff --git a/test/clang-tidy/cppcoreguidelines-macro-usage.cpp b/test/clang-tidy/cppcoreguidelines-macro-usage.cpp
index a4948f5b..edce328e 100644
--- a/test/clang-tidy/cppcoreguidelines-macro-usage.cpp
+++ b/test/clang-tidy/cppcoreguidelines-macro-usage.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s cppcoreguidelines-macro-usage %t
+// RUN: %check_clang_tidy %s cppcoreguidelines-macro-usage %t -- -header-filter=.* -system-headers --
#ifndef INCLUDE_GUARD
#define INCLUDE_GUARD
diff --git a/test/clang-tidy/expand-modular-headers-ppcallbacks.cpp b/test/clang-tidy/expand-modular-headers-ppcallbacks.cpp
new file mode 100644
index 00000000..d191922d
--- /dev/null
+++ b/test/clang-tidy/expand-modular-headers-ppcallbacks.cpp
@@ -0,0 +1,35 @@
+// Sanity-check. Run without modules:
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: cp %S/Inputs/expand-modular-headers-ppcallbacks/* %t/
+// RUN: %check_clang_tidy %s readability-identifier-naming %t/without-modules -- \
+// RUN: -config="CheckOptions: [{ \
+// RUN: key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }]" \
+// RUN: -header-filter=.* \
+// RUN: -- -x c++ -std=c++11 -I%t/
+//
+// Run clang-tidy on a file with modular includes:
+//
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: cp %S/Inputs/expand-modular-headers-ppcallbacks/* %t/
+// RUN: %check_clang_tidy %s readability-identifier-naming %t/with-modules -- \
+// RUN: -config="CheckOptions: [{ \
+// RUN: key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }]" \
+// RUN: -header-filter=.* \
+// RUN: -- -x c++ -std=c++11 -I%t/ \
+// RUN: -fmodules -fimplicit-modules -fno-implicit-module-maps \
+// RUN: -fmodule-map-file=%t/module.modulemap \
+// RUN: -fmodules-cache-path=%t/module-cache/
+#include "c.h"
+
+// CHECK-MESSAGES: a.h:1:9: warning: invalid case style for macro definition 'a' [readability-identifier-naming]
+// CHECK-MESSAGES: a.h:1:9: note: FIX-IT applied suggested code changes
+// CHECK-MESSAGES: b.h:2:9: warning: invalid case style for macro definition 'b'
+// CHECK-MESSAGES: b.h:2:9: note: FIX-IT applied suggested code changes
+// CHECK-MESSAGES: c.h:2:9: warning: invalid case style for macro definition 'c'
+// CHECK-MESSAGES: c.h:2:9: note: FIX-IT applied suggested code changes
+
+#define m
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for macro definition 'm'
+// CHECK-MESSAGES: :[[@LINE-2]]:9: note: FIX-IT applied suggested code changes
diff --git a/test/clang-tidy/export-diagnostics.cpp b/test/clang-tidy/export-diagnostics.cpp
index 5eda2042..14a6a40d 100644
--- a/test/clang-tidy/export-diagnostics.cpp
+++ b/test/clang-tidy/export-diagnostics.cpp
@@ -13,16 +13,19 @@ X(f)
// CHECK-YAML-NEXT: MainSourceFile: '{{.*}}-input.cpp'
// CHECK-YAML-NEXT: Diagnostics:
// CHECK-YAML-NEXT: - DiagnosticName: clang-diagnostic-missing-prototypes
-// CHECK-YAML-NEXT: Message: 'no previous prototype for function ''ff'''
-// CHECK-YAML-NEXT: FileOffset: 30
-// CHECK-YAML-NEXT: FilePath: '{{.*}}-input.cpp'
+// CHECK-YAML-NEXT: DiagnosticMessage:
+// CHECK-YAML-NEXT: Message: 'no previous prototype for function
+// ''ff'''
+// CHECK-YAML-NEXT: FilePath: '{{.*}}-input.cpp'
+// CHECK-YAML-NEXT: FileOffset: 30
+// CHECK-YAML-NEXT: Replacements: []
// CHECK-YAML-NEXT: Notes:
// CHECK-YAML-NEXT: - Message: 'expanded from macro ''X'''
// CHECK-YAML-NEXT: FilePath: '{{.*}}-input.cpp'
// CHECK-YAML-NEXT: FileOffset: 18
+// CHECK-YAML-NEXT: Replacements: []
// CHECK-YAML-NEXT: - Message: expanded from here
// CHECK-YAML-NEXT: FilePath: ''
// CHECK-YAML-NEXT: FileOffset: 0
-// CHECK-YAML-NEXT: Replacements: []
+// CHECK-YAML-NEXT: Replacements: []
// CHECK-YAML-NEXT: ...
-
diff --git a/test/clang-tidy/google-objc-function-naming.m b/test/clang-tidy/google-objc-function-naming.m
index d0336d26..01433d9f 100644
--- a/test/clang-tidy/google-objc-function-naming.m
+++ b/test/clang-tidy/google-objc-function-naming.m
@@ -1,4 +1,12 @@
-// RUN: %check_clang_tidy %s google-objc-function-naming %t
+// RUN: %check_clang_tidy %s google-objc-function-naming %t -- -- -isystem %S/Inputs/Headers
+
+#include <stdio.h>
+
+static void TestImplicitFunctionDeclaration(int a) {
+ // Call a builtin function so that the compiler generates an implicit
+ // function declaration.
+ printf("%d", a);
+}
typedef _Bool bool;
diff --git a/test/clang-tidy/google-objc-global-variable-declaration.mm b/test/clang-tidy/google-objc-global-variable-declaration.mm
new file mode 100644
index 00000000..a6b0f6ee
--- /dev/null
+++ b/test/clang-tidy/google-objc-global-variable-declaration.mm
@@ -0,0 +1,10 @@
+// RUN: %check_clang_tidy %s google-objc-global-variable-declaration %t
+
+@class NSString;
+static NSString* const myConstString = @"hello";
+// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: const global variable 'myConstString' must have a name which starts with an appropriate prefix [google-objc-global-variable-declaration]
+// CHECK-FIXES: static NSString* const kMyConstString = @"hello";
+
+class MyTest {
+ static int not_objc_style;
+};
diff --git a/test/clang-tidy/google-runtime-int.m b/test/clang-tidy/google-runtime-int.m
new file mode 100644
index 00000000..dd1225c9
--- /dev/null
+++ b/test/clang-tidy/google-runtime-int.m
@@ -0,0 +1,32 @@
+// RUN: clang-tidy -checks=-*,google-runtime-int %s 2>&1 -- | count 0
+// RUN: clang-tidy -checks=-*,google-runtime-int %s 2>&1 -- -x objective-c++ | count 0
+
+typedef long NSInteger;
+typedef unsigned long NSUInteger;
+
+@interface NSString
+@property(readonly) NSInteger integerValue;
+@property(readonly) long long longLongValue;
+@property(readonly) NSUInteger length;
+@end
+
+NSInteger Foo(NSString *s) {
+ return [s integerValue];
+}
+
+long long Bar(NSString *s) {
+ return [s longLongValue];
+}
+
+NSUInteger Baz(NSString *s) {
+ return [s length];
+}
+
+unsigned short NSSwapShort(unsigned short inv);
+
+long DoSomeMath(long a, short b) {
+ short c = NSSwapShort(b);
+ long a2 = a * 5L;
+ return a2 + c;
+}
+
diff --git a/test/clang-tidy/llvm-prefer-isa-or-dyn-cast-in-conditionals.cpp b/test/clang-tidy/llvm-prefer-isa-or-dyn-cast-in-conditionals.cpp
new file mode 100644
index 00000000..48652d52
--- /dev/null
+++ b/test/clang-tidy/llvm-prefer-isa-or-dyn-cast-in-conditionals.cpp
@@ -0,0 +1,132 @@
+// RUN: %check_clang_tidy %s llvm-prefer-isa-or-dyn-cast-in-conditionals %t
+
+struct X;
+struct Y;
+struct Z {
+ int foo();
+ X *bar();
+ X *cast(Y*);
+ bool baz(Y*);
+};
+
+template <class X, class Y>
+bool isa(Y *);
+template <class X, class Y>
+X *cast(Y *);
+template <class X, class Y>
+X *dyn_cast(Y *);
+template <class X, class Y>
+X *dyn_cast_or_null(Y *);
+
+bool foo(Y *y, Z *z) {
+ if (auto x = cast<X>(y))
+ return true;
+ // CHECK-MESSAGES: :[[@LINE-2]]:16: warning: cast<> in conditional will assert rather than return a null pointer [llvm-prefer-isa-or-dyn-cast-in-conditionals]
+ // CHECK-FIXES: if (auto x = dyn_cast<X>(y))
+
+ while (auto x = cast<X>(y))
+ break;
+ // CHECK-MESSAGES: :[[@LINE-2]]:19: warning: cast<> in conditional
+ // CHECK-FIXES: while (auto x = dyn_cast<X>(y))
+
+ if (cast<X>(y))
+ return true;
+ // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: cast<> in conditional
+ // CHECK-FIXES: if (isa<X>(y))
+
+ while (cast<X>(y))
+ break;
+ // CHECK-MESSAGES: :[[@LINE-2]]:10: warning: cast<> in conditional
+ // CHECK-FIXES: while (isa<X>(y))
+
+ do {
+ break;
+ } while (cast<X>(y));
+ // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: cast<> in conditional
+ // CHECK-FIXES: while (isa<X>(y));
+
+ if (dyn_cast<X>(y))
+ return true;
+ // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: return value from dyn_cast<> not used [llvm-prefer-isa-or-dyn-cast-in-conditionals]
+ // CHECK-FIXES: if (isa<X>(y))
+
+ while (dyn_cast<X>(y))
+ break;
+ // CHECK-MESSAGES: :[[@LINE-2]]:10: warning: return value from dyn_cast<> not used
+ // CHECK-FIXES: while (isa<X>(y))
+
+ do {
+ break;
+ } while (dyn_cast<X>(y));
+ // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: return value from dyn_cast<> not used
+ // CHECK-FIXES: while (isa<X>(y));
+
+ if (y && isa<X>(y))
+ return true;
+ // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: isa_and_nonnull<> is preferred over an explicit test for null followed by calling isa<> [llvm-prefer-isa-or-dyn-cast-in-conditionals]
+ // CHECK-FIXES: if (isa_and_nonnull<X>(y))
+
+ if (z->bar() && isa<Y>(z->bar()))
+ return true;
+ // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: isa_and_nonnull<> is preferred
+ // CHECK-FIXES: if (isa_and_nonnull<Y>(z->bar()))
+
+ if (z->bar() && cast<Y>(z->bar()))
+ return true;
+ // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: isa_and_nonnull<> is preferred
+ // CHECK-FIXES: if (isa_and_nonnull<Y>(z->bar()))
+
+ if (z->bar() && dyn_cast<Y>(z->bar()))
+ return true;
+ // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: isa_and_nonnull<> is preferred
+ // CHECK-FIXES: if (isa_and_nonnull<Y>(z->bar()))
+
+ if (z->bar() && dyn_cast_or_null<Y>(z->bar()))
+ return true;
+ // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: isa_and_nonnull<> is preferred
+ // CHECK-FIXES: if (isa_and_nonnull<Y>(z->bar()))
+
+ bool b = z->bar() && cast<Y>(z->bar());
+ // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: isa_and_nonnull<> is preferred
+ // CHECK-FIXES: bool b = isa_and_nonnull<Y>(z->bar());
+
+ // These don't trigger a warning.
+ if (auto x = cast<Z>(y)->foo())
+ return true;
+ if (auto x = z->cast(y))
+ return true;
+ while (auto x = cast<Z>(y)->foo())
+ break;
+ if (cast<Z>(y)->foo())
+ return true;
+ if (z->cast(y))
+ return true;
+ while (cast<Z>(y)->foo())
+ break;
+ if (y && cast<X>(z->bar()))
+ return true;
+ if (z && cast<Z>(y)->foo())
+ return true;
+ bool b2 = y && cast<X>(z);
+ if(z->cast(y))
+ return true;
+ if (z->baz(cast<Y>(z)))
+ return true;
+
+#define CAST(T, Obj) cast<T>(Obj)
+#define AUTO_VAR_CAST(X, Y, Z) auto X = cast<Y>(Z)
+#define ISA(T, Obj) isa<T>(Obj)
+#define ISA_OR_NULL(T, Obj) Obj &&isa<T>(Obj)
+
+ // Macros don't trigger warning.
+ if (auto x = CAST(X, y))
+ return true;
+ if (AUTO_VAR_CAST(x, X, z))
+ return true;
+ if (z->bar() && ISA(Y, z->bar()))
+ return true;
+ if (ISA_OR_NULL(Y, z->bar()))
+ return true;
+
+ return false;
+}
diff --git a/test/clang-tidy/misc-non-private-member-variables-in-classes.cpp b/test/clang-tidy/misc-non-private-member-variables-in-classes.cpp
index 31052716..2a93ff6a 100644
--- a/test/clang-tidy/misc-non-private-member-variables-in-classes.cpp
+++ b/test/clang-tidy/misc-non-private-member-variables-in-classes.cpp
@@ -35,6 +35,23 @@ private:
int S1_v3;
};
+// Only data and implicit or static methods, do not warn
+
+class C {
+public:
+ C() {}
+ ~C() {}
+};
+
+struct S1Implicit {
+ C S1Implicit_v0;
+};
+
+struct S1ImplicitAndStatic {
+ C S1Implicit_v0;
+ static void s() {}
+};
+
//----------------------------------------------------------------------------//
// All functions are static, do not warn.
diff --git a/test/clang-tidy/modernize-avoid-bind.cpp b/test/clang-tidy/modernize-avoid-bind.cpp
index 1c78b9e6..721801be 100644
--- a/test/clang-tidy/modernize-avoid-bind.cpp
+++ b/test/clang-tidy/modernize-avoid-bind.cpp
@@ -77,3 +77,47 @@ void n() {
// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: prefer a lambda to std::bind
// CHECK-FIXES: auto clj = [] { return C::add(1, 1); };
}
+
+// Let's fake a minimal std::function-like facility.
+namespace std {
+template <typename _Tp>
+_Tp declval();
+
+template <typename _Functor, typename... _ArgTypes>
+struct __res {
+ template <typename... _Args>
+ static decltype(declval<_Functor>()(_Args()...)) _S_test(int);
+
+ template <typename...>
+ static void _S_test(...);
+
+ using type = decltype(_S_test<_ArgTypes...>(0));
+};
+
+template <typename>
+struct function;
+
+template <typename... _ArgTypes>
+struct function<void(_ArgTypes...)> {
+ template <typename _Functor,
+ typename = typename __res<_Functor, _ArgTypes...>::type>
+ function(_Functor) {}
+};
+} // namespace std
+
+struct Thing {};
+void UseThing(Thing *);
+
+struct Callback {
+ Callback();
+ Callback(std::function<void()>);
+ void Reset(std::function<void()>);
+};
+
+void test(Thing *t) {
+ Callback cb;
+ if (t)
+ cb.Reset(std::bind(UseThing, t));
+ // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: prefer a lambda to std::bind
+ // CHECK-FIXES: cb.Reset([=] { return UseThing(t); });
+}
diff --git a/test/clang-tidy/modernize-avoid-c-arrays-ignores-main.cpp b/test/clang-tidy/modernize-avoid-c-arrays-ignores-main.cpp
new file mode 100644
index 00000000..6549422f
--- /dev/null
+++ b/test/clang-tidy/modernize-avoid-c-arrays-ignores-main.cpp
@@ -0,0 +1,18 @@
+// RUN: %check_clang_tidy %s modernize-avoid-c-arrays %t
+
+int not_main(int argc, char *argv[]) {
+ // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: do not declare C-style arrays, use std::array<> instead
+ int f4[] = {1, 2};
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use std::array<> instead
+}
+
+int main(int argc, char *argv[]) {
+ int f5[] = {1, 2};
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use std::array<> instead
+
+ auto not_main = [](int argc, char *argv[]) {
+ // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: do not declare C-style arrays, use std::array<> instead
+ int f6[] = {1, 2};
+ // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not declare C-style arrays, use std::array<> instead
+ };
+}
diff --git a/test/clang-tidy/modernize-avoid-c-arrays-ignores-three-arg-main.cpp b/test/clang-tidy/modernize-avoid-c-arrays-ignores-three-arg-main.cpp
new file mode 100644
index 00000000..22a4016f
--- /dev/null
+++ b/test/clang-tidy/modernize-avoid-c-arrays-ignores-three-arg-main.cpp
@@ -0,0 +1,20 @@
+// RUN: %check_clang_tidy %s modernize-avoid-c-arrays %t
+
+int not_main(int argc, char *argv[], char *argw[]) {
+ // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: do not declare C-style arrays, use std::array<> instead
+ // CHECK-MESSAGES: :[[@LINE-2]]:38: warning: do not declare C-style arrays, use std::array<> instead
+ int f4[] = {1, 2};
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use std::array<> instead
+}
+
+int main(int argc, char *argv[], char *argw[]) {
+ int f5[] = {1, 2};
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use std::array<> instead
+
+ auto not_main = [](int argc, char *argv[], char *argw[]) {
+ // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: do not declare C-style arrays, use std::array<> instead
+ // CHECK-MESSAGES: :[[@LINE-2]]:46: warning: do not declare C-style arrays, use std::array<> instead
+ int f6[] = {1, 2};
+ // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not declare C-style arrays, use std::array<> instead
+ };
+}
diff --git a/test/clang-tidy/modernize-redundant-void-arg.cpp b/test/clang-tidy/modernize-redundant-void-arg.cpp
index 44a726b5..0fad5d55 100644
--- a/test/clang-tidy/modernize-redundant-void-arg.cpp
+++ b/test/clang-tidy/modernize-redundant-void-arg.cpp
@@ -489,6 +489,13 @@ void lambda_expression_with_macro_test(){
// CHECK-FIXES: []() BODY;
}
+namespace qqq {
+void foo() BODY
+void bar(void) BODY;
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: redundant void argument list in function definition
+// CHECK-FIXES: void bar() BODY;
+}
+
struct S_1 {
void g_1(void) const {
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant void argument list in function definition [modernize-redundant-void-arg]
diff --git a/test/clang-tidy/modernize-use-default-member-init-assignment.cpp b/test/clang-tidy/modernize-use-default-member-init-assignment.cpp
index fdc0db18..b98055c9 100644
--- a/test/clang-tidy/modernize-use-default-member-init-assignment.cpp
+++ b/test/clang-tidy/modernize-use-default-member-init-assignment.cpp
@@ -166,6 +166,14 @@ struct PositiveEnum {
// CHECK-FIXES: Enum e = Foo;
};
+struct PositiveValueEnum {
+ PositiveValueEnum() : e() {}
+ // CHECK-FIXES: PositiveValueEnum() {}
+ Enum e;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use default member initializer for 'e'
+ // CHECK-FIXES: Enum e{};
+};
+
struct PositiveString {
PositiveString() : s("foo") {}
// CHECK-FIXES: PositiveString() {}
diff --git a/test/clang-tidy/modernize-use-default-member-init.cpp b/test/clang-tidy/modernize-use-default-member-init.cpp
index 0ed65df3..825bfa0b 100644
--- a/test/clang-tidy/modernize-use-default-member-init.cpp
+++ b/test/clang-tidy/modernize-use-default-member-init.cpp
@@ -165,6 +165,14 @@ struct PositiveEnum {
// CHECK-FIXES: Enum e{Foo};
};
+struct PositiveValueEnum {
+ PositiveValueEnum() : e() {}
+ // CHECK-FIXES: PositiveValueEnum() {}
+ Enum e;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use default member initializer for 'e'
+ // CHECK-FIXES: Enum e{};
+};
+
struct PositiveString {
PositiveString() : s("foo") {}
// CHECK-FIXES: PositiveString() {}
@@ -382,6 +390,16 @@ struct ExistingString {
const char *e4 = "bar";
};
+struct UnionExisting {
+ UnionExisting() : e(5.0) {}
+ // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: member initializer for 'e' is redundant
+ // CHECK-FIXES: UnionExisting() {}
+ union {
+ int i;
+ double e = 5.0;
+ };
+};
+
template <typename T>
struct NegativeTemplateExisting {
NegativeTemplateExisting(int) : t(0) {}
diff --git a/test/clang-tidy/modernize-use-override-no-destructors.cpp b/test/clang-tidy/modernize-use-override-no-destructors.cpp
new file mode 100644
index 00000000..eaadb07b
--- /dev/null
+++ b/test/clang-tidy/modernize-use-override-no-destructors.cpp
@@ -0,0 +1,16 @@
+// RUN: %check_clang_tidy %s modernize-use-override %t -- \
+// RUN: -config="{CheckOptions: [{key: modernize-use-override.IgnoreDestructors, value: 1}]}" \
+// RUN: -- -std=c++11
+
+struct Base {
+ virtual ~Base();
+ virtual void f();
+};
+
+struct Simple : public Base {
+ virtual ~Simple();
+ // CHECK-MESSAGES-NOT: warning:
+ virtual void f();
+ // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using
+ // CHECK-FIXES: {{^}} void f() override;
+};
diff --git a/test/clang-tidy/modernize-use-override-with-macro.cpp b/test/clang-tidy/modernize-use-override-with-macro.cpp
new file mode 100644
index 00000000..ad682f15
--- /dev/null
+++ b/test/clang-tidy/modernize-use-override-with-macro.cpp
@@ -0,0 +1,70 @@
+// RUN: %check_clang_tidy %s modernize-use-override %t -- \
+// RUN: -config="{CheckOptions: [{key: modernize-use-override.OverrideSpelling, value: 'OVERRIDE'},{key: modernize-use-override.FinalSpelling, value: 'FINAL'}]}" \
+// RUN: -- -std=c++11
+
+#define ABSTRACT = 0
+
+#define OVERRIDE override
+#define FINAL final
+#define VIRTUAL virtual
+#define NOT_VIRTUAL
+#define NOT_OVERRIDE
+
+#define MUST_USE_RESULT __attribute__((warn_unused_result))
+#define UNUSED __attribute__((unused))
+
+struct Base {
+ virtual ~Base() {}
+ virtual void a();
+ virtual void b();
+ virtual void c();
+ virtual void e() = 0;
+ virtual void f2() const = 0;
+ virtual void g() = 0;
+ virtual void j() const;
+ virtual void k() = 0;
+ virtual void l() const;
+};
+
+struct SimpleCases : public Base {
+public:
+ virtual ~SimpleCases();
+ // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using 'OVERRIDE' or (rarely) 'FINAL' instead of 'virtual' [modernize-use-override]
+ // CHECK-FIXES: {{^}} ~SimpleCases() OVERRIDE;
+
+ void a();
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: annotate this function with 'OVERRIDE' or (rarely) 'FINAL' [modernize-use-override]
+ // CHECK-FIXES: {{^}} void a() OVERRIDE;
+
+ virtual void b();
+ // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using 'OVERRIDE' or (rarely) 'FINAL' instead of 'virtual' [modernize-use-override]
+ // CHECK-FIXES: {{^}} void b() OVERRIDE;
+
+ virtual void c();
+ // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using
+ // CHECK-FIXES: {{^}} void c() OVERRIDE;
+
+ virtual void e() = 0;
+ // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using
+ // CHECK-FIXES: {{^}} void e() OVERRIDE = 0;
+
+ virtual void f2() const = 0;
+ // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using
+ // CHECK-FIXES: {{^}} void f2() const OVERRIDE = 0;
+
+ virtual void g() ABSTRACT;
+ // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using
+ // CHECK-FIXES: {{^}} void g() OVERRIDE ABSTRACT;
+
+ virtual void j() const;
+ // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using
+ // CHECK-FIXES: {{^}} void j() const OVERRIDE;
+
+ virtual void k() OVERRIDE;
+ // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant since the function is already declared 'OVERRIDE' [modernize-use-override]
+ // CHECK-FIXES: {{^}} void k() OVERRIDE;
+
+ virtual void l() const OVERRIDE;
+ // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: 'virtual' is redundant since the function is already declared 'OVERRIDE' [modernize-use-override]
+ // CHECK-FIXES: {{^}} void l() const OVERRIDE;
+};
diff --git a/test/clang-tidy/modernize-use-override-with-no-macro-inscope.cpp b/test/clang-tidy/modernize-use-override-with-no-macro-inscope.cpp
new file mode 100644
index 00000000..97b71053
--- /dev/null
+++ b/test/clang-tidy/modernize-use-override-with-no-macro-inscope.cpp
@@ -0,0 +1,28 @@
+// RUN: %check_clang_tidy %s modernize-use-override %t -- \
+// RUN: -config="{CheckOptions: [{key: modernize-use-override.OverrideSpelling, value: 'CUSTOM_OVERRIDE'},{key: modernize-use-override.FinalSpelling, value: 'CUSTOM_FINAL'}]}" \
+// RUN: -- -std=c++11
+
+// As if the macro was not defined.
+//#define CUSTOM_OVERRIDE override
+//#define CUSTOM_FINAL override
+
+struct Base {
+ virtual ~Base() {}
+ virtual void a();
+ virtual void b();
+};
+
+struct SimpleCases : public Base {
+public:
+ virtual ~SimpleCases();
+ // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: prefer using 'CUSTOM_OVERRIDE' or (rarely) 'CUSTOM_FINAL' instead of 'virtual' [modernize-use-override]
+ // CHECK-FIXES: {{^}} virtual ~SimpleCases();
+
+ void a();
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: annotate this function with 'CUSTOM_OVERRIDE' or (rarely) 'CUSTOM_FINAL' [modernize-use-override]
+ // CHECK-FIXES: {{^}} void a();
+
+ virtual void b();
+ // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using 'CUSTOM_OVERRIDE' or (rarely) 'CUSTOM_FINAL' instead of 'virtual' [modernize-use-override]
+ // CHECK-FIXES: {{^}} virtual void b();
+};
diff --git a/test/clang-tidy/nolint.cpp b/test/clang-tidy/nolint.cpp
index 24c37228..a2d2c10a 100644
--- a/test/clang-tidy/nolint.cpp
+++ b/test/clang-tidy/nolint.cpp
@@ -31,6 +31,7 @@ void f() {
int i;
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: unused variable 'i' [clang-diagnostic-unused-variable]
int j; // NOLINT
+ int k; // NOLINT(clang-diagnostic-unused-variable)
}
#define MACRO(X) class X { X(int i); };
@@ -47,4 +48,4 @@ MACRO_NOLINT
#define DOUBLE_MACRO MACRO(H) // NOLINT
DOUBLE_MACRO
-// CHECK-MESSAGES: Suppressed 12 warnings (12 NOLINT)
+// CHECK-MESSAGES: Suppressed 13 warnings (13 NOLINT)
diff --git a/test/clang-tidy/objc-property-declaration.m b/test/clang-tidy/objc-property-declaration.m
index 07a06205..b56bdcd1 100644
--- a/test/clang-tidy/objc-property-declaration.m
+++ b/test/clang-tidy/objc-property-declaration.m
@@ -46,6 +46,7 @@ typedef void *CGColorRef;
@property(strong, nonatomic) NSString *URLStr;
@property(assign, nonatomic) int abc_camelCase;
@property(strong, nonatomic) NSString *abc_URL;
+@property(strong, nonatomic) NSString *opac2_sourceComponent;
@end
@interface Foo ()
diff --git a/test/clang-tidy/objc-super-self.m b/test/clang-tidy/objc-super-self.m
new file mode 100644
index 00000000..9653cd22
--- /dev/null
+++ b/test/clang-tidy/objc-super-self.m
@@ -0,0 +1,86 @@
+// RUN: %check_clang_tidy %s objc-super-self %t
+
+@interface NSObject
+- (instancetype)init;
+- (instancetype)self;
+@end
+
+@interface NSObjectDerivedClass : NSObject
+@end
+
+@implementation NSObjectDerivedClass
+
+- (instancetype)init {
+ return [super self];
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious invocation of 'self' in initializer; did you mean to invoke a superclass initializer? [objc-super-self]
+// CHECK-FIXES: return [super init];
+}
+
+- (instancetype)initWithObject:(NSObject *)obj {
+ self = [super self];
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious invocation of 'self' in initializer; did you mean to invoke a superclass initializer? [objc-super-self]
+// CHECK-FIXES: self = [super init];
+ if (self) {
+ // ...
+ }
+ return self;
+}
+
+#define INITIALIZE() [super self]
+
+- (instancetype)initWithObject:(NSObject *)objc a:(int)a {
+ return INITIALIZE();
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious invocation of 'self' in initializer; did you mean to invoke a superclass initializer? [objc-super-self]
+// CHECK-FIXES: return INITIALIZE();
+}
+
+#define INITIALIZER_IMPL() return [super self]
+
+- (instancetype)initWithObject:(NSObject *)objc b:(int)b {
+ INITIALIZER_IMPL();
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: suspicious invocation of 'self' in initializer; did you mean to invoke a superclass initializer? [objc-super-self]
+// CHECK-FIXES: INITIALIZER_IMPL();
+}
+
+#define INITIALIZER_METHOD self
+
+- (instancetype)initWithObject:(NSObject *)objc c:(int)c {
+ return [super INITIALIZER_METHOD];
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious invocation of 'self' in initializer; did you mean to invoke a superclass initializer? [objc-super-self]
+// CHECK-FIXES: return [super INITIALIZER_METHOD];
+}
+
+#define RECEIVER super
+
+- (instancetype)initWithObject:(NSObject *)objc d:(int)d {
+ return [RECEIVER self];
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious invocation of 'self' in initializer; did you mean to invoke a superclass initializer? [objc-super-self]
+// CHECK-FIXES: return [RECEIVER self];
+}
+
+- (instancetype)foo {
+ return [super self];
+}
+
+- (instancetype)bar {
+ return [self self];
+}
+
+@end
+
+@interface RootClass
+- (instancetype)init;
+- (instancetype)self;
+@end
+
+@interface NotNSObjectDerivedClass : RootClass
+@end
+
+@implementation NotNSObjectDerivedClass
+
+- (instancetype)init {
+ return [super self];
+}
+
+@end
+
diff --git a/test/clang-tidy/openmp-exception-escape.cpp b/test/clang-tidy/openmp-exception-escape.cpp
new file mode 100644
index 00000000..73345836
--- /dev/null
+++ b/test/clang-tidy/openmp-exception-escape.cpp
@@ -0,0 +1,132 @@
+// RUN: %check_clang_tidy %s openmp-exception-escape %t -- -extra-arg=-fopenmp=libomp -extra-arg=-fexceptions -config="{CheckOptions: [{key: openmp-exception-escape.IgnoredExceptions, value: 'ignored, ignored2'}]}" --
+
+int thrower() {
+ throw 42;
+}
+
+class ignored {};
+class ignored2 {};
+namespace std {
+class bad_alloc {};
+} // namespace std
+
+void parallel() {
+#pragma omp parallel
+ thrower();
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: an exception thrown inside of the OpenMP 'parallel' region is not caught in that same region
+}
+
+void ignore() {
+#pragma omp parallel
+ throw ignored();
+}
+
+void ignore2() {
+#pragma omp parallel
+ throw ignored2();
+}
+
+void standalone_directive() {
+#pragma omp taskwait
+ throw ignored(); // not structured block
+}
+
+void ignore_alloc() {
+#pragma omp parallel
+ throw std::bad_alloc();
+}
+
+void parallel_caught() {
+#pragma omp parallel
+ {
+ try {
+ thrower();
+ } catch (...) {
+ }
+ }
+}
+
+void for_header(const int a) {
+ // Only the body of the loop counts.
+#pragma omp for
+ for (int i = 0; i < thrower(); i++)
+ ;
+}
+
+void forloop(const int a) {
+#pragma omp for
+ for (int i = 0; i < a; i++)
+ thrower();
+ // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: an exception thrown inside of the OpenMP 'for' region is not caught in that same region
+}
+
+void parallel_forloop(const int a) {
+#pragma omp parallel
+ {
+#pragma omp for
+ for (int i = 0; i < a; i++)
+ thrower();
+ thrower();
+ // CHECK-MESSAGES: :[[@LINE-5]]:3: warning: an exception thrown inside of the OpenMP 'parallel' region is not caught in that same region
+ // CHECK-MESSAGES: :[[@LINE-3]]:7: warning: an exception thrown inside of the OpenMP 'for' region is not caught in that same region
+ }
+}
+
+void parallel_forloop_caught(const int a) {
+#pragma omp parallel
+ {
+#pragma omp for
+ for (int i = 0; i < a; i++) {
+ try {
+ thrower();
+ } catch (...) {
+ }
+ }
+ thrower();
+ // CHECK-MESSAGES: :[[@LINE-9]]:3: warning: an exception thrown inside of the OpenMP 'parallel' region is not caught in that same region
+ }
+}
+
+void parallel_caught_forloop(const int a) {
+#pragma omp parallel
+ {
+#pragma omp for
+ for (int i = 0; i < a; i++)
+ thrower();
+ try {
+ thrower();
+ } catch (...) {
+ }
+ // CHECK-MESSAGES: :[[@LINE-5]]:7: warning: an exception thrown inside of the OpenMP 'for' region is not caught in that same region
+ }
+}
+
+void parallel_outercaught_forloop(const int a) {
+#pragma omp parallel
+ {
+ try {
+#pragma omp for
+ for (int i = 0; i < a; i++)
+ thrower();
+ thrower();
+ } catch (...) {
+ }
+ // CHECK-MESSAGES: :[[@LINE-4]]:9: warning: an exception thrown inside of the OpenMP 'for' region is not caught in that same region
+ }
+}
+
+void parallel_outercaught_forloop_caught(const int a) {
+#pragma omp parallel
+ {
+ try {
+#pragma omp for
+ for (int i = 0; i < a; i++) {
+ try {
+ thrower();
+ } catch (...) {
+ }
+ }
+ } catch (...) {
+ }
+ }
+}
diff --git a/test/clang-tidy/openmp-use-default-none.cpp b/test/clang-tidy/openmp-use-default-none.cpp
new file mode 100644
index 00000000..1a374bde
--- /dev/null
+++ b/test/clang-tidy/openmp-use-default-none.cpp
@@ -0,0 +1,160 @@
+// RUN: %check_clang_tidy %s openmp-use-default-none %t -- -- -x c++ -fopenmp=libomp -fopenmp-version=40
+// RUN: %check_clang_tidy %s openmp-use-default-none %t -- -- -x c -fopenmp=libomp -fopenmp-version=40
+
+//----------------------------------------------------------------------------//
+// Null cases.
+//----------------------------------------------------------------------------//
+
+// 'for' directive can not have 'default' clause, no diagnostics.
+void n0(const int a) {
+#pragma omp for
+ for (int b = 0; b < a; b++)
+ ;
+}
+
+//----------------------------------------------------------------------------//
+// Single-directive positive cases.
+//----------------------------------------------------------------------------//
+
+// 'parallel' directive.
+
+// 'parallel' directive can have 'default' clause, but said clause is not
+// specified, diagnosed.
+void p0_0() {
+#pragma omp parallel
+ ;
+ // CHECK-NOTES: :[[@LINE-2]]:9: warning: OpenMP directive 'parallel' does not specify 'default' clause, consider specifying 'default(none)' clause
+}
+
+// 'parallel' directive can have 'default' clause, and said clause specified,
+// with 'none' kind, all good.
+void p0_1() {
+#pragma omp parallel default(none)
+ ;
+}
+
+// 'parallel' directive can have 'default' clause, and said clause specified,
+// but with 'shared' kind, which is not 'none', diagnose.
+void p0_2() {
+#pragma omp parallel default(shared)
+ ;
+ // CHECK-NOTES: :[[@LINE-2]]:9: warning: OpenMP directive 'parallel' specifies 'default(shared)' clause, consider using 'default(none)' clause instead
+ // CHECK-NOTES: :[[@LINE-3]]:22: note: existing 'default' clause specified here
+}
+
+// 'task' directive.
+
+// 'task' directive can have 'default' clause, but said clause is not
+// specified, diagnosed.
+void p1_0() {
+#pragma omp task
+ ;
+ // CHECK-NOTES: :[[@LINE-2]]:9: warning: OpenMP directive 'task' does not specify 'default' clause, consider specifying 'default(none)' clause
+}
+
+// 'task' directive can have 'default' clause, and said clause specified,
+// with 'none' kind, all good.
+void p1_1() {
+#pragma omp task default(none)
+ ;
+}
+
+// 'task' directive can have 'default' clause, and said clause specified,
+// but with 'shared' kind, which is not 'none', diagnose.
+void p1_2() {
+#pragma omp task default(shared)
+ ;
+ // CHECK-NOTES: :[[@LINE-2]]:9: warning: OpenMP directive 'task' specifies 'default(shared)' clause, consider using 'default(none)' clause instead
+ // CHECK-NOTES: :[[@LINE-3]]:18: note: existing 'default' clause specified here
+}
+
+// 'teams' directive. (has to be inside of 'target' directive)
+
+// 'teams' directive can have 'default' clause, but said clause is not
+// specified, diagnosed.
+void p2_0() {
+#pragma omp target
+#pragma omp teams
+ ;
+ // CHECK-NOTES: :[[@LINE-2]]:9: warning: OpenMP directive 'teams' does not specify 'default' clause, consider specifying 'default(none)' clause
+}
+
+// 'teams' directive can have 'default' clause, and said clause specified,
+// with 'none' kind, all good.
+void p2_1() {
+#pragma omp target
+#pragma omp teams default(none)
+ ;
+}
+
+// 'teams' directive can have 'default' clause, and said clause specified,
+// but with 'shared' kind, which is not 'none', diagnose.
+void p2_2() {
+#pragma omp target
+#pragma omp teams default(shared)
+ ;
+ // CHECK-NOTES: :[[@LINE-2]]:9: warning: OpenMP directive 'teams' specifies 'default(shared)' clause, consider using 'default(none)' clause instead
+ // CHECK-NOTES: :[[@LINE-3]]:19: note: existing 'default' clause specified here
+}
+
+// 'taskloop' directive.
+
+// 'taskloop' directive can have 'default' clause, but said clause is not
+// specified, diagnosed.
+void p3_0(const int a) {
+#pragma omp taskloop
+ for (int b = 0; b < a; b++)
+ ;
+ // CHECK-NOTES: :[[@LINE-3]]:9: warning: OpenMP directive 'taskloop' does not specify 'default' clause, consider specifying 'default(none)' clause
+}
+
+// 'taskloop' directive can have 'default' clause, and said clause specified,
+// with 'none' kind, all good.
+void p3_1(const int a) {
+#pragma omp taskloop default(none) shared(a)
+ for (int b = 0; b < a; b++)
+ ;
+}
+
+// 'taskloop' directive can have 'default' clause, and said clause specified,
+// but with 'shared' kind, which is not 'none', diagnose.
+void p3_2(const int a) {
+#pragma omp taskloop default(shared)
+ for (int b = 0; b < a; b++)
+ ;
+ // CHECK-NOTES: :[[@LINE-3]]:9: warning: OpenMP directive 'taskloop' specifies 'default(shared)' clause, consider using 'default(none)' clause instead
+ // CHECK-NOTES: :[[@LINE-4]]:22: note: existing 'default' clause specified here
+}
+
+//----------------------------------------------------------------------------//
+// Combined directives.
+// Let's not test every single possible permutation/combination of directives,
+// but just *one* combined directive. The rest will be the same.
+//----------------------------------------------------------------------------//
+
+// 'parallel' directive can have 'default' clause, but said clause is not
+// specified, diagnosed.
+void p4_0(const int a) {
+#pragma omp parallel for
+ for (int b = 0; b < a; b++)
+ ;
+ // CHECK-NOTES: :[[@LINE-3]]:9: warning: OpenMP directive 'parallel for' does not specify 'default' clause, consider specifying 'default(none)' clause
+}
+
+// 'parallel' directive can have 'default' clause, and said clause specified,
+// with 'none' kind, all good.
+void p4_1(const int a) {
+#pragma omp parallel for default(none) shared(a)
+ for (int b = 0; b < a; b++)
+ ;
+}
+
+// 'parallel' directive can have 'default' clause, and said clause specified,
+// but with 'shared' kind, which is not 'none', diagnose.
+void p4_2(const int a) {
+#pragma omp parallel for default(shared)
+ for (int b = 0; b < a; b++)
+ ;
+ // CHECK-NOTES: :[[@LINE-3]]:9: warning: OpenMP directive 'parallel for' specifies 'default(shared)' clause, consider using 'default(none)' clause instead
+ // CHECK-NOTES: :[[@LINE-4]]:26: note: existing 'default' clause specified here
+}
diff --git a/test/clang-tidy/readability-avoid-underscore-in-googletest-name.cpp b/test/clang-tidy/readability-avoid-underscore-in-googletest-name.cpp
new file mode 100644
index 00000000..6e8a5c2d
--- /dev/null
+++ b/test/clang-tidy/readability-avoid-underscore-in-googletest-name.cpp
@@ -0,0 +1,108 @@
+// RUN: %check_clang_tidy %s google-readability-avoid-underscore-in-googletest-name %t
+
+#define TEST(test_case_name, test_name) void test_case_name##test_name()
+#define TEST_F(test_case_name, test_name) void test_case_name##test_name()
+#define TEST_P(test_case_name, test_name) void test_case_name##test_name()
+#define TYPED_TEST(test_case_name, test_name) void test_case_name##test_name()
+#define TYPED_TEST_P(test_case_name, test_name) void test_case_name##test_name()
+#define FRIEND_TEST(test_case_name, test_name) void test_case_name##test_name()
+
+TEST(TestCaseName, Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+TEST(TestCaseName, DISABLED_Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TEST(TestCaseName, Illegal_Test_Name) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TEST(Illegal_TestCaseName, TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: avoid using "_" in test case name "Illegal_TestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TEST(Illegal_Test_CaseName, TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: avoid using "_" in test case name "Illegal_Test_CaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TEST(Illegal_TestCaseName, Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: avoid using "_" in test case name "Illegal_TestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+// CHECK-MESSAGES: :[[@LINE-2]]:28: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+TEST_F(TestCaseFixtureName, Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TEST_F(TestCaseFixtureName, DISABLED_Illegal_Test_Name) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TEST_F(TestCaseFixtureName, Illegal_Test_Name) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+TEST_F(Illegal_TestCaseFixtureName, TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_TestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TEST_F(Illegal_TestCaseFixtureName, Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_TestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+// CHECK-MESSAGES: :[[@LINE-2]]:37: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+TEST_F(Illegal_Test_CaseFixtureName, TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_Test_CaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+TEST_P(ParameterizedTestCaseFixtureName, Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TEST_P(ParameterizedTestCaseFixtureName, DISABLED_Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TEST_P(ParameterizedTestCaseFixtureName, Illegal_Test_Name) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+TEST_P(Illegal_ParameterizedTestCaseFixtureName, TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_ParameterizedTestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TEST_P(Illegal_ParameterizedTestCaseFixtureName, Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_ParameterizedTestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+// CHECK-MESSAGES: :[[@LINE-2]]:50: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+TEST_P(Illegal_Parameterized_TestCaseFixtureName, TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_Parameterized_TestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+TYPED_TEST(TypedTestCaseName, Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TYPED_TEST(TypedTestCaseName, DISABLED_Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TYPED_TEST(TypedTestCaseName, Illegal_Test_Name) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+TYPED_TEST(Illegal_TypedTestCaseName, TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: avoid using "_" in test case name "Illegal_TypedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TYPED_TEST(Illegal_TypedTestCaseName, Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: avoid using "_" in test case name "Illegal_TypedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+// CHECK-MESSAGES: :[[@LINE-2]]:39: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+TYPED_TEST(Illegal_Typed_TestCaseName, TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: avoid using "_" in test case name "Illegal_Typed_TestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+TYPED_TEST_P(TypeParameterizedTestCaseName, Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TYPED_TEST_P(TypeParameterizedTestCaseName, DISABLED_Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TYPED_TEST_P(TypeParameterizedTestCaseName, Illegal_Test_Name) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+TYPED_TEST_P(Illegal_TypeParameterizedTestCaseName, TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: avoid using "_" in test case name "Illegal_TypeParameterizedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+TYPED_TEST_P(Illegal_TypeParameterizedTestCaseName, Illegal_TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: avoid using "_" in test case name "Illegal_TypeParameterizedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+// CHECK-MESSAGES: :[[@LINE-2]]:53: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+TYPED_TEST_P(Illegal_Type_ParameterizedTestCaseName, TestName) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: avoid using "_" in test case name "Illegal_Type_ParameterizedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
+
+// Underscores are allowed to disable a test with the DISABLED_ prefix.
+// https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore
+TEST(TestCaseName, TestName) {}
+TEST(TestCaseName, DISABLED_TestName) {}
+
+TEST_F(TestCaseFixtureName, TestName) {}
+TEST_F(TestCaseFixtureName, DISABLED_TestName) {}
+
+TEST_P(ParameterizedTestCaseFixtureName, TestName) {}
+TEST_P(ParameterizedTestCaseFixtureName, DISABLED_TestName) {}
+
+TYPED_TEST(TypedTestName, TestName) {}
+TYPED_TEST(TypedTestName, DISABLED_TestName) {}
+
+TYPED_TEST_P(TypeParameterizedTestName, TestName) {}
+TYPED_TEST_P(TypeParameterizedTestName, DISABLED_TestName) {}
+
+FRIEND_TEST(FriendTest, Is_NotChecked) {}
+FRIEND_TEST(Friend_Test, IsNotChecked) {}
+FRIEND_TEST(Friend_Test, Is_NotChecked) {}
diff --git a/test/clang-tidy/readability-else-after-return.cpp b/test/clang-tidy/readability-else-after-return.cpp
index 7e950928..b06c02c9 100644
--- a/test/clang-tidy/readability-else-after-return.cpp
+++ b/test/clang-tidy/readability-else-after-return.cpp
@@ -105,3 +105,15 @@ void foo() {
}
}
}
+
+extern int *g();
+extern void h(int **x);
+
+int *decl_in_condition() {
+ if (int *x = g()) {
+ return x;
+ } else {
+ h(&x);
+ return x;
+ }
+}
diff --git a/test/clang-tidy/readability-misleading-indentation.cpp b/test/clang-tidy/readability-misleading-indentation.cpp
index 59d5f406..40399492 100644
--- a/test/clang-tidy/readability-misleading-indentation.cpp
+++ b/test/clang-tidy/readability-misleading-indentation.cpp
@@ -8,7 +8,7 @@ void foo2();
foo1(); \
foo2();
-int main()
+void f()
{
bool cond1 = true;
bool cond2 = true;
@@ -90,7 +90,7 @@ int main()
else {
}
// CHECK-MESSAGES: :[[@LINE-2]]:8: warning: different indentation for 'if' and corresponding 'else' [readability-misleading-indentation]
-
+
if (cond1) {
if (cond1) {
}
@@ -109,3 +109,12 @@ int main()
BLOCK
}
+
+void g(bool x) {
+ if (x)
+ #pragma unroll
+ for (int k = 0; k < 1; ++k) {}
+
+ #pragma unroll
+ for (int k = 0; k < 1; ++k) {}
+}
diff --git a/test/clang-tidy/readability-redundant-smartptr-get-msvc.cpp b/test/clang-tidy/readability-redundant-smartptr-get-msvc.cpp
new file mode 100644
index 00000000..bd8990a2
--- /dev/null
+++ b/test/clang-tidy/readability-redundant-smartptr-get-msvc.cpp
@@ -0,0 +1,94 @@
+// RUN: %check_clang_tidy %s readability-redundant-smartptr-get %t
+
+#define NULL __null
+
+namespace std {
+
+// MSVC headers define operator templates instead of plain operators.
+
+template <typename T>
+struct unique_ptr {
+ template <typename T2 = T>
+ T2& operator*() const;
+ template <typename T2 = T>
+ T2* operator->() const;
+ T* get() const;
+ explicit operator bool() const noexcept;
+};
+
+template <typename T>
+struct shared_ptr {
+ template <typename T2 = T>
+ T2& operator*() const;
+ template <typename T2 = T>
+ T2* operator->() const;
+ T* get() const;
+ explicit operator bool() const noexcept;
+};
+
+} // namespace std
+
+struct Bar {
+ void Do();
+ void ConstDo() const;
+};
+
+void Positive() {
+ std::unique_ptr<Bar>* up;
+ (*up->get()).Do();
+ // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: redundant get() call
+ // CHECK-MESSAGES: (*up->get()).Do();
+ // CHECK-FIXES: (**up).Do();
+
+ std::unique_ptr<int> uu;
+ std::shared_ptr<double> *ss;
+ bool bb = uu.get() == nullptr;
+ // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant get() call
+ // CHECK-MESSAGES: uu.get() == nullptr;
+ // CHECK-FIXES: bool bb = uu == nullptr;
+
+ if (up->get());
+ // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant get() call
+ // CHECK-MESSAGES: if (up->get());
+ // CHECK-FIXES: if (*up);
+ if ((uu.get()));
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
+ // CHECK-MESSAGES: if ((uu.get()));
+ // CHECK-FIXES: if ((uu));
+ bb = !ss->get();
+ // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: redundant get() call
+ // CHECK-MESSAGES: bb = !ss->get();
+ // CHECK-FIXES: bb = !*ss;
+
+ bb = nullptr != ss->get();
+ // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: redundant get() call
+ // CHECK-MESSAGES: nullptr != ss->get();
+ // CHECK-FIXES: bb = nullptr != *ss;
+
+ bb = std::unique_ptr<int>().get() == NULL;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
+ // CHECK-MESSAGES: bb = std::unique_ptr<int>().get() == NULL;
+ // CHECK-FIXES: bb = std::unique_ptr<int>() == NULL;
+ bb = ss->get() == NULL;
+ // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
+ // CHECK-MESSAGES: bb = ss->get() == NULL;
+ // CHECK-FIXES: bb = *ss == NULL;
+
+ std::unique_ptr<int> x, y;
+ if (x.get() == nullptr);
+ // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant get() call
+ // CHECK-MESSAGES: if (x.get() == nullptr);
+ // CHECK-FIXES: if (x == nullptr);
+ if (nullptr == y.get());
+ // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: redundant get() call
+ // CHECK-MESSAGES: if (nullptr == y.get());
+ // CHECK-FIXES: if (nullptr == y);
+ if (x.get() == NULL);
+ // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant get() call
+ // CHECK-MESSAGES: if (x.get() == NULL);
+ // CHECK-FIXES: if (x == NULL);
+ if (NULL == x.get());
+ // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: redundant get() call
+ // CHECK-MESSAGES: if (NULL == x.get());
+ // CHECK-FIXES: if (NULL == x);
+}
diff --git a/test/clang-tidy/readability-uppercase-literal-suffix-float16.cpp b/test/clang-tidy/readability-uppercase-literal-suffix-float16.cpp
new file mode 100644
index 00000000..b2b858f9
--- /dev/null
+++ b/test/clang-tidy/readability-uppercase-literal-suffix-float16.cpp
@@ -0,0 +1,51 @@
+// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -target aarch64-linux-gnu -I %S
+
+#include "readability-uppercase-literal-suffix.h"
+
+void float16_normal_literals() {
+ // _Float16
+
+ static constexpr auto v14 = 1.f16;
+ // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase
+ // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 1.f16;
+ // CHECK-MESSAGES-NEXT: ^ ~
+ // CHECK-MESSAGES-NEXT: {{^ *}}F16{{$}}
+ // CHECK-FIXES: static constexpr auto v14 = 1.F16;
+ static_assert(is_same<decltype(v14), const _Float16>::value, "");
+ static_assert(v14 == 1.F16, "");
+
+ static constexpr auto v15 = 1.e0f16;
+ // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase
+ // CHECK-MESSAGES-NEXT: static constexpr auto v15 = 1.e0f16;
+ // CHECK-MESSAGES-NEXT: ^ ~
+ // CHECK-MESSAGES-NEXT: {{^ *}}F16{{$}}
+ // CHECK-FIXES: static constexpr auto v15 = 1.e0F16;
+ static_assert(is_same<decltype(v15), const _Float16>::value, "");
+ static_assert(v15 == 1.F16, "");
+
+ static constexpr auto v16 = 1.F16; // OK.
+ static_assert(is_same<decltype(v16), const _Float16>::value, "");
+ static_assert(v16 == 1.F16, "");
+
+ static constexpr auto v17 = 1.e0F16; // OK.
+ static_assert(is_same<decltype(v17), const _Float16>::value, "");
+ static_assert(v17 == 1.F16, "");
+}
+
+void float16_hexadecimal_literals() {
+// _Float16
+
+ static constexpr auto v13 = 0xfp0f16;
+ // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase
+ // CHECK-MESSAGES-NEXT: static constexpr auto v13 = 0xfp0f16;
+ // CHECK-MESSAGES-NEXT: ^ ~
+ // CHECK-MESSAGES-NEXT: {{^ *}}F16{{$}}
+ // CHECK-FIXES: static constexpr auto v13 = 0xfp0F16;
+ static_assert(is_same<decltype(v13), const _Float16>::value, "");
+ static_assert(v13 == 0xfp0F16, "");
+
+ static constexpr auto v14 = 0xfp0F16; // OK.
+ static_assert(is_same<decltype(v14), const _Float16>::value, "");
+ static_assert(v14 == 0xfp0F16, "");
+
+}
diff --git a/test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp b/test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp
index 4d41db7a..50e75fae 100644
--- a/test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp
+++ b/test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp
@@ -97,34 +97,6 @@ void floating_point_suffix() {
static constexpr auto v13 = 1.e0Q; // OK.
static_assert(is_same<decltype(v13), const __float128>::value, "");
static_assert(v13 == 1., "");
-
- // _Float16
-
- static constexpr auto v14 = 1.f16;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 1.f16;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F16{{$}}
- // CHECK-FIXES: static constexpr auto v14 = 1.F16;
- static_assert(is_same<decltype(v14), const _Float16>::value, "");
- static_assert(v14 == 1.F16, "");
-
- static constexpr auto v15 = 1.e0f16;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v15 = 1.e0f16;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F16{{$}}
- // CHECK-FIXES: static constexpr auto v15 = 1.e0F16;
- static_assert(is_same<decltype(v15), const _Float16>::value, "");
- static_assert(v15 == 1.F16, "");
-
- static constexpr auto v16 = 1.F16; // OK.
- static_assert(is_same<decltype(v16), const _Float16>::value, "");
- static_assert(v16 == 1.F16, "");
-
- static constexpr auto v17 = 1.e0F16; // OK.
- static_assert(is_same<decltype(v17), const _Float16>::value, "");
- static_assert(v17 == 1.F16, "");
}
void floating_point_complex_suffix() {
diff --git a/test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp b/test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp
index 4cc9d6d2..415c6d8e 100644
--- a/test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp
+++ b/test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp
@@ -93,21 +93,6 @@ void floating_point_suffix() {
static constexpr auto v12 = 0xfp0Q; // OK.
static_assert(is_same<decltype(v12), const __float128>::value, "");
static_assert(v12 == 0xfp0, "");
-
- // _Float16
-
- static constexpr auto v13 = 0xfp0f16;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v13 = 0xfp0f16;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F16{{$}}
- // CHECK-FIXES: static constexpr auto v13 = 0xfp0F16;
- static_assert(is_same<decltype(v13), const _Float16>::value, "");
- static_assert(v13 == 0xfp0F16, "");
-
- static constexpr auto v14 = 0xfp0F16; // OK.
- static_assert(is_same<decltype(v14), const _Float16>::value, "");
- static_assert(v14 == 0xfp0F16, "");
}
void floating_point_complex_suffix() {
diff --git a/test/clang-tidy/run-clang-tidy.cpp b/test/clang-tidy/run-clang-tidy.cpp
index 2207e430..31c4d681 100644
--- a/test/clang-tidy/run-clang-tidy.cpp
+++ b/test/clang-tidy/run-clang-tidy.cpp
@@ -1,3 +1,4 @@
+// RUN: %run_clang_tidy --help
// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c %/t/test.cpp\",\"file\":\"%/t/test.cpp\"}]" | sed -e 's/\\/\\\\/g' > %t/compile_commands.json
diff --git a/test/clang-tidy/static-analyzer-config.cpp b/test/clang-tidy/static-analyzer-config.cpp
index 9ca87cf8..d07c0c3a 100644
--- a/test/clang-tidy/static-analyzer-config.cpp
+++ b/test/clang-tidy/static-analyzer-config.cpp
@@ -1,5 +1,5 @@
// REQUIRES: static-analyzer
-// RUN: clang-tidy %s -checks='-*,clang-analyzer-unix.Malloc' -config='{CheckOptions: [{ key: "clang-analyzer-unix.Malloc:Optimistic", value: true}]}' -- | FileCheck %s
+// RUN: clang-tidy %s -checks='-*,clang-analyzer-unix.Malloc' -config='{CheckOptions: [{ key: "clang-analyzer-unix.DynamicMemoryModeling:Optimistic", value: true}]}' -- | FileCheck %s
typedef __typeof(sizeof(int)) size_t;
void *malloc(size_t);
void free(void *);
diff --git a/test/clangd/Inputs/BenchmarkHeader.h b/test/clangd/Inputs/BenchmarkHeader.h
deleted file mode 100644
index 3b7620ad..00000000
--- a/test/clangd/Inputs/BenchmarkHeader.h
+++ /dev/null
@@ -1,19 +0,0 @@
-namespace clang {
-namespace clangd {
-namespace dex {
-class Dex;
-} // namespace dex
-} // namespace clangd
-} // namespace clang
-
-namespace llvm {
-namespace sys {
-
-int getHostNumPhysicalCores();
-
-} // namespace sys
-} // namespace llvm
-
-namespace {
-int Variable;
-} // namespace
diff --git a/test/clangd/Inputs/BenchmarkSource.cpp b/test/clangd/Inputs/BenchmarkSource.cpp
deleted file mode 100644
index 1924df9a..00000000
--- a/test/clangd/Inputs/BenchmarkSource.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "BenchmarkHeader.h"
diff --git a/test/clangd/Inputs/background-index/compile_commands.json b/test/clangd/Inputs/background-index/compile_commands.json
deleted file mode 100644
index 1bb835f6..00000000
--- a/test/clangd/Inputs/background-index/compile_commands.json
+++ /dev/null
@@ -1,5 +0,0 @@
-[{
- "directory": "DIRECTORY",
- "command": "clang foo.cpp",
- "file": "DIRECTORY/foo.cpp"
-}]
diff --git a/test/clangd/Inputs/background-index/definition.jsonrpc b/test/clangd/Inputs/background-index/definition.jsonrpc
deleted file mode 100644
index 89d50482..00000000
--- a/test/clangd/Inputs/background-index/definition.jsonrpc
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "jsonrpc": "2.0",
- "id": 0,
- "method": "initialize",
- "params": {
- "processId": 123,
- "rootPath": "clangd",
- "capabilities": {},
- "trace": "off"
- }
-}
----
-{
- "jsonrpc": "2.0",
- "method": "textDocument/didOpen",
- "params": {
- "textDocument": {
- "uri": "file://DIRECTORY/bar.cpp",
- "languageId": "cpp",
- "version": 1,
- "text": "#include \"foo.h\"\nint main(){\nreturn foo();\n}"
- }
- }
-}
----
-{
- "jsonrpc": "2.0",
- "id": 1,
- "method": "sync",
- "params": null
-}
----
-{
- "jsonrpc": "2.0",
- "id": 2,
- "method": "textDocument/definition",
- "params": {
- "textDocument": {
- "uri": "file://DIRECTORY/bar.cpp"
- },
- "position": {
- "line": 2,
- "character": 8
- }
- }
-}
-# CHECK: "uri": "file://DIRECTORY/foo.cpp"
----
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/Inputs/background-index/foo.cpp b/test/clangd/Inputs/background-index/foo.cpp
deleted file mode 100644
index c42ca4d0..00000000
--- a/test/clangd/Inputs/background-index/foo.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "foo.h"
-int foo() { return 42; }
diff --git a/test/clangd/Inputs/background-index/foo.h b/test/clangd/Inputs/background-index/foo.h
deleted file mode 100644
index 9539f1d7..00000000
--- a/test/clangd/Inputs/background-index/foo.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef FOO_H
-#define FOO_H
-int foo();
-#endif
diff --git a/test/clangd/Inputs/requests.json b/test/clangd/Inputs/requests.json
deleted file mode 100644
index ee91cf24..00000000
--- a/test/clangd/Inputs/requests.json
+++ /dev/null
@@ -1,7 +0,0 @@
-[{"Limit":100,"ProximityPaths":["/usr/home/user/clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp"],"Query":"OMP","RestrictForCodeCompletion":true,"Scopes":["clang::"], "AnyScope":false},
-{"Limit":100,"ProximityPaths":[],"Query":"s","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""], "AnyScope":false},
-{"Limit":100,"ProximityPaths":[],"Query":"sy","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""], "AnyScope":false},
-{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""], "AnyScope":false},
-{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""], "AnyScope":false},
-{"Limit":100,"ProximityPaths":[],"Query":"Dex","RestrictForCodeCompletion":true,"Scopes":["clang::clangd::", "clang::", "clang::clangd::dex::"],"AnyScope":false},
-{"Limit":100,"ProximityPaths":[],"Query":"Variable","RestrictForCodeCompletion":true,"Scopes":[""], "AnyScope":false}]
diff --git a/test/clangd/Inputs/symbols.test.yaml b/test/clangd/Inputs/symbols.test.yaml
deleted file mode 100644
index 40068e36..00000000
--- a/test/clangd/Inputs/symbols.test.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
----
-!Symbol
-ID: 057557CEBF6E6B2D
-Name: 'vector'
-Scope: 'std::'
-SymInfo:
- Kind: Class
- Lang: Cpp
-CanonicalDeclaration:
- FileURI: 'file:///vector.h'
- Start:
- Line: 215
- Column: 10
- End:
- Line: 215
- Column: 16
-...
diff --git a/test/clangd/background-index.test b/test/clangd/background-index.test
deleted file mode 100644
index 34c419ac..00000000
--- a/test/clangd/background-index.test
+++ /dev/null
@@ -1,20 +0,0 @@
-# We need to splice paths into file:// URIs for this test.
-# UNSUPPORTED: win32
-
-# Use a copy of inputs, as we'll mutate it (as will the background index).
-# RUN: rm -rf %t
-# RUN: cp -r %S/Inputs/background-index %t
-# Need to embed the correct temp path in the actual JSON-RPC requests.
-# RUN: sed -i -e "s|DIRECTORY|%t|" %t/*
-
-# We're editing bar.cpp, which includes foo.h.
-# foo() is declared in foo.h and defined in foo.cpp.
-# The background index should allow us to go-to-definition on foo().
-# RUN: clangd -background-index -background-index-rebuild-period=0 -lit-test < %t/definition.jsonrpc | FileCheck %t/definition.jsonrpc
-
-# Test that the index is writing files in the expected location.
-# RUN: ls %t/.clangd-index/foo.cpp.*.idx
-
-# Test the index is read from disk: delete code and restart clangd.
-# RUN: rm %t/foo.cpp
-# RUN: clangd -background-index -lit-test < %t/definition.jsonrpc | FileCheck %t/definition.jsonrpc
diff --git a/test/clangd/compile-commands-path-in-initialize.test b/test/clangd/compile-commands-path-in-initialize.test
deleted file mode 100644
index 87086e3c..00000000
--- a/test/clangd/compile-commands-path-in-initialize.test
+++ /dev/null
@@ -1,28 +0,0 @@
-# Test that we can set choose a configuration/build directly in the initialize
-# request.
-
-# RUN: rm -rf %t.dir/* && mkdir -p %t.dir
-# RUN: mkdir %t.dir/build-1
-# RUN: echo '[{"directory": "%/t.dir", "command": "c++ the-file.cpp", "file": "the-file.cpp"}]' > %t.dir/compile_commands.json
-# RUN: echo '[{"directory": "%/t.dir/build-1", "command": "c++ -DMACRO=1 the-file.cpp", "file": "../the-file.cpp"}]' > %t.dir/build-1/compile_commands.json
-
-# RUN: sed -e "s|INPUT_DIR|%/t.dir|g" %s > %t.test.1
-
-# On Windows, we need the URI in didOpen to look like "uri":"file:///C:/..."
-# (with the extra slash in the front), so we add it here.
-# RUN: sed -e "s|file://\([A-Z]\):/|file:///\1:/|g" %t.test.1 > %t.test
-
-# RUN: clangd -lit-test < %t.test | FileCheck -strict-whitespace %t.test
-
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"initializationOptions":{"compilationDatabasePath":"INPUT_DIR/build-1"}}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file://INPUT_DIR/the-file.cpp","languageId":"cpp","version":1,"text":"#if !defined(MACRO)\n#pragma message (\"MACRO is not defined\")\n#elif MACRO == 1\n#pragma message (\"MACRO is one\")\n#else\n#pragma message (\"woops\")\n#endif\nint main() {}\n"}}}
-# CHECK: "method": "textDocument/publishDiagnostics",
-# CHECK-NEXT: "params": {
-# CHECK-NEXT: "diagnostics": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "message": "MACRO is one",
----
-{"jsonrpc":"2.0","id":10000,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/completion-auto-trigger.test b/test/clangd/completion-auto-trigger.test
deleted file mode 100644
index db3cc537..00000000
--- a/test/clangd/completion-auto-trigger.test
+++ /dev/null
@@ -1,106 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"namespace ns { int ns_member; } struct vector { int size; static int default_capacity; };\nvoid test(vector *a, vector *b) {\n if (a > b) {} \n a->size = 10;\n\n a ? a : b;\n ns::ns_member = 10;\n}"}}}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":9},"context":{"triggerKind":2,"triggerCharacter":">"}}}
-# CHECK: "error": {
-# CHECK-NEXT: "code": -32001,
-# CHECK-NEXT: "message": "ignored auto-triggered completion, preceding char did not match"
-# CHECK-NEXT: },
-# CHECK-NEXT: "id": 1,
----
-{"jsonrpc":"2.0","id":2,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":3,"character":5},"context":{"triggerKind":2,"triggerCharacter":">"}}}
-# CHECK: "id": 2,
-# CHECK-NEXT: "jsonrpc": "2.0"
-# CHECK-NEXT: "result": {
-# CHECK-NEXT: "isIncomplete": false,
-# CHECK-NEXT: "items": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "detail": "int",
-# CHECK-NEXT: "filterText": "size",
-# CHECK-NEXT: "insertText": "size",
-# CHECK-NEXT: "insertTextFormat": 1,
-# CHECK-NEXT: "kind": 5,
-# CHECK-NEXT: "label": " size",
-# CHECK-NEXT: "sortText": "3eacccccsize",
-# CHECK-NEXT: "textEdit": {
-# CHECK-NEXT: "newText": "size",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 5,
-# CHECK-NEXT: "line": 3
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 5,
-# CHECK-NEXT: "line": 3
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "detail": "int",
-# CHECK-NEXT: "filterText": "default_capacity",
-# CHECK-NEXT: "insertText": "default_capacity",
-# CHECK-NEXT: "insertTextFormat": 1,
-# CHECK-NEXT: "kind": 10,
-# CHECK-NEXT: "label": " default_capacity",
-# CHECK-NEXT: "sortText": "3fd70a3ddefault_capacity",
-# CHECK-NEXT: "textEdit": {
-# CHECK-NEXT: "newText": "default_capacity",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 5,
-# CHECK-NEXT: "line": 3
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 5,
-# CHECK-NEXT: "line": 3
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":5,"character":9},"context":{"triggerKind":2,"triggerCharacter":":"}}}
-# CHECK: "error": {
-# CHECK-NEXT: "code": -32001,
-# CHECK-NEXT: "message": "ignored auto-triggered completion, preceding char did not match"
-# CHECK-NEXT: },
-# CHECK-NEXT: "id": 3,
----
-{"jsonrpc":"2.0","id":4,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":6,"character":6},"context":{"triggerKind":2,"triggerCharacter":":"}}}
----
-# CHECK: "id": 4,
-# CHECK-NEXT: "jsonrpc": "2.0"
-# CHECK-NEXT: "result": {
-# CHECK-NEXT: "isIncomplete": false,
-# CHECK-NEXT: "items": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "detail": "int",
-# CHECK-NEXT: "filterText": "ns_member",
-# CHECK-NEXT: "insertText": "ns_member",
-# CHECK-NEXT: "insertTextFormat": 1,
-# CHECK-NEXT: "kind": 6,
-# CHECK-NEXT: "label": " ns_member",
-# CHECK-NEXT: "sortText": "3f2cccccns_member",
-# CHECK-NEXT: "textEdit": {
-# CHECK-NEXT: "newText": "ns_member",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 6,
-# CHECK-NEXT: "line": 6
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 6,
-# CHECK-NEXT: "line": 6
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-{"jsonrpc":"2.0","id":5,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/completion-snippets.test b/test/clangd/completion-snippets.test
deleted file mode 100644
index 22cd0821..00000000
--- a/test/clangd/completion-snippets.test
+++ /dev/null
@@ -1,56 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-# RUN: clangd -lit-test -pch-storage=memory < %s | FileCheck -strict-whitespace %s
-{
- "jsonrpc": "2.0",
- "id": 0,
- "method": "initialize",
- "params": {
- "processId": 123,
- "rootPath": "clangd",
- "capabilities": {
- "textDocument": {
- "completion": {
- "completionItem": {
- "snippetSupport": true
- }
- }
- }
- },
- "trace": "off"
- }
-}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"int func_with_args(int a, int b);\nint main() {\nfunc_with\n}"}}}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":7}}}
-# CHECK: "id": 1
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": {
-# CHECK-NEXT: "isIncomplete": {{.*}}
-# CHECK-NEXT: "items": [
-# CHECK: "filterText": "func_with_args",
-# CHECK-NEXT: "insertText": "func_with_args(${1:int a}, ${2:int b})",
-# CHECK-NEXT: "insertTextFormat": 2,
-# CHECK-NEXT: "kind": 3,
-# CHECK-NEXT: "label": " func_with_args(int a, int b)",
-# CHECK-NEXT: "sortText": "{{.*}}func_with_args"
-# CHECK-NEXT: "textEdit": {
-# CHECK-NEXT: "newText": "func_with_args(${1:int a}, ${2:int b})",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 7,
-# CHECK-NEXT: "line": 2
-# CHECK-NEXT: }
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 0,
-# CHECK-NEXT: "line": 2
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","id":4,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/completion.test b/test/clangd/completion.test
deleted file mode 100644
index 0094d474..00000000
--- a/test/clangd/completion.test
+++ /dev/null
@@ -1,72 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-# RUN: clangd -lit-test -pch-storage=memory < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"struct S { int a; };\nint main() {\nS().\n}"}}}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":4}}}
-# CHECK: "id": 1
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": {
-# CHECK-NEXT: "isIncomplete": false,
-# CHECK-NEXT: "items": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "detail": "int",
-# CHECK-NEXT: "filterText": "a",
-# CHECK-NEXT: "insertText": "a",
-# CHECK-NEXT: "insertTextFormat": 1,
-# CHECK-NEXT: "kind": 5,
-# CHECK-NEXT: "label": " a",
-# CHECK-NEXT: "sortText": "{{.*}}a"
-# CHECK-NEXT: "textEdit": {
-# CHECK-NEXT: "newText": "a",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 4,
-# CHECK-NEXT: "line": 2
-# CHECK-NEXT: }
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 4,
-# CHECK-NEXT: "line": 2
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
----
-# Update the source file and check for completions again.
-{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"test:///main.cpp","version":2},"contentChanges":[{"text":"struct S { int b; };\nint main() {\nS().\n}"}]}}
----
-{"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":4}}}
-# CHECK: "id": 3,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": {
-# CHECK-NEXT: "isIncomplete": false,
-# CHECK-NEXT: "items": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "detail": "int",
-# CHECK-NEXT: "filterText": "b",
-# CHECK-NEXT: "insertText": "b",
-# CHECK-NEXT: "insertTextFormat": 1,
-# CHECK-NEXT: "kind": 5,
-# CHECK-NEXT: "label": " b",
-# CHECK-NEXT: "sortText": "{{.*}}b"
-# CHECK-NEXT: "textEdit": {
-# CHECK-NEXT: "newText": "b",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 4,
-# CHECK-NEXT: "line": 2
-# CHECK-NEXT: }
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 4,
-# CHECK-NEXT: "line": 2
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
----
-{"jsonrpc":"2.0","id":4,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/crash-non-added-files.test b/test/clangd/crash-non-added-files.test
deleted file mode 100644
index d86f7d26..00000000
--- a/test/clangd/crash-non-added-files.test
+++ /dev/null
@@ -1,34 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","id":2,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"test:///foo.c"},"range":{"start":{"line":104,"character":13},"end":{"line":0,"character":35}},"context":{"diagnostics":[{"range":{"start": {"line": 0, "character": 32}, "end": {"line": 0, "character": 37}},"severity":2,"message":"using the result of an assignment as a condition without parentheses"},{"range":{"start": {"line": 0, "character": 34}, "end": {"line": 0, "character": 35}},"severity":3,"message":"place parentheses around the assignment to silence this warning"},{"range":{"start": {"line": 0, "character": 34}, "end": {"line": 0, "character": 35}},"severity":3,"message":"use '==' to turn this assignment into an equality comparison"}]}}}
-# CHECK: "error": {
-# CHECK-NEXT: "code": -32602
-# CHECK-NEXT: "message": "onCodeAction called for non-added file"
-# CHECK-NEXT: },
-# CHECK-NEXT: "id": 2,
----
-{"jsonrpc":"2.0","id":3,"method":"textDocument/rangeFormatting","params":{"textDocument":{"uri":"test:///foo.c"},"range":{"start":{"line":1,"character":4},"end":{"line":1,"character":12}},"options":{"tabSize":4,"insertSpaces":true}}}
-# CHECK: "error": {
-# CHECK-NEXT: "code": -32602
-# CHECK-NEXT: "message": "onDocumentRangeFormatting called for non-added file"
-# CHECK-NEXT: },
-# CHECK-NEXT: "id": 3,
----
-{"jsonrpc":"2.0","id":4,"method":"textDocument/formatting","params":{"textDocument":{"uri":"test:///foo.c"},"options":{"tabSize":4,"insertSpaces":true}}}
-# CHECK: "error": {
-# CHECK-NEXT: "code": -32602
-# CHECK-NEXT: "message": "onDocumentFormatting called for non-added file"
-# CHECK-NEXT: },
-# CHECK-NEXT: "id": 4,
----
-{"jsonrpc":"2.0","id":5,"method":"textDocument/onTypeFormatting","params":{"textDocument":{"uri":"test:///foo.c"},"position":{"line":3,"character":1},"ch":"}","options":{"tabSize":4,"insertSpaces":true}}}
-# CHECK: "error": {
-# CHECK-NEXT: "code": -32602
-# CHECK-NEXT: "message": "onDocumentOnTypeFormatting called for non-added file"
-# CHECK-NEXT: },
-# CHECK-NEXT: "id": 5,
----
-{"jsonrpc":"2.0","id":6,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/delimited-input-comment-at-the-end.test b/test/clangd/delimited-input-comment-at-the-end.test
deleted file mode 100644
index 34a248df..00000000
--- a/test/clangd/delimited-input-comment-at-the-end.test
+++ /dev/null
@@ -1,11 +0,0 @@
-# RUN: clangd -input-style=delimited -run-synchronously -input-mirror-file %t < %s
-# RUN: grep '{"jsonrpc":"2.0","id":3,"method":"exit"}' %t
-#
-# RUN: clangd -lit-test -input-mirror-file %t < %s
-# RUN: grep '{"jsonrpc":"2.0","id":3,"method":"exit"}' %t
-#
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/diagnostic-category.test b/test/clangd/diagnostic-category.test
deleted file mode 100644
index 440afbb1..00000000
--- a/test/clangd/diagnostic-category.test
+++ /dev/null
@@ -1,43 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{"textDocument":{"publishDiagnostics":{"categorySupport":true}}},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","version":1,"text":"struct Point {}; union Point p;"}}}
-# CHECK: "method": "textDocument/publishDiagnostics",
-# CHECK-NEXT: "params": {
-# CHECK-NEXT: "diagnostics": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "category": "Semantic Issue",
-# CHECK-NEXT: "message": "Use of 'Point' with tag type that does not match previous declaration\n\nfoo.c:1:8: note: previous use is here",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 22,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 17,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "severity": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "message": "Previous use is here\n\nfoo.c:1:18: error: use of 'Point' with tag type that does not match previous declaration",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 12,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 7,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "severity": 3
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "uri": "file://{{.*}}/foo.c"
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","id":4,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/diagnostics.test b/test/clangd/diagnostics.test
deleted file mode 100644
index a191c082..00000000
--- a/test/clangd/diagnostics.test
+++ /dev/null
@@ -1,28 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","version":1,"text":"void main() {}"}}}
-# CHECK: "method": "textDocument/publishDiagnostics",
-# CHECK-NEXT: "params": {
-# CHECK-NEXT: "diagnostics": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "message": "Return type of 'main' is not 'int'",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 4,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 0,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "severity": 2
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "uri": "file://{{.*}}/foo.c"
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","id":5,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/did-change-configuration-params.test b/test/clangd/did-change-configuration-params.test
deleted file mode 100644
index 51b4a874..00000000
--- a/test/clangd/did-change-configuration-params.test
+++ /dev/null
@@ -1,52 +0,0 @@
-# RUN: clangd -compile_args_from=lsp -lit-test < %s 2> %t | FileCheck -strict-whitespace %s
-# RUN: cat %t | FileCheck --check-prefix=ERR %s
-# UNSUPPORTED: windows-gnu,windows-msvc
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"compilationDatabaseChanges":{"/clangd-test/foo.c": {"workingDirectory":"/clangd-test", "compilationCommand": ["clang", "-c", "foo.c"]}}}}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","version":1,"text":"int main() { int i; return i; }"}}}
-# CHECK: "method": "textDocument/publishDiagnostics",
-# CHECK-NEXT: "params": {
-# CHECK-NEXT: "diagnostics": [],
-# CHECK-NEXT: "uri": "file://{{.*}}/foo.c"
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///bar.c","languageId":"c","version":1,"text":"int main() { int i; return i; }"}}}
-# CHECK: "method": "textDocument/publishDiagnostics",
-# CHECK-NEXT: "params": {
-# CHECK-NEXT: "diagnostics": [],
-# CHECK-NEXT: "uri": "file://{{.*}}/bar.c"
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"compilationDatabaseChanges":{"/clangd-test/foo.c": {"workingDirectory":"/clangd-test2", "compilationCommand": ["clang", "-c", "foo.c", "-Wall", "-Werror"]}}}}}
-# CHECK: "method": "textDocument/publishDiagnostics",
-# CHECK-NEXT: "params": {
-# CHECK-NEXT: "diagnostics": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "message": "Variable 'i' is uninitialized when used here",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 28,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 27,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "severity": 1
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "uri": "file://{{.*}}/foo.c"
-# CHECK-NEXT: }
-#
-# ERR: Updating file {{.*}}foo.c with command [{{.*}}clangd-test2] clang -c foo.c -Wall -Werror
-# Don't reparse the second file:
-# ERR: Skipping rebuild of the AST for {{.*}}bar.c
----
-{"jsonrpc":"2.0","id":5,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
-
-
diff --git a/test/clangd/execute-command.test b/test/clangd/execute-command.test
deleted file mode 100644
index 85d4b9b8..00000000
--- a/test/clangd/execute-command.test
+++ /dev/null
@@ -1,66 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","version":1,"text":"int main(int i, char **a) { if (i = 2) {}}"}}}
-# CHECK: "method": "textDocument/publishDiagnostics",
-# CHECK-NEXT: "params": {
-# CHECK-NEXT: "diagnostics": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "message": "Using the result of an assignment as a condition without parentheses",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 37,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 32,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "severity": 2
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "uri": "file://{{.*}}/foo.c"
-# CHECK-NEXT: }
----
-# No command name
-{"jsonrpc":"2.0","id":3,"method":"workspace/executeCommand","params":{}}
----
-# Invalid, non-scalar command name
-{"jsonrpc":"2.0","id":4,"method":"workspace/executeCommand","params":{"command": {}}}
----
-{"jsonrpc":"2.0","id":5,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","custom":"foo", "arguments":[{"changes":{"test:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":{"start":{"line":0,"character":37},"end":{"line":0,"character":37}},"newText":")"}]}}]}}
----
-# Arguments not a sequence.
-{"jsonrpc":"2.0","id":6,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":"foo"}}
----
-# Unknown command.
-{"jsonrpc":"2.0","id":7,"method":"workspace/executeCommand","params":{"command":"mycommand"}}
----
-# ApplyFix argument not a mapping node.
-{"jsonrpc":"2.0","id":8,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","custom":"foo", "arguments":[""]}}
----
-# Custom field in WorkspaceEdit
-{"jsonrpc":"2.0","id":9,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"custom":"foo", "changes":{"test:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":{"start":{"line":0,"character":37},"end":{"line":0,"character":37}},"newText":")"}]}}]}}
----
-# changes in WorkspaceEdit with no mapping node
-{"jsonrpc":"2.0","id":10,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":"foo"}]}}
----
-# Custom field in WorkspaceEditChange
-{"jsonrpc":"2.0","id":11,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"test:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":{"start":{"line":0,"character":37},"end":{"line":0,"character":37}},"newText":")"}], "custom":"foo"}}]}}
----
-# No sequence node for TextEdits
-{"jsonrpc":"2.0","id":12,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"test:///foo.c":"bar"}}]}}
----
-# No mapping node for TextEdit
-{"jsonrpc":"2.0","id":13,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"test:///foo.c":[""]}}]}}
----
-# TextEdit not decoded
-{"jsonrpc":"2.0","id":14,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"test:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":"","newText":")"}]}}]}}
----
-# Command name after arguments
-{"jsonrpc":"2.0","id":9,"method":"workspace/executeCommand","params":{"arguments":[{"custom":"foo", "changes":{"test:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":{"start":{"line":0,"character":37},"end":{"line":0,"character":37}},"newText":")"}]}}],"command":"clangd.applyFix"}}
----
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/exit-with-shutdown.test b/test/clangd/exit-with-shutdown.test
deleted file mode 100644
index 99e412c7..00000000
--- a/test/clangd/exit-with-shutdown.test
+++ /dev/null
@@ -1,6 +0,0 @@
-# RUN: clangd -lit-test < %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/exit-without-shutdown.test b/test/clangd/exit-without-shutdown.test
deleted file mode 100644
index 7b22d059..00000000
--- a/test/clangd/exit-without-shutdown.test
+++ /dev/null
@@ -1,4 +0,0 @@
-# RUN: not clangd -lit-test < %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/filestatus.test b/test/clangd/filestatus.test
deleted file mode 100644
index c485939b..00000000
--- a/test/clangd/filestatus.test
+++ /dev/null
@@ -1,13 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"initializationOptions":{"clangdFileStatus": true},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"int x; int y = x;"}}}
-# CHECK: "method": "textDocument/clangd.fileStatus",
-# CHECK-NEXT: "params": {
-# CHECK-NEXT: "state": "parsing includes",
-# CHECK-NEXT: "uri": "{{.*}}/main.cpp"
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/fixits-codeaction.test b/test/clangd/fixits-codeaction.test
deleted file mode 100644
index 97dd4ff2..00000000
--- a/test/clangd/fixits-codeaction.test
+++ /dev/null
@@ -1,126 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{"textDocument":{"codeAction":{"codeActionLiteralSupport":{}}}},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","version":1,"text":"int main(int i, char **a) { if (i = 2) {}}"}}}
-# CHECK: "method": "textDocument/publishDiagnostics",
-# CHECK-NEXT: "params": {
-# CHECK-NEXT: "diagnostics": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "message": "Using the result of an assignment as a condition without parentheses",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 37,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 32,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "severity": 2
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "uri": "file://{{.*}}/foo.c"
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","id":2,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"test:///foo.c"},"range":{"start":{"line":104,"character":13},"end":{"line":0,"character":35}},"context":{"diagnostics":[{"range":{"start": {"line": 0, "character": 32}, "end": {"line": 0, "character": 37}},"severity":2,"message":"Using the result of an assignment as a condition without parentheses"}]}}}
-# CHECK: "id": 2,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "diagnostics": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "message": "Using the result of an assignment as a condition without parentheses",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 37,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 32,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "severity": 2
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "edit": {
-# CHECK-NEXT: "changes": {
-# CHECK-NEXT: "file://{{.*}}/foo.c": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "(",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 32,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 32,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": ")",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 37,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 37,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "kind": "quickfix",
-# CHECK-NEXT: "title": "place parentheses around the assignment to silence this warning"
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "diagnostics": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "message": "Using the result of an assignment as a condition without parentheses",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 37,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 32,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "severity": 2
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "edit": {
-# CHECK-NEXT: "changes": {
-# CHECK-NEXT: "file://{{.*}}/foo.c": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "==",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 35,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 34,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "kind": "quickfix",
-# CHECK-NEXT: "title": "use '==' to turn this assignment into an equality comparison"
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
----
-{"jsonrpc":"2.0","id":4,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
-
diff --git a/test/clangd/fixits-command.test b/test/clangd/fixits-command.test
deleted file mode 100644
index 67f70dbe..00000000
--- a/test/clangd/fixits-command.test
+++ /dev/null
@@ -1,210 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","version":1,"text":"int main(int i, char **a) { if (i = 2) {}}"}}}
-# CHECK: "method": "textDocument/publishDiagnostics",
-# CHECK-NEXT: "params": {
-# CHECK-NEXT: "diagnostics": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "message": "Using the result of an assignment as a condition without parentheses",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 37,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 32,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "severity": 2
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "uri": "file://{{.*}}/foo.c"
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","id":2,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"test:///foo.c"},"range":{"start":{"line":104,"character":13},"end":{"line":0,"character":35}},"context":{"diagnostics":[{"range":{"start": {"line": 0, "character": 32}, "end": {"line": 0, "character": 37}},"severity":2,"message":"Using the result of an assignment as a condition without parentheses"}]}}}
-# CHECK: "id": 2,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "arguments": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "changes": {
-# CHECK-NEXT: "file://{{.*}}/foo.c": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "(",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 32,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 32,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": ")",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 37,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 37,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "command": "clangd.applyFix",
-# CHECK-NEXT: "title": "Apply fix: place parentheses around the assignment to silence this warning"
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "arguments": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "changes": {
-# CHECK-NEXT: "file://{{.*}}/foo.c": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "==",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 35,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 34,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "command": "clangd.applyFix",
-# CHECK-NEXT: "title": "Apply fix: use '==' to turn this assignment into an equality comparison"
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
----
-{"jsonrpc":"2.0","id":3,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"test:///foo.c"},"range":{"start":{"line":104,"character":13},"end":{"line":0,"character":35}},"context":{"diagnostics":[{"range":{"start": {"line": 0, "character": 32}, "end": {"line": 0, "character": 37}},"severity":2,"message":"Using the result of an assignment as a condition without parentheses"}]}}}
-# Make sure unused "code" and "source" fields ignored gracefully
-# CHECK: "id": 3,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "arguments": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "changes": {
-# CHECK-NEXT: "file://{{.*}}/foo.c": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "(",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 32,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 32,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": ")",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 37,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 37,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "command": "clangd.applyFix",
-# CHECK-NEXT: "title": "Apply fix: place parentheses around the assignment to silence this warning"
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "arguments": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "changes": {
-# CHECK-NEXT: "file://{{.*}}/foo.c": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "==",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 35,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 34,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "command": "clangd.applyFix",
-# CHECK-NEXT: "title": "Apply fix: use '==' to turn this assignment into an equality comparison"
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
----
-{"jsonrpc":"2.0","id":4,"method":"workspace/executeCommand","params":{"command":"clangd.applyFix","arguments":[{"changes":{"test:///foo.c":[{"range":{"start":{"line":0,"character":32},"end":{"line":0,"character":32}},"newText":"("},{"range":{"start":{"line":0,"character":37},"end":{"line":0,"character":37}},"newText":")"}]}}]}}
-# CHECK: "id": 4,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": "Fix applied."
-#
-# CHECK: "id": 0,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "method": "workspace/applyEdit",
-# CHECK-NEXT: "params": {
-# CHECK-NEXT: "edit": {
-# CHECK-NEXT: "changes": {
-# CHECK-NEXT: "{{.*}}/foo.c": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "(",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 32,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 32,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": ")",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 37,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 37,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","id":4,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/fixits-embed-in-diagnostic.test b/test/clangd/fixits-embed-in-diagnostic.test
deleted file mode 100644
index f1aa1cfe..00000000
--- a/test/clangd/fixits-embed-in-diagnostic.test
+++ /dev/null
@@ -1,67 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{"textDocument":{"publishDiagnostics":{"codeActionsInline":true}}},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","version":1,"text":"struct Point {}; union Point p;"}}}
-# CHECK: "method": "textDocument/publishDiagnostics",
-# CHECK-NEXT: "params": {
-# CHECK-NEXT: "diagnostics": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "codeActions": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "edit": {
-# CHECK-NEXT: "changes": {
-# CHECK-NEXT: "file://{{.*}}/foo.c": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "struct",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 22,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 17,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "kind": "quickfix",
-# CHECK-NEXT: "title": "change 'union' to 'struct'"
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "message": "Use of 'Point' with tag type that does not match previous declaration\n\nfoo.c:1:8: note: previous use is here",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 22,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 17,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "severity": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "message": "Previous use is here\n\nfoo.c:1:18: error: use of 'Point' with tag type that does not match previous declaration",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 12,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 7,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "severity": 3
-# CHECK-NEXT: }
-# CHECK-NEXT: ],
-# CHECK-NEXT: "uri": "file://{{.*}}/foo.c"
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","id":4,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/formatting.test b/test/clangd/formatting.test
deleted file mode 100644
index 9f8f3db9..00000000
--- a/test/clangd/formatting.test
+++ /dev/null
@@ -1,187 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","version":1,"text":"int foo ( int x ) {\n x = x+1;\n return x;\n }"}}}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/rangeFormatting","params":{"textDocument":{"uri":"test:///foo.c"},"range":{"start":{"line":1,"character":4},"end":{"line":1,"character":12}},"options":{"tabSize":4,"insertSpaces":true}}}
-# CHECK: "id": 1,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "\n ",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 4,
-# CHECK-NEXT: "line": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 19,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": " ",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 9,
-# CHECK-NEXT: "line": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 9,
-# CHECK-NEXT: "line": 1
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": " ",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 10,
-# CHECK-NEXT: "line": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 10,
-# CHECK-NEXT: "line": 1
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "\n ",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 4,
-# CHECK-NEXT: "line": 2
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 12,
-# CHECK-NEXT: "line": 1
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
----
-{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"test:///foo.c","version":5},"contentChanges":[{"text":"int foo ( int x ) {\n x = x + 1;\n return x;\n }"}]}}
-#
-#
----
-{"jsonrpc":"2.0","id":2,"method":"textDocument/rangeFormatting","params":{"textDocument":{"uri":"test:///foo.c"},"range":{"start":{"line":1,"character":2},"end":{"line":1,"character":12}},"options":{"tabSize":4,"insertSpaces":true}}}
-# CHECK: "id": 2,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": []
----
-{"jsonrpc":"2.0","id":3,"method":"textDocument/formatting","params":{"textDocument":{"uri":"test:///foo.c"},"options":{"tabSize":4,"insertSpaces":true}}}
-# CHECK: "id": 3,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 8,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 7,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 10,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 9,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 16,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 15,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "\n",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 4,
-# CHECK-NEXT: "line": 3
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 11,
-# CHECK-NEXT: "line": 2
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
----
-{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"test:///foo.c","version":9},"contentChanges":[{"text":"int foo(int x) {\n x = x + 1;\n return x;\n}"}]}}
----
-{"jsonrpc":"2.0","id":4,"method":"textDocument/formatting","params":{"textDocument":{"uri":"test:///foo.c"},"options":{"tabSize":4,"insertSpaces":true}}}
-# CHECK: "id": 4,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": []
----
-{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"test:///foo.c","version":5},"contentChanges":[{"text":"int foo ( int x ) {\n x = x + 1;\n return x;\n}"}]}}
----
-{"jsonrpc":"2.0","id":5,"method":"textDocument/onTypeFormatting","params":{"textDocument":{"uri":"test:///foo.c"},"position":{"line":3,"character":1},"ch":"}","options":{"tabSize":4,"insertSpaces":true}}}
-# CHECK: "id": 5,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 8,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 7,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 10,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 9,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 16,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 15,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
----
-{"jsonrpc":"2.0","id":6,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/hover.test b/test/clangd/hover.test
deleted file mode 100644
index 8f1ead05..00000000
--- a/test/clangd/hover.test
+++ /dev/null
@@ -1,24 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"void foo(); int main() { foo(); }\n"}}}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":0,"character":27}}}
-# CHECK: "id": 1,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": {
-# CHECK-NEXT: "contents": {
-# CHECK-NEXT: "kind": "plaintext",
-# CHECK-NEXT: "value": "Declared in global namespace\n\nvoid foo()"
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT:}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":0,"character":10}}}
-# CHECK: "id": 1,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": null
----
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/index-tools.test b/test/clangd/index-tools.test
deleted file mode 100644
index 93cf56fe..00000000
--- a/test/clangd/index-tools.test
+++ /dev/null
@@ -1,6 +0,0 @@
-# RUN: clangd-indexer %p/Inputs/BenchmarkSource.cpp -- -I%p/Inputs > %t.index
-# FIXME: By default, benchmarks are excluded from the list of default targets hence not built. Find a way to depend on benchmarks to run the next command.
-# REQUIRES: shell
-# RUN: if [ -f %clangd-benchmark-dir/IndexBenchmark ]; then %clangd-benchmark-dir/IndexBenchmark %t.index %p/Inputs/requests.json --benchmark_min_time=0.01 ; fi
-# Pass invalid JSON file and check that IndexBenchmark fails to parse it.
-# RUN: if [ -f %clangd-benchmark-dir/IndexBenchmark ]; then not %clangd-benchmark-dir/IndexBenchmark %t.index %t --benchmark_min_time=0.01 ; fi
diff --git a/test/clangd/initialize-params-invalid.test b/test/clangd/initialize-params-invalid.test
deleted file mode 100644
index f51a7279..00000000
--- a/test/clangd/initialize-params-invalid.test
+++ /dev/null
@@ -1,12 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-# Test with invalid initialize request parameters
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":"","rootUri":"test:///workspace","capabilities":{},"trace":"off"}}
-# CHECK: "id": 0,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": {
-# CHECK-NEXT: "capabilities": {
-# ...
----
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/initialize-params.test b/test/clangd/initialize-params.test
deleted file mode 100644
index 62f7b41a..00000000
--- a/test/clangd/initialize-params.test
+++ /dev/null
@@ -1,50 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-# Test initialize request parameters with rootUri
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootUri":"test:///workspace","capabilities":{},"trace":"off"}}
-# CHECK: "id": 0,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": {
-# CHECK-NEXT: "capabilities": {
-# CHECK-NEXT: "codeActionProvider": true,
-# CHECK-NEXT: "completionProvider": {
-# CHECK-NEXT: "resolveProvider": false,
-# CHECK-NEXT: "triggerCharacters": [
-# CHECK-NEXT: ".",
-# CHECK-NEXT: ">",
-# CHECK-NEXT: ":"
-# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "definitionProvider": true,
-# CHECK-NEXT: "documentFormattingProvider": true,
-# CHECK-NEXT: "documentHighlightProvider": true,
-# CHECK-NEXT: "documentOnTypeFormattingProvider": {
-# CHECK-NEXT: "firstTriggerCharacter": "}",
-# CHECK-NEXT: "moreTriggerCharacter": []
-# CHECK-NEXT: },
-# CHECK-NEXT: "documentRangeFormattingProvider": true,
-# CHECK-NEXT: "documentSymbolProvider": true,
-# CHECK-NEXT: "executeCommandProvider": {
-# CHECK-NEXT: "commands": [
-# CHECK-NEXT: "clangd.applyFix"
-# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "hoverProvider": true,
-# CHECK-NEXT: "referencesProvider": true,
-# CHECK-NEXT: "renameProvider": true,
-# CHECK-NEXT: "signatureHelpProvider": {
-# CHECK-NEXT: "triggerCharacters": [
-# CHECK-NEXT: "(",
-# CHECK-NEXT: ","
-# CHECK-NEXT: ]
-# CHECK-NEXT: },
-# CHECK-NEXT: "textDocumentSync": 2,
-# CHECK-NEXT: "workspaceSymbolProvider": true
-# CHECK-NEXT: }
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
-# CHECK: "id": 3,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": null
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/initialize-sequence.test b/test/clangd/initialize-sequence.test
deleted file mode 100644
index d1b82470..00000000
--- a/test/clangd/initialize-sequence.test
+++ /dev/null
@@ -1,21 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"workspace/symbol","params":{"query":"std::basic_ostringstream"}}
-# CHECK: "error": {
-# CHECK-NEXT: "code": -32002
-# CHECK-NEXT: "message": "server not initialized"
-# CHECK-NEXT: },
-# CHECK-NEXT: "id": 0,
----
-{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","id":2,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
-# CHECK: "error": {
-# CHECK-NEXT: "code": -32600
-# CHECK-NEXT: "message": "server already initialized"
-# CHECK-NEXT: },
-# CHECK-NEXT: "id": 2,
----
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
-
diff --git a/test/clangd/input-mirror.test b/test/clangd/input-mirror.test
deleted file mode 100644
index 52845621..00000000
--- a/test/clangd/input-mirror.test
+++ /dev/null
@@ -1,17 +0,0 @@
-# RUN: clangd -pretty -run-synchronously -input-mirror-file %t < %s
-# Note that we have to use '-b' as -input-mirror-file does not have a newline at the end of file.
-# RUN: diff -b %t %s
-# It is absolutely vital that this file has CRLF line endings.
-#
-Content-Length: 125
-
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
-Content-Length: 172
-
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"int main() {\nint a;\na;\n}\n"}}}
-Content-Length: 44
-
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
-Content-Length: 33
-
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/lit.local.cfg b/test/clangd/lit.local.cfg
deleted file mode 100644
index ef338c75..00000000
--- a/test/clangd/lit.local.cfg
+++ /dev/null
@@ -1,6 +0,0 @@
-import re
-# We rely on the default -std being derived from the filetype.
-# PS4 sets a different -std, and many tests break.
-# FIXME: make our tests less brittle instead.
-if re.match(r'.*-scei-ps4', config.target_triple):
- config.unsupported = True
diff --git a/test/clangd/protocol.test b/test/clangd/protocol.test
deleted file mode 100644
index c218763d..00000000
--- a/test/clangd/protocol.test
+++ /dev/null
@@ -1,110 +0,0 @@
-# RUN: not clangd -pretty -run-synchronously -enable-test-uri-scheme < %s | FileCheck -strict-whitespace %s
-# RUN: not clangd -pretty -run-synchronously -enable-test-uri-scheme < %s 2>&1 | FileCheck -check-prefix=STDERR %s
-# vim: fileformat=dos
-# It is absolutely vital that this file has CRLF line endings.
-#
-# Note that we invert the test because we intent to let clangd exit prematurely.
-#
-# Test protocol parsing
-Content-Length: 125
-Content-Type: application/vscode-jsonrpc; charset-utf-8
-
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
-# Test message with Content-Type after Content-Length
-#
-# CHECK: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": {
-# CHECK: }
-Content-Length: 246
-
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"struct fake { int a, bb, ccc; int f(int i, const float f) const; };\nint main() {\n fake f;\n f.\n}\n"}}}
-
-Content-Length: 104
-
-{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"test:///main.cpp"}}}
-
-Content-Type: application/vscode-jsonrpc; charset-utf-8
-Content-Length: 146
-
-{"jsonrpc":"2.0","id":1,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}}
-# Test message with Content-Type before Content-Length
-#
-# CHECK: "id": 1,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": {
-# CHECK-NEXT: "isIncomplete": false,
-# CHECK-NEXT: "items": [
-# CHECK: "filterText": "a",
-# CHECK-NEXT: "insertText": "a",
-# CHECK-NEXT: "insertTextFormat": 1,
-# CHECK-NEXT: "kind": 5,
-# CHECK-NEXT: "label": " a",
-# CHECK-NEXT: "sortText": "{{.*}}"
-# CHECK: ]
-# CHECK-NEXT: }
-
-X-Test: Testing
-Content-Type: application/vscode-jsonrpc; charset-utf-8
-Content-Length: 146
-Content-Type: application/vscode-jsonrpc; charset-utf-8
-X-Testing: Test
-
-{"jsonrpc":"2.0","id":2,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}}
-
-Content-Type: application/vscode-jsonrpc; charset-utf-8
-Content-Length: 10
-Content-Length: 146
-
-{"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}}
-# Test message with duplicate Content-Length headers
-#
-# CHECK: "id": 3,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": {
-# CHECK-NEXT: "isIncomplete": false,
-# CHECK-NEXT: "items": [
-# CHECK: "filterText": "a",
-# CHECK-NEXT: "insertText": "a",
-# CHECK-NEXT: "insertTextFormat": 1,
-# CHECK-NEXT: "kind": 5,
-# CHECK-NEXT: "label": " a",
-# CHECK-NEXT: "sortText": "{{.*}}"
-# CHECK: ]
-# CHECK-NEXT: }
-# STDERR: Warning: Duplicate Content-Length header received. The previous value for this message (10) was ignored.
-
-Content-Type: application/vscode-jsonrpc; charset-utf-8
-Content-Length: 10
-
-{"jsonrpc":"2.0","id":4,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}}
-# Test message with malformed Content-Length
-#
-# STDERR: JSON parse error
-# Ensure we recover by sending another (valid) message
-
-Content-Length: 146
-
-{"jsonrpc":"2.0","id":5,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}}
-# Test message with Content-Type before Content-Length
-#
-# CHECK: "id": 5,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": {
-# CHECK-NEXT: "isIncomplete": false,
-# CHECK-NEXT: "items": [
-# CHECK: "filterText": "a",
-# CHECK-NEXT: "insertText": "a",
-# CHECK-NEXT: "insertTextFormat": 1,
-# CHECK-NEXT: "kind": 5,
-# CHECK-NEXT: "label": " a",
-# CHECK-NEXT: "sortText": "{{.*}}"
-# CHECK: ]
-# CHECK-NEXT: }
-Content-Length: 1024
-
-{"jsonrpc":"2.0","id":5,"method":"textDocument/completion","params":{"textDocument":{"uri":"test:/main.cpp"},"position":{"line":3,"character":5}}}
-# Test message which reads beyond the end of the stream.
-#
-# Ensure this is the last test in the file!
-# STDERR: Input was aborted. Read only {{[0-9]+}} bytes of expected {{[0-9]+}}.
-
diff --git a/test/clangd/references.test b/test/clangd/references.test
deleted file mode 100644
index 964f5e7f..00000000
--- a/test/clangd/references.test
+++ /dev/null
@@ -1,40 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"int x; int y = x;"}}}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/references","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":0,"character":4}}}
-# CHECK: "id": 1
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 5,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 4,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "uri": "{{.*}}/main.cpp"
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 16,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 15,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "uri": "{{.*}}/main.cpp"
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
----
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/rename.test b/test/clangd/rename.test
deleted file mode 100644
index caf8b200..00000000
--- a/test/clangd/rename.test
+++ /dev/null
@@ -1,39 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.cpp","languageId":"cpp","version":1,"text":"int foo;"}}}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/rename","params":{"textDocument":{"uri":"test:///foo.cpp"},"position":{"line":0,"character":5},"newName":"bar"}}
-# CHECK: "id": 1,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": {
-# CHECK-NEXT: "changes": {
-# CHECK-NEXT: "file://{{.*}}/foo.cpp": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "newText": "bar",
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 7
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 4
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","id":2,"method":"textDocument/rename","params":{"textDocument":{"uri":"test:///foo.cpp"},"position":{"line":0,"character":2},"newName":"bar"}}
-# CHECK: "error": {
-# CHECK-NEXT: "code": -32001,
-# CHECK-NEXT: "message": "clang diagnostic"
-# CHECK-NEXT: },
-# CHECK-NEXT: "id": 2,
-# CHECK-NEXT: "jsonrpc": "2.0"
----
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/signature-help.test b/test/clangd/signature-help.test
deleted file mode 100644
index 37b8b500..00000000
--- a/test/clangd/signature-help.test
+++ /dev/null
@@ -1,27 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-# Start a session.
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"void x(int);\nint main(){\nx("}}}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/signatureHelp","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":2,"character":2}}}
-# CHECK: "id": 1,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": {
-# CHECK-NEXT: "activeParameter": 0,
-# CHECK-NEXT: "activeSignature": 0,
-# CHECK-NEXT: "signatures": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "label": "x(int) -> void",
-# CHECK-NEXT: "parameters": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "label": "int"
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: }
----
-{"jsonrpc":"2.0","id":100000,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/spaces-in-delimited-input.test b/test/clangd/spaces-in-delimited-input.test
deleted file mode 100644
index 9636425e..00000000
--- a/test/clangd/spaces-in-delimited-input.test
+++ /dev/null
@@ -1,13 +0,0 @@
-# RUN: clangd -input-style=delimited -run-synchronously < %s 2>&1 | FileCheck %s
-# RUN: clangd -lit-test -run-synchronously < %s 2>&1 | FileCheck %s
-#
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
-
----
-
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
-
----
-
-{"jsonrpc":"2.0","method":"exit"}
-# CHECK-NOT: JSON parse error
diff --git a/test/clangd/symbol-info.test b/test/clangd/symbol-info.test
deleted file mode 100644
index 65094a4b..00000000
--- a/test/clangd/symbol-info.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///simple.cpp","languageId":"cpp","version":1,"text":"void foo(); int main() { foo(); }\n"}}}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/symbolInfo","params":{"textDocument":{"uri":"test:///simple.cpp"},"position":{"line":0,"character":27}}}
-# CHECK: "containerName": null,
-# CHECK-NEXT: "id": "CA2EBE44A1D76D2A",
-# CHECK-NEXT: "name": "foo",
-# CHECK-NEXT: "usr": "c:@F@foo#"
----
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/symbols.test b/test/clangd/symbols.test
deleted file mode 100644
index a15d7028..00000000
--- a/test/clangd/symbols.test
+++ /dev/null
@@ -1,84 +0,0 @@
-# RUN: clangd --index-file=%S/Inputs/symbols.test.yaml -lit-test < %s | FileCheck %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{"workspace":{"symbol":{"symbolKind":{"valueSet": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}}}},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"void foo(); int main() { foo(); }\n"}}}
----
-{"jsonrpc":"2.0","id":1,"method":"workspace/symbol","params":{"query":"vector"}}
-# CHECK: "id": 1,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "containerName": "std",
-# CHECK-NEXT: "kind": 5,
-# CHECK-NEXT: "location": {
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": {{.*}},
-# CHECK-NEXT: "line": {{.*}}
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": {{.*}},
-# CHECK-NEXT: "line": {{.*}}
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "uri": "file:///vector.h"
-# CHECK-NEXT: },
-# CHECK-NEXT: "name": "vector"
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT:}
----
-{"jsonrpc":"2.0","id":2,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"test:///main.cpp"}}}
-# CHECK: "id": 2,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "containerName": "",
-# CHECK-NEXT: "kind": 12,
-# CHECK-NEXT: "location": {
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": {{.*}},
-# CHECK-NEXT: "line": {{.*}}
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": {{.*}},
-# CHECK-NEXT: "line": {{.*}}
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "uri": "file://{{.*}}/main.cpp"
-# CHECK-NEXT: },
-# CHECK-NEXT: "name": "foo"
-# CHECK-NEXT: }
-# CHECK-NEXT: {
-# CHECK-NEXT: "containerName": "",
-# CHECK-NEXT: "kind": 12,
-# CHECK-NEXT: "location": {
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": {{.*}},
-# CHECK-NEXT: "line": {{.*}}
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": {{.*}},
-# CHECK-NEXT: "line": {{.*}}
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "uri": "file://{{.*}}/main.cpp"
-# CHECK-NEXT: },
-# CHECK-NEXT: "name": "main"
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT:}
----
-{"jsonrpc":"2.0","id":3,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"test:///foo.cpp"}}}
-# CHECK: "error": {
-# CHECK-NEXT: "code": -32602,
-# CHECK-NEXT: "message": "trying to get AST for non-added document"
-# CHECK-NEXT: },
-# CHECK-NEXT: "id": 3,
-# CHECK-NEXT: "jsonrpc": "2.0"
----
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/test-uri-posix.test b/test/clangd/test-uri-posix.test
deleted file mode 100644
index 2b67fa03..00000000
--- a/test/clangd/test-uri-posix.test
+++ /dev/null
@@ -1,11 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-# UNSUPPORTED: windows-gnu,windows-msvc
-# Test authority-less URI
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","version":1,"text":"void main() {}"}}}
-# CHECK: "uri": "file:///clangd-test/foo.c"
----
-{"jsonrpc":"2.0","id":5,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/test-uri-windows.test b/test/clangd/test-uri-windows.test
deleted file mode 100644
index 381c48fa..00000000
--- a/test/clangd/test-uri-windows.test
+++ /dev/null
@@ -1,11 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-# REQUIRES: windows-gnu || windows-msvc
-# Test authority-less URI
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","version":1,"text":"void main() {}"}}}
-# CHECK: "uri": "file:///C:/clangd-test/foo.c"
----
-{"jsonrpc":"2.0","id":5,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/textdocument-didchange-fail.test b/test/clangd/textdocument-didchange-fail.test
deleted file mode 100644
index 33350c4a..00000000
--- a/test/clangd/textdocument-didchange-fail.test
+++ /dev/null
@@ -1,39 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-# RUN: clangd -lit-test -pch-storage=memory < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"int main() {}\n"}}}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/definition","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":0,"character":6}}}
-# CHECK: "id": 1,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 8,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 4,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "uri": "file://{{.*}}/clangd-test/main.cpp"
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
----
-{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"test:///main.cpp"},"contentChanges":[{"range":{"start":{"line":100,"character":0},"end":{"line":100,"character":0}},"text": "foo"}]}}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/definition","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":0,"character":6}}}
-# CHECK: "error": {
-# CHECK-NEXT: "code": -32602,
-# CHECK-NEXT: "message": "trying to get AST for non-added document"
-# CHECK-NEXT: },
-# CHECK-NEXT: "id": 1,
-# CHECK-NEXT: "jsonrpc": "2.0"
-# CHECK-NEXT:}
----
-{"jsonrpc":"2.0","id":4,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/too_large.test b/test/clangd/too_large.test
deleted file mode 100644
index 7b846c37..00000000
--- a/test/clangd/too_large.test
+++ /dev/null
@@ -1,7 +0,0 @@
-# RUN: not clangd -run-synchronously < %s 2>&1 | FileCheck -check-prefix=STDERR %s
-# vim: fileformat=dos
-# It is absolutely vital that this file has CRLF line endings.
-#
-Content-Length: 2147483648
-
-# STDERR: Refusing to read message
diff --git a/test/clangd/trace.test b/test/clangd/trace.test
deleted file mode 100644
index 83b040a5..00000000
--- a/test/clangd/trace.test
+++ /dev/null
@@ -1,25 +0,0 @@
-# RUN: env CLANGD_TRACE=%t clangd -lit-test < %s && FileCheck %s < %t
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.c","languageId":"c","version":1,"text":"void main() {}"}}}
-# These assertions are a bit loose, to avoid brittleness.
-# CHECK: {"displayTimeUnit":"ns","traceEvents":[
-# CHECK: {
-# CHECK: "args": {
-# CHECK: "File": "{{.*(/|\\)}}foo.c"
-# CHECK: },
-# CHECK: "name": "BuildPreamble",
-# CHECK: "ph": "X",
-# CHECK: }
-# CHECK: {
-# CHECK: "args": {
-# CHECK: "File": "{{.*(/|\\)}}foo.c"
-# CHECK: },
-# CHECK: "name": "BuildAST",
-# CHECK: "ph": "X",
-# CHECK: }
-# CHECK: },
----
-{"jsonrpc":"2.0","id":5,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/unsupported-method.test b/test/clangd/unsupported-method.test
deleted file mode 100644
index 9cdb12c3..00000000
--- a/test/clangd/unsupported-method.test
+++ /dev/null
@@ -1,16 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":""}}}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/jumpInTheAirLikeYouJustDontCare","params":{}}
-# CHECK: "error": {
-# CHECK-NEXT: "code": -32601,
-# CHECK-NEXT: "message": "method not found"
-# CHECK-NEXT: },
-# CHECK-NEXT: "id": 1,
-# CHECK-NEXT: "jsonrpc": "2.0"
----
-{"jsonrpc":"2.0","id":2,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/xpc/initialize.test b/test/clangd/xpc/initialize.test
deleted file mode 100644
index 44bef65b..00000000
--- a/test/clangd/xpc/initialize.test
+++ /dev/null
@@ -1,10 +0,0 @@
-# RUN: clangd-xpc-test-client < %s | FileCheck %s
-# REQUIRES: clangd-xpc-support
-
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootUri":"test:///workspace","capabilities":{},"trace":"off"}}
-# CHECK: {"id":0,"jsonrpc":"2.0","result":{"capabilities"
-
-{"jsonrpc":"2.0","id":3,"method":"shutdown"}
-# CHECK: {"id":3,"jsonrpc":"2.0","result":null}
-
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/clangd/xrefs.test b/test/clangd/xrefs.test
deleted file mode 100644
index 58ca44cb..00000000
--- a/test/clangd/xrefs.test
+++ /dev/null
@@ -1,59 +0,0 @@
-# RUN: clangd -lit-test < %s | FileCheck -strict-whitespace %s
-{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
----
-{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"int x = 0;\nint y = x;"}}}
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/definition","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":1,"character":8}}}
-# CHECK: "id": 1,
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 5,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 4,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: "uri": "file://{{.*}}/{{([A-Z]:/)?}}main.cpp"
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
----
-{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"test:///main.cpp"},"position":{"line":1,"character":8}}}
-# CHECK: "id": 1
-# CHECK-NEXT: "jsonrpc": "2.0",
-# CHECK-NEXT: "result": [
-# CHECK-NEXT: {
-# CHECK-NEXT: "kind": 1,
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 5,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 4,
-# CHECK-NEXT: "line": 0
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: },
-# CHECK-NEXT: {
-# CHECK-NEXT: "kind": 2,
-# CHECK-NEXT: "range": {
-# CHECK-NEXT: "end": {
-# CHECK-NEXT: "character": 9,
-# CHECK-NEXT: "line": 1
-# CHECK-NEXT: },
-# CHECK-NEXT: "start": {
-# CHECK-NEXT: "character": 8,
-# CHECK-NEXT: "line": 1
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
----
-{"jsonrpc":"2.0","id":10000,"method":"shutdown"}
----
-{"jsonrpc":"2.0","method":"exit"}
diff --git a/test/include-fixer/include_path.cpp b/test/include-fixer/include_path.cpp
deleted file mode 100644
index 28b6ace5..00000000
--- a/test/include-fixer/include_path.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// RUN: mkdir -p %T/include-fixer/include
-// RUN: mkdir -p %T/include-fixer/symbols
-// RUN: mkdir -p %T/include-fixer/build
-// RUN: mkdir -p %T/include-fixer/src
-// RUN: sed 's|test_dir|%/T/include-fixer|g' %S/Inputs/database_template.json > %T/include-fixer/build/compile_commands.json
-// RUN: echo -e '#include "bar.h"\nb::a::bar f;' > %T/include-fixer/src/bar.cpp
-// RUN: echo 'namespace b { namespace a { class bar {}; } }' > %T/include-fixer/include/bar.h
-// RUN: cd %T/include-fixer/build
-// RUN: find-all-symbols -output-dir=%T/include-fixer/symbols -p=. %T/include-fixer/src/bar.cpp
-// RUN: find-all-symbols -merge-dir=%T/include-fixer/symbols %T/include-fixer/build/find_all_symbols.yaml
-// RUN: FileCheck -input-file=%T/include-fixer/build/find_all_symbols.yaml -check-prefix=CHECK-YAML %s
-//
-// RUN: echo 'b::a::bar f;' > %T/include-fixer/src/bar.cpp
-// RUN: clang-include-fixer -db=yaml -input=%T/include-fixer/build/find_all_symbols.yaml -minimize-paths=true -p=. %T/include-fixer/src/bar.cpp
-// RUN: FileCheck -input-file=%T/include-fixer/src/bar.cpp %s
-
-// CHECK-YAML: ..{{[/\\]}}include{{[/\\]}}bar.h
-// CHECK: #include "bar.h"
-// CHECK: b::a::bar f;
diff --git a/test/include-fixer/multiple_fixes.cpp b/test/include-fixer/multiple_fixes.cpp
deleted file mode 100644
index 35a73b4a..00000000
--- a/test/include-fixer/multiple_fixes.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// REQUIRES: shell
-// RUN: sed -e 's#//.*$##' %s > %t.cpp
-// RUN: mkdir -p %T/include-fixer/multiple-fixes
-// RUN: echo 'foo f;' > %T/include-fixer/multiple-fixes/foo.cpp
-// RUN: echo 'bar b;' > %T/include-fixer/multiple-fixes/bar.cpp
-// RUN: clang-include-fixer -db=fixed -input='foo= "foo.h";bar= "bar.h"' %T/include-fixer/multiple-fixes/*.cpp --
-// RUN: FileCheck -input-file=%T/include-fixer/multiple-fixes/bar.cpp %s -check-prefix=CHECK-BAR
-// RUN: FileCheck -input-file=%T/include-fixer/multiple-fixes/foo.cpp %s -check-prefix=CHECK-FOO
-//
-// CHECK-FOO: #include "foo.h"
-// CHECK-FOO: foo f;
-// CHECK-BAR: #include "bar.h"
-// CHECK-BAR: bar b;
diff --git a/test/lit.cfg b/test/lit.cfg.py
index 7fe56f7f..eaf0778e 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg.py
@@ -99,11 +99,9 @@ config.environment['LD_LIBRARY_PATH'] = path
if lit_config.useValgrind:
config.target_triple += '-vg'
+config.available_features.add('crash-recovery')
# Set available features we allow tests to conditionalize on.
#
-# As of 2011.08, crash-recovery tests still do not pass on FreeBSD.
-if platform.system() not in ['FreeBSD']:
- config.available_features.add('crash-recovery')
# Shell execution
if execute_external:
@@ -117,10 +115,6 @@ if not platform.system() in ['Windows'] or not execute_external:
if platform.system() not in ['Windows']:
config.available_features.add('ansi-escape-sequences')
-# XPC support for Clangd.
-if config.clangd_xpc_support:
- config.available_features.add('clangd-xpc-support')
-
if config.clang_staticanalyzer:
config.available_features.add('static-analyzer')
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.py.in
index d71ca188..a970e7fa 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.py.in
@@ -11,7 +11,6 @@ config.clang_libs_dir = "@SHLIBDIR@"
config.python_executable = "@PYTHON_EXECUTABLE@"
config.target_triple = "@TARGET_TRIPLE@"
config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
-config.clangd_xpc_support = @CLANGD_BUILD_XPC_SUPPORT@
# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.
@@ -28,4 +27,4 @@ import lit.llvm
lit.llvm.initialize(lit_config, config)
# Let the main config do the real work.
-lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/lit.cfg")
+lit_config.load_config(config, "@CLANG_TOOLS_SOURCE_DIR@/test/lit.cfg.py")
diff --git a/test/modularize/ProblemsInconsistent.modularize b/test/modularize/ProblemsInconsistent.modularize
index 04d0b013..713bfe90 100644
--- a/test/modularize/ProblemsInconsistent.modularize
+++ b/test/modularize/ProblemsInconsistent.modularize
@@ -60,16 +60,6 @@ Inputs/InconsistentHeader2.h
# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentHeader2.h
# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h
# CHECK-NEXT: (no macro definition)
-# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h:11:2
-# CHECK-NEXT: #if SYMBOL == 1
-# CHECK-NEXT: ^
-# CHECK-NEXT: error: Conditional expression instance 'SYMBOL == 1' has different values in this header, depending on how it was included.
-# CHECK-NEXT: 'SYMBOL == 1' expanded to: 'true' with respect to these inclusion paths:
-# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentHeader1.h
-# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h
-# CHECK-NEXT: 'SYMBOL == 1' expanded to: 'false' with respect to these inclusion paths:
-# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentHeader2.h
-# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h
# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h:2:2
# CHECK-NEXT: #ifdef SYMBOL1
# CHECK-NEXT: ^
diff --git a/test/pp-trace/pp-trace-conditional.cpp b/test/pp-trace/pp-trace-conditional.cpp
index ac5d3b37..0ad6c593 100644
--- a/test/pp-trace/pp-trace-conditional.cpp
+++ b/test/pp-trace/pp-trace-conditional.cpp
@@ -1,4 +1,4 @@
-// RUN: pp-trace -ignore FileChanged %s -undef -target x86_64 -std=c++11 | FileCheck --strict-whitespace %s
+// RUN: pp-trace -callbacks '*,-FileChanged' %s -- -undef -target x86_64 -std=c++11 | FileCheck --strict-whitespace %s
#if 1
#endif
@@ -79,14 +79,14 @@
// CHECK-NEXT: MacroDirective: MD_Define
// CHECK: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:4:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:5"]
// CHECK-NEXT: ConditionValue: CVK_True
// CHECK-NEXT: - Callback: Endif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:4:2"
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:2"
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:7:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:5"]
// CHECK-NEXT: ConditionValue: CVK_False
// CHECK-NEXT: - Callback: Endif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:7:2"
@@ -95,7 +95,7 @@
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:7:2"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:10:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:5"]
// CHECK-NEXT: ConditionValue: CVK_True
// CHECK-NEXT: - Callback: Else
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:10:2"
@@ -107,7 +107,7 @@
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:10:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:11:2"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:14:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:5"]
// CHECK-NEXT: ConditionValue: CVK_False
// CHECK-NEXT: - Callback: Else
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:14:2"
@@ -119,11 +119,11 @@
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:2"
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:17:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:17:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:18:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:17:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:17:5"]
// CHECK-NEXT: ConditionValue: CVK_True
// CHECK-NEXT: - Callback: Elif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:18:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:18:6", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:19:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:18:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:18:8"]
// CHECK-NEXT: ConditionValue: CVK_NotEvaluated
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:17:2"
// CHECK-NEXT: - Callback: Endif
@@ -133,11 +133,11 @@
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:18:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:19:2"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:20:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:20:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:21:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:20:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:20:5"]
// CHECK-NEXT: ConditionValue: CVK_True
// CHECK-NEXT: - Callback: Elif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:21:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:21:6", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:22:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:21:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:21:8"]
// CHECK-NEXT: ConditionValue: CVK_NotEvaluated
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:20:2"
// CHECK-NEXT: - Callback: Endif
@@ -147,11 +147,11 @@
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:21:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:22:2"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:24:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:24:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:25:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:24:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:24:5"]
// CHECK-NEXT: ConditionValue: CVK_False
// CHECK-NEXT: - Callback: Elif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:25:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:25:6", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:26:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:25:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:25:7"]
// CHECK-NEXT: ConditionValue: CVK_True
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:24:2"
// CHECK-NEXT: - Callback: SourceRangeSkipped
@@ -161,11 +161,11 @@
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:24:2"
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:27:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:27:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:28:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:27:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:27:5"]
// CHECK-NEXT: ConditionValue: CVK_False
// CHECK-NEXT: - Callback: Elif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:28:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:28:6", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:29:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:28:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:28:7"]
// CHECK-NEXT: ConditionValue: CVK_False
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:27:2"
// CHECK-NEXT: - Callback: Endif
@@ -175,11 +175,11 @@
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:27:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:29:2"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:30:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:30:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:31:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:30:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:30:5"]
// CHECK-NEXT: ConditionValue: CVK_True
// CHECK-NEXT: - Callback: Elif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:31:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:31:6", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:32:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:31:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:31:8"]
// CHECK-NEXT: ConditionValue: CVK_NotEvaluated
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:30:2"
// CHECK-NEXT: - Callback: Endif
@@ -189,11 +189,11 @@
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:31:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:32:2"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:33:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:33:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:34:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:33:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:33:5"]
// CHECK-NEXT: ConditionValue: CVK_True
// CHECK-NEXT: - Callback: Elif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:34:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:34:6", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:35:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:34:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:34:8"]
// CHECK-NEXT: ConditionValue: CVK_NotEvaluated
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:33:2"
// CHECK-NEXT: - Callback: Endif
@@ -203,11 +203,11 @@
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:34:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:35:2"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:37:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:37:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:38:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:37:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:37:5"]
// CHECK-NEXT: ConditionValue: CVK_False
// CHECK-NEXT: - Callback: Elif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:38:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:38:6", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:39:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:38:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:38:7"]
// CHECK-NEXT: ConditionValue: CVK_True
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:37:2"
// CHECK-NEXT: - Callback: SourceRangeSkipped
@@ -222,11 +222,11 @@
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:39:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:40:2"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:42:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:5"]
// CHECK-NEXT: ConditionValue: CVK_False
// CHECK-NEXT: - Callback: Elif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:42:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:42:6", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:43:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:42:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:42:7"]
// CHECK-NEXT: ConditionValue: CVK_False
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:2"
// CHECK-NEXT: - Callback: Else
@@ -239,11 +239,11 @@
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:41:2"
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:45:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:45:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:46:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:45:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:45:5"]
// CHECK-NEXT: ConditionValue: CVK_True
// CHECK-NEXT: - Callback: Elif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:46:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:46:6", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:47:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:46:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:46:8"]
// CHECK-NEXT: ConditionValue: CVK_NotEvaluated
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:45:2"
// CHECK-NEXT: - Callback: Endif
@@ -253,11 +253,11 @@
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:46:1", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:48:2"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:49:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:49:4", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:50:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:49:5", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:49:5"]
// CHECK-NEXT: ConditionValue: CVK_True
// CHECK-NEXT: - Callback: Elif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:50:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:50:6", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:51:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:50:7", "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:50:8"]
// CHECK-NEXT: ConditionValue: CVK_NotEvaluated
// CHECK-NEXT: IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:49:2"
// CHECK-NEXT: - Callback: Endif
diff --git a/test/pp-trace/pp-trace-filter.cpp b/test/pp-trace/pp-trace-filter.cpp
new file mode 100644
index 00000000..1cd2ce7e
--- /dev/null
+++ b/test/pp-trace/pp-trace-filter.cpp
@@ -0,0 +1,17 @@
+// RUN: pp-trace -callbacks 'File*,Macro*,-MacroUndefined' %s -- | FileCheck %s
+// RUN: pp-trace -callbacks ' File* , Macro* , -MacroUndefined ' %s -- | FileCheck %s
+// RUN: not pp-trace -callbacks '[' %s -- 2>&1 | FileCheck --check-prefix=INVALID %s
+
+#define M 1
+int i = M;
+#undef M
+
+// CHECK: ---
+// CHECK: - Callback: FileChanged
+// CHECK: - Callback: MacroDefined
+// CHECK: - Callback: MacroExpands
+// CHECK-NOT: - Callback: MacroUndefined
+// CHECK-NOT: - Callback: EndOfMainFile
+// CHECK: ...
+
+// INVALID: error: invalid glob pattern: [
diff --git a/test/pp-trace/pp-trace-ident.cpp b/test/pp-trace/pp-trace-ident.cpp
index 9981c39e..cdd9fd38 100644
--- a/test/pp-trace/pp-trace-ident.cpp
+++ b/test/pp-trace/pp-trace-ident.cpp
@@ -1,4 +1,4 @@
-// RUN: pp-trace -ignore FileChanged,MacroDefined %s -undef -target x86_64 -std=c++11 | FileCheck --strict-whitespace %s
+// RUN: pp-trace -callbacks '*,-FileChanged,-MacroDefined' %s -- -undef -target x86_64 -std=c++11 | FileCheck --strict-whitespace %s
#ident "$Id$"
diff --git a/test/pp-trace/pp-trace-include.cpp b/test/pp-trace/pp-trace-include.cpp
index 7d925d84..ba6ad112 100644
--- a/test/pp-trace/pp-trace-include.cpp
+++ b/test/pp-trace/pp-trace-include.cpp
@@ -1,4 +1,4 @@
-// RUN: pp-trace %s -undef -target x86_64 -std=c++11 | FileCheck --strict-whitespace %s
+// RUN: pp-trace %s -- -undef -target x86_64 -std=c++11 | FileCheck --strict-whitespace %s
#include "Inputs/Level1A.h"
#include "Inputs/Level1B.h"
diff --git a/test/pp-trace/pp-trace-macro.cpp b/test/pp-trace/pp-trace-macro.cpp
index e6ba761d..47f9e1c4 100644
--- a/test/pp-trace/pp-trace-macro.cpp
+++ b/test/pp-trace/pp-trace-macro.cpp
@@ -1,4 +1,4 @@
-// RUN: pp-trace -ignore FileChanged %s -undef -target x86_64 -std=c++11 | FileCheck --strict-whitespace %s
+// RUN: pp-trace -callbacks '*,-FileChanged' %s -- -undef -target x86_64 -std=c++11 | FileCheck --strict-whitespace %s
#define MACRO 1
int i = MACRO;
@@ -44,7 +44,7 @@ X
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:19"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:4", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:6:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:5:19"]
// CHECK-NEXT: ConditionValue: CVK_True
// CHECK-NEXT: - Callback: Endif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:6:2"
@@ -58,7 +58,7 @@ X
// CHECK-NEXT: Range: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:19"]
// CHECK-NEXT: - Callback: If
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:2"
-// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:4", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:9:1"]
+// CHECK-NEXT: ConditionRange: ["{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:5", "{{.*}}{{[/\\]}}pp-trace-macro.cpp:8:19"]
// CHECK-NEXT: ConditionValue: CVK_False
// CHECK-NEXT: - Callback: Endif
// CHECK-NEXT: Loc: "{{.*}}{{[/\\]}}pp-trace-macro.cpp:9:2"
diff --git a/test/pp-trace/pp-trace-modules.cpp b/test/pp-trace/pp-trace-modules.cpp
index 5e9e1de3..32d6c48e 100644
--- a/test/pp-trace/pp-trace-modules.cpp
+++ b/test/pp-trace/pp-trace-modules.cpp
@@ -1,5 +1,5 @@
// RUN: rm -rf %t
-// RUN: pp-trace -ignore FileChanged,MacroDefined %s -x objective-c++ -undef -target x86_64 -std=c++11 -fmodules -fcxx-modules -fmodules-cache-path=%t -I%S -I%S/Input | FileCheck --strict-whitespace %s
+// RUN: pp-trace -callbacks '*,-FileChanged,-MacroDefined' %s -- -x objective-c++ -undef -target x86_64 -std=c++11 -fmodules -fcxx-modules -fmodules-cache-path=%t -I%S -I%S/Input | FileCheck --strict-whitespace %s
// CHECK: ---
diff --git a/test/pp-trace/pp-trace-pragma-general.cpp b/test/pp-trace/pp-trace-pragma-general.cpp
index 6caef0b6..f01ebd1e 100644
--- a/test/pp-trace/pp-trace-pragma-general.cpp
+++ b/test/pp-trace/pp-trace-pragma-general.cpp
@@ -1,4 +1,4 @@
-// RUN: pp-trace -ignore FileChanged,MacroDefined %s | FileCheck --strict-whitespace %s
+// RUN: pp-trace -callbacks '*,-FileChanged,-MacroDefined' %s -- | FileCheck --strict-whitespace %s
#pragma clang diagnostic push
#pragma clang diagnostic pop
diff --git a/test/pp-trace/pp-trace-pragma-ms.cpp b/test/pp-trace/pp-trace-pragma-ms.cpp
index 33c9f7fa..5df30ad8 100644
--- a/test/pp-trace/pp-trace-pragma-ms.cpp
+++ b/test/pp-trace/pp-trace-pragma-ms.cpp
@@ -1,4 +1,4 @@
-// RUN: pp-trace -ignore FileChanged,MacroDefined %s -target x86_64-unknown-windows-msvc -fms-extensions -w | FileCheck --strict-whitespace %s
+// RUN: pp-trace -callbacks '*,-FileChanged,-MacroDefined' %s -- -target x86_64-unknown-windows-msvc -fms-extensions -w | FileCheck --strict-whitespace %s
#pragma comment(compiler, "compiler comment")
#pragma comment(exestr, "exestr comment")
diff --git a/test/pp-trace/pp-trace-pragma-opencl.cpp b/test/pp-trace/pp-trace-pragma-opencl.cpp
index cfd72c0d..8ba26c3b 100644
--- a/test/pp-trace/pp-trace-pragma-opencl.cpp
+++ b/test/pp-trace/pp-trace-pragma-opencl.cpp
@@ -1,4 +1,4 @@
-// RUN: pp-trace -ignore FileChanged,MacroDefined %s -x cl | FileCheck --strict-whitespace %s
+// RUN: pp-trace -callbacks '*,-FileChanged,-MacroDefined' %s -- -x cl | FileCheck --strict-whitespace %s
#pragma OPENCL EXTENSION all : disable
#pragma OPENCL EXTENSION cl_khr_int64_base_atomics : disable