summaryrefslogtreecommitdiffstats
path: root/tools/clang-tidy
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /tools/clang-tidy
parentInitial commit. (diff)
downloadfirefox-esr-37a0381f8351b370577b65028ba1f6563ae23fdf.tar.xz
firefox-esr-37a0381f8351b370577b65028ba1f6563ae23fdf.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/clang-tidy')
-rw-r--r--tools/clang-tidy/config.yaml327
-rw-r--r--tools/clang-tidy/test/bugprone-argument-comment.cpp6
-rw-r--r--tools/clang-tidy/test/bugprone-argument-comment.json13
-rw-r--r--tools/clang-tidy/test/bugprone-assert-side-effect.cpp8
-rw-r--r--tools/clang-tidy/test/bugprone-assert-side-effect.json8
-rw-r--r--tools/clang-tidy/test/bugprone-bool-pointer-implicit-conversion.cpp20
-rw-r--r--tools/clang-tidy/test/bugprone-bool-pointer-implicit-conversion.json8
-rw-r--r--tools/clang-tidy/test/bugprone-forward-declaration-namespace.cpp3
-rw-r--r--tools/clang-tidy/test/bugprone-forward-declaration-namespace.json8
-rw-r--r--tools/clang-tidy/test/bugprone-incorrect-roundings.cpp7
-rw-r--r--tools/clang-tidy/test/bugprone-incorrect-roundings.json8
-rw-r--r--tools/clang-tidy/test/bugprone-integer-division.cpp5
-rw-r--r--tools/clang-tidy/test/bugprone-integer-division.json8
-rw-r--r--tools/clang-tidy/test/bugprone-macro-parentheses.cpp5
-rw-r--r--tools/clang-tidy/test/bugprone-macro-parentheses.json28
-rw-r--r--tools/clang-tidy/test/bugprone-macro-repeated-side-effects.cpp28
-rw-r--r--tools/clang-tidy/test/bugprone-macro-repeated-side-effects.json8
-rw-r--r--tools/clang-tidy/test/bugprone-misplaced-widening-cast.cpp3
-rw-r--r--tools/clang-tidy/test/bugprone-misplaced-widening-cast.json8
-rw-r--r--tools/clang-tidy/test/bugprone-move-forwarding-reference.cpp25
-rw-r--r--tools/clang-tidy/test/bugprone-move-forwarding-reference.json8
-rw-r--r--tools/clang-tidy/test/bugprone-multiple-statement-macro.cpp10
-rw-r--r--tools/clang-tidy/test/bugprone-multiple-statement-macro.json7
-rw-r--r--tools/clang-tidy/test/bugprone-sizeof-expression.cpp3
-rw-r--r--tools/clang-tidy/test/bugprone-sizeof-expression.json8
-rw-r--r--tools/clang-tidy/test/bugprone-string-constructor.cpp17
-rw-r--r--tools/clang-tidy/test/bugprone-string-constructor.json18
-rw-r--r--tools/clang-tidy/test/bugprone-string-integer-assignment.cpp28
-rw-r--r--tools/clang-tidy/test/bugprone-string-integer-assignment.json13
-rw-r--r--tools/clang-tidy/test/bugprone-suspicious-memset-usage.cpp22
-rw-r--r--tools/clang-tidy/test/bugprone-suspicious-memset-usage.json18
-rw-r--r--tools/clang-tidy/test/bugprone-suspicious-missing-comma.cpp9
-rw-r--r--tools/clang-tidy/test/bugprone-suspicious-missing-comma.json8
-rw-r--r--tools/clang-tidy/test/bugprone-suspicious-semicolon.cpp8
-rw-r--r--tools/clang-tidy/test/bugprone-suspicious-semicolon.json8
-rw-r--r--tools/clang-tidy/test/bugprone-suspicious-string-compare.cpp8
-rw-r--r--tools/clang-tidy/test/bugprone-suspicious-string-compare.json8
-rw-r--r--tools/clang-tidy/test/bugprone-swapped-arguments.cpp26
-rw-r--r--tools/clang-tidy/test/bugprone-swapped-arguments.json23
-rw-r--r--tools/clang-tidy/test/bugprone-too-small-loop-variable.cpp4
-rw-r--r--tools/clang-tidy/test/bugprone-too-small-loop-variable.json8
-rw-r--r--tools/clang-tidy/test/bugprone-unused-raii.cpp25
-rw-r--r--tools/clang-tidy/test/bugprone-unused-raii.json8
-rw-r--r--tools/clang-tidy/test/bugprone-use-after-move.cpp62
-rw-r--r--tools/clang-tidy/test/bugprone-use-after-move.json4
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.CallAndMessage.cpp10
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.CallAndMessage.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.DivideZero.cpp4
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.DivideZero.json4
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.NonNullParamChecker.cpp6
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.NonNullParamChecker.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.NullDereference.cpp9
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.NullDereference.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.UndefinedBinaryOperatorResult.cpp4
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.UndefinedBinaryOperatorResult.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.uninitialized.Assign.cpp4
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.uninitialized.Assign.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.uninitialized.Branch.cpp6
-rw-r--r--tools/clang-tidy/test/clang-analyzer-core.uninitialized.Branch.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-cplusplus.Move.cpp10
-rw-r--r--tools/clang-tidy/test/clang-analyzer-cplusplus.Move.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-cplusplus.NewDelete.cpp50
-rw-r--r--tools/clang-tidy/test/clang-analyzer-cplusplus.NewDelete.json23
-rw-r--r--tools/clang-tidy/test/clang-analyzer-cplusplus.NewDeleteLeaks.cpp6
-rw-r--r--tools/clang-tidy/test/clang-analyzer-cplusplus.NewDeleteLeaks.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-deadcode.DeadStores.cpp6
-rw-r--r--tools/clang-tidy/test/clang-analyzer-deadcode.DeadStores.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-optin.performance.Padding.cpp6
-rw-r--r--tools/clang-tidy/test/clang-analyzer-optin.performance.Padding.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.FloatLoopCounter.cpp3
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.FloatLoopCounter.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.UncheckedReturn.cpp5
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.UncheckedReturn.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.cpp5
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.cpp5
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.cpp5
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.getpw.cpp6
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.getpw.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.gets.cpp6
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.gets.json1
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mkstemp.cpp5
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mkstemp.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mktemp.cpp5
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mktemp.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.rand.cpp4
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.rand.json1
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.strcpy.cpp7
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.strcpy.json1
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.vfork.cpp5
-rw-r--r--tools/clang-tidy/test/clang-analyzer-security.insecureAPI.vfork.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-unix.Malloc.cpp37
-rw-r--r--tools/clang-tidy/test/clang-analyzer-unix.Malloc.json20
-rw-r--r--tools/clang-tidy/test/clang-analyzer-unix.cstring.BadSizeArg.cpp9
-rw-r--r--tools/clang-tidy/test/clang-analyzer-unix.cstring.BadSizeArg.json8
-rw-r--r--tools/clang-tidy/test/clang-analyzer-unix.cstring.NullArg.cpp14
-rw-r--r--tools/clang-tidy/test/clang-analyzer-unix.cstring.NullArg.json8
-rw-r--r--tools/clang-tidy/test/cppcoreguidelines-narrowing-conversions.cpp4
-rw-r--r--tools/clang-tidy/test/cppcoreguidelines-narrowing-conversions.json8
-rw-r--r--tools/clang-tidy/test/cppcoreguidelines-pro-type-member-init.cpp7
-rw-r--r--tools/clang-tidy/test/cppcoreguidelines-pro-type-member-init.json8
-rw-r--r--tools/clang-tidy/test/misc-non-copyable-objects.cpp5
-rw-r--r--tools/clang-tidy/test/misc-non-copyable-objects.json8
-rw-r--r--tools/clang-tidy/test/misc-redundant-expression.cpp3
-rw-r--r--tools/clang-tidy/test/misc-redundant-expression.json8
-rw-r--r--tools/clang-tidy/test/misc-unused-alias-decls.cpp18
-rw-r--r--tools/clang-tidy/test/misc-unused-alias-decls.json13
-rw-r--r--tools/clang-tidy/test/misc-unused-using-decls.cpp4
-rw-r--r--tools/clang-tidy/test/misc-unused-using-decls.json4
-rw-r--r--tools/clang-tidy/test/modernize-avoid-bind.cpp6
-rw-r--r--tools/clang-tidy/test/modernize-avoid-bind.json4
-rw-r--r--tools/clang-tidy/test/modernize-concat-nested-namespaces.cpp5
-rw-r--r--tools/clang-tidy/test/modernize-concat-nested-namespaces.json8
-rw-r--r--tools/clang-tidy/test/modernize-deprecated-ios-base-aliases.cpp18
-rw-r--r--tools/clang-tidy/test/modernize-deprecated-ios-base-aliases.json8
-rw-r--r--tools/clang-tidy/test/modernize-loop-convert.cpp7
-rw-r--r--tools/clang-tidy/test/modernize-loop-convert.json4
-rw-r--r--tools/clang-tidy/test/modernize-raw-string-literal.cpp1
-rw-r--r--tools/clang-tidy/test/modernize-raw-string-literal.json8
-rw-r--r--tools/clang-tidy/test/modernize-redundant-void-arg.cpp5
-rw-r--r--tools/clang-tidy/test/modernize-redundant-void-arg.json1
-rw-r--r--tools/clang-tidy/test/modernize-shrink-to-fit.cpp10
-rw-r--r--tools/clang-tidy/test/modernize-shrink-to-fit.json13
-rw-r--r--tools/clang-tidy/test/modernize-use-auto.cpp11
-rw-r--r--tools/clang-tidy/test/modernize-use-auto.json1
-rw-r--r--tools/clang-tidy/test/modernize-use-bool-literals.cpp5
-rw-r--r--tools/clang-tidy/test/modernize-use-bool-literals.json23
-rw-r--r--tools/clang-tidy/test/modernize-use-equals-default.cpp6
-rw-r--r--tools/clang-tidy/test/modernize-use-equals-default.json13
-rw-r--r--tools/clang-tidy/test/modernize-use-equals-delete.cpp7
-rw-r--r--tools/clang-tidy/test/modernize-use-equals-delete.json23
-rw-r--r--tools/clang-tidy/test/modernize-use-nullptr.cpp5
-rw-r--r--tools/clang-tidy/test/modernize-use-nullptr.json1
-rw-r--r--tools/clang-tidy/test/modernize-use-override.cpp8
-rw-r--r--tools/clang-tidy/test/modernize-use-override.json1
-rw-r--r--tools/clang-tidy/test/modernize-use-using.cpp5
-rw-r--r--tools/clang-tidy/test/modernize-use-using.json5
-rw-r--r--tools/clang-tidy/test/performance-faster-string-find.cpp6
-rw-r--r--tools/clang-tidy/test/performance-faster-string-find.json8
-rw-r--r--tools/clang-tidy/test/performance-for-range-copy.cpp30
-rw-r--r--tools/clang-tidy/test/performance-for-range-copy.json8
-rw-r--r--tools/clang-tidy/test/performance-implicit-conversion-in-loop.cpp43
-rw-r--r--tools/clang-tidy/test/performance-implicit-conversion-in-loop.json8
-rw-r--r--tools/clang-tidy/test/performance-inefficient-algorithm.cpp30
-rw-r--r--tools/clang-tidy/test/performance-inefficient-algorithm.json8
-rw-r--r--tools/clang-tidy/test/performance-inefficient-string-concatenation.cpp13
-rw-r--r--tools/clang-tidy/test/performance-inefficient-string-concatenation.json8
-rw-r--r--tools/clang-tidy/test/performance-inefficient-vector-operation.cpp10
-rw-r--r--tools/clang-tidy/test/performance-inefficient-vector-operation.json8
-rw-r--r--tools/clang-tidy/test/performance-move-const-arg.cpp33
-rw-r--r--tools/clang-tidy/test/performance-move-const-arg.json8
-rw-r--r--tools/clang-tidy/test/performance-move-constructor-init.cpp11
-rw-r--r--tools/clang-tidy/test/performance-move-constructor-init.json8
-rw-r--r--tools/clang-tidy/test/performance-noexcept-move-constructor.cpp4
-rw-r--r--tools/clang-tidy/test/performance-noexcept-move-constructor.json13
-rw-r--r--tools/clang-tidy/test/performance-type-promotion-in-math-fn.cpp7
-rw-r--r--tools/clang-tidy/test/performance-type-promotion-in-math-fn.json8
-rw-r--r--tools/clang-tidy/test/performance-unnecessary-copy-initialization.cpp7
-rw-r--r--tools/clang-tidy/test/performance-unnecessary-copy-initialization.json8
-rw-r--r--tools/clang-tidy/test/performance-unnecessary-value-param.cpp4
-rw-r--r--tools/clang-tidy/test/performance-unnecessary-value-param.json8
-rw-r--r--tools/clang-tidy/test/readability-braces-around-statements.cpp38
-rw-r--r--tools/clang-tidy/test/readability-braces-around-statements.json13
-rw-r--r--tools/clang-tidy/test/readability-const-return-type.cpp5
-rw-r--r--tools/clang-tidy/test/readability-const-return-type.json8
-rw-r--r--tools/clang-tidy/test/readability-container-size-empty.cpp7
-rw-r--r--tools/clang-tidy/test/readability-container-size-empty.json8
-rw-r--r--tools/clang-tidy/test/readability-delete-null-pointer.cpp6
-rw-r--r--tools/clang-tidy/test/readability-delete-null-pointer.json8
-rw-r--r--tools/clang-tidy/test/readability-else-after-return.cpp10
-rw-r--r--tools/clang-tidy/test/readability-else-after-return.json8
-rw-r--r--tools/clang-tidy/test/readability-implicit-bool-conversion.cpp55
-rw-r--r--tools/clang-tidy/test/readability-implicit-bool-conversion.json102
-rw-r--r--tools/clang-tidy/test/readability-inconsistent-declaration-parameter-name.cpp6
-rw-r--r--tools/clang-tidy/test/readability-inconsistent-declaration-parameter-name.json8
-rw-r--r--tools/clang-tidy/test/readability-isolate-declaration.cpp7
-rw-r--r--tools/clang-tidy/test/readability-isolate-declaration.json8
-rw-r--r--tools/clang-tidy/test/readability-magic-numbers.cpp4
-rw-r--r--tools/clang-tidy/test/readability-magic-numbers.json8
-rw-r--r--tools/clang-tidy/test/readability-misleading-indentation.cpp20
-rw-r--r--tools/clang-tidy/test/readability-misleading-indentation.json8
-rw-r--r--tools/clang-tidy/test/readability-non-const-parameter.cpp5
-rw-r--r--tools/clang-tidy/test/readability-non-const-parameter.json8
-rw-r--r--tools/clang-tidy/test/readability-qualified-auto.cpp6
-rw-r--r--tools/clang-tidy/test/readability-qualified-auto.json8
-rw-r--r--tools/clang-tidy/test/readability-redundant-control-flow.cpp5
-rw-r--r--tools/clang-tidy/test/readability-redundant-control-flow.json8
-rw-r--r--tools/clang-tidy/test/readability-redundant-preprocessor.cpp5
-rw-r--r--tools/clang-tidy/test/readability-redundant-preprocessor.json8
-rw-r--r--tools/clang-tidy/test/readability-redundant-smartptr-get.cpp19
-rw-r--r--tools/clang-tidy/test/readability-redundant-smartptr-get.json8
-rw-r--r--tools/clang-tidy/test/readability-redundant-string-cstr.cpp7
-rw-r--r--tools/clang-tidy/test/readability-redundant-string-cstr.json4
-rw-r--r--tools/clang-tidy/test/readability-redundant-string-init.cpp5
-rw-r--r--tools/clang-tidy/test/readability-redundant-string-init.json8
-rw-r--r--tools/clang-tidy/test/readability-simplify-boolean-expr.cpp2
-rw-r--r--tools/clang-tidy/test/readability-simplify-boolean-expr.json8
-rw-r--r--tools/clang-tidy/test/readability-static-accessed-through-instance.cpp11
-rw-r--r--tools/clang-tidy/test/readability-static-accessed-through-instance.json8
-rw-r--r--tools/clang-tidy/test/readability-uniqueptr-delete-release.cpp6
-rw-r--r--tools/clang-tidy/test/readability-uniqueptr-delete-release.json8
-rw-r--r--tools/clang-tidy/test/structures.h108
204 files changed, 2548 insertions, 0 deletions
diff --git a/tools/clang-tidy/config.yaml b/tools/clang-tidy/config.yaml
new file mode 100644
index 0000000000..36053d7870
--- /dev/null
+++ b/tools/clang-tidy/config.yaml
@@ -0,0 +1,327 @@
+---
+target: obj-x86_64-pc-linux-gnu
+# It is used by 'mach static-analysis' and 'phabricator static-analysis bot'
+# in order to have consistency across the used checkers.
+# All the clang checks used by the static-analysis tools.
+#
+# To add a new checker:
+# 1. Add it in this file
+# 2. Create a C/C++ test case in tools/clang-tidy/test/ reproducing the
+# warning/error that the checker will detect
+# 3. Run './mach static-analysis autotest -d' to create the reference
+# 4. Check the json file in tools/clang-tidy/test/
+# 5. Commit this file + the .cpp test case + the json result
+platforms:
+ - linux64
+ - macosx64
+ - win32
+ - win64
+# Minimum clang-tidy version that is required for all the following checkers
+# to work properly.
+# This is also used by 'mach clang-format'
+package_version: "16.0.4"
+clang_checkers:
+ - name: -*
+ publish: !!bool no
+ - name: bugprone-argument-comment
+ reliability: high
+ - name: bugprone-assert-side-effect
+ reliability: high
+ - name: bugprone-bool-pointer-implicit-conversion
+ reliability: low
+ - name: bugprone-forward-declaration-namespace
+ reliability: high
+ - name: bugprone-incorrect-roundings
+ reliability: high
+ - name: bugprone-integer-division
+ reliability: high
+ - name: bugprone-macro-parentheses
+ reliability: medium
+ - name: bugprone-macro-repeated-side-effects
+ reliability: high
+ - name: bugprone-misplaced-widening-cast
+ reliability: high
+ - name: bugprone-move-forwarding-reference
+ reliability: high
+ - name: bugprone-multiple-statement-macro
+ # Incompatible with our code base, see bug 1496379.
+ publish: !!bool no
+ reliability: high
+ - name: bugprone-sizeof-expression
+ reliability: high
+ - name: bugprone-string-constructor
+ reliability: high
+ - name: bugprone-string-integer-assignment
+ reliability: high
+ - name: bugprone-suspicious-memset-usage
+ reliability: high
+ - name: bugprone-suspicious-missing-comma
+ reliability: high
+ - name: bugprone-suspicious-semicolon
+ reliability: high
+ - name: bugprone-suspicious-string-compare
+ reliability: high
+ - name: bugprone-swapped-arguments
+ reliability: high
+ - name: bugprone-too-small-loop-variable
+ reliability: high
+ - name: bugprone-unused-raii
+ reliability: high
+ - name: bugprone-use-after-move
+ reliability: high
+ - name: clang-analyzer-core.CallAndMessage
+ reliability: medium
+ - name: clang-analyzer-core.DivideZero
+ reliability: high
+ - name: clang-analyzer-core.NonNullParamChecker
+ reliability: high
+ - name: clang-analyzer-core.NullDereference
+ reliability: medium
+ - name: clang-analyzer-core.UndefinedBinaryOperatorResult
+ reliability: medium
+ - name: clang-analyzer-core.uninitialized.Assign
+ reliability: medium
+ - name: clang-analyzer-core.uninitialized.Branch
+ reliability: medium
+ - name: clang-analyzer-cplusplus.Move
+ reliability: high
+ - name: clang-analyzer-cplusplus.NewDelete
+ reliability: medium
+ - name: clang-analyzer-cplusplus.NewDeleteLeaks
+ reliability: medium
+ - name: clang-analyzer-deadcode.DeadStores
+ reliability: high
+ - name: clang-analyzer-optin.performance.Padding
+ reliability: high
+ config:
+ - key: AllowedPad
+ value: 2
+ - name: clang-analyzer-security.FloatLoopCounter
+ reliability: high
+ - name: clang-analyzer-security.insecureAPI.bcmp
+ reliability: high
+ - name: clang-analyzer-security.insecureAPI.bcopy
+ reliability: high
+ - name: clang-analyzer-security.insecureAPI.bzero
+ reliability: high
+ - name: clang-analyzer-security.insecureAPI.getpw
+ reliability: high
+ # We don't add clang-analyzer-security.insecureAPI.gets here; it's deprecated.
+ - name: clang-analyzer-security.insecureAPI.mkstemp
+ reliability: high
+ - name: clang-analyzer-security.insecureAPI.mktemp
+ reliability: high
+ - name: clang-analyzer-security.insecureAPI.rand
+ reliability: low
+ # C checker, that is outdated and doesn't check for the new std::rand calls.
+ publish: !!bool no
+ - name: clang-analyzer-security.insecureAPI.strcpy
+ reliability: low
+ # The functions that should be used differ on POSIX and Windows, and there
+ # isn't a consensus on how we should approach this.
+ publish: !!bool no
+ - name: clang-analyzer-security.insecureAPI.UncheckedReturn
+ reliability: low
+ - name: clang-analyzer-security.insecureAPI.vfork
+ reliability: medium
+ - name: clang-analyzer-unix.Malloc
+ reliability: high
+ - name: clang-analyzer-unix.cstring.BadSizeArg
+ reliability: high
+ - name: clang-analyzer-unix.cstring.NullArg
+ reliability: high
+ - name: cppcoreguidelines-narrowing-conversions
+ reliability: high
+ - name: cppcoreguidelines-pro-type-member-init
+ reliability: medium
+ - name: misc-non-copyable-objects
+ reliability: high
+ - name: misc-redundant-expression
+ reliability: medium
+ - name: misc-unused-alias-decls
+ reliability: high
+ - name: misc-unused-using-decls
+ reliability: high
+ - name: modernize-avoid-bind
+ restricted-platforms:
+ - win32
+ - win64
+ reliability: medium
+ - name: modernize-concat-nested-namespaces
+ reliability: high
+ - name: modernize-deprecated-ios-base-aliases
+ reliability: high
+ - name: modernize-loop-convert
+ reliability: high
+ - name: modernize-raw-string-literal
+ reliability: high
+ - name: modernize-redundant-void-arg
+ reliability: high
+ # We still have some old C code that is built with a C compiler, so this
+ # might break the build.
+ publish: !!bool no
+ - name: modernize-shrink-to-fit
+ reliability: high
+ - name: modernize-use-auto
+ reliability: high
+ # Controversial, see bug 1371052.
+ publish: !!bool no
+ - name: modernize-use-bool-literals
+ reliability: high
+ - name: modernize-use-equals-default
+ reliability: high
+ - name: modernize-use-equals-delete
+ reliability: high
+ - name: modernize-use-nullptr
+ reliability: high
+ - name: modernize-use-override
+ reliability: low
+ # Too noisy because of the way how we implement NS_IMETHOD. See Bug 1420366.
+ publish: !!bool no
+ - name: modernize-use-using
+ reliability: high
+ - name: mozilla-*
+ reliability: high
+ - name: performance-faster-string-find
+ reliability: high
+ - name: performance-for-range-copy
+ reliability: high
+ - name: performance-implicit-conversion-in-loop
+ reliability: high
+ - name: performance-inefficient-algorithm
+ restricted-platforms:
+ - linux64
+ - macosx64
+ reliability: high
+ # Disable as the test does not support C++17 yet
+ publish: !!bool no
+ - name: performance-inefficient-string-concatenation
+ reliability: high
+ - name: performance-inefficient-vector-operation
+ reliability: high
+ - name: performance-move-const-arg
+ reliability: high
+ config:
+ - key: CheckTriviallyCopyableMove
+ # As per Bug 1558359 - disable detection of trivially copyable types
+ # that do not have a move constructor.
+ value: 0
+ - name: performance-move-constructor-init
+ reliability: high
+ - name: performance-noexcept-move-constructor
+ reliability: high
+ - name: performance-type-promotion-in-math-fn
+ reliability: high
+ - name: performance-unnecessary-copy-initialization
+ reliability: high
+ - name: performance-unnecessary-value-param
+ reliability: high
+ - name: readability-braces-around-statements
+ reliability: high
+ config:
+ - key: ShortStatementLines
+ # Allow `if (foo) return;` without braces
+ # Still warns on `if (foo)\n return;`
+ value: 1
+ - name: readability-const-return-type
+ reliability: high
+ # Note: this can be loosened up by using the ShortStatementLines option
+ - name: readability-container-size-empty
+ reliability: high
+ - name: readability-delete-null-pointer
+ reliability: high
+ - name: readability-else-after-return
+ reliability: high
+ config:
+ - key: WarnOnConditionVariables
+ # Disable as we don't mind this kind of behavior
+ value: 0
+ - name: readability-implicit-bool-conversion
+ reliability: low
+ # On automation the config flags act strange. Please see Bug 1500241.
+ publish: !!bool no
+ config:
+ - key: AllowIntegerConditions
+ # The check will allow conditional integer conversions.
+ value: 1
+ - key: AllowPointerConditions
+ # The check will allow conditional pointer conversions.
+ value: 1
+ - name: readability-inconsistent-declaration-parameter-name
+ reliability: high
+ - name: readability-isolate-declaration
+ # As per bug 1558987 - we don't want to have this enabled
+ publish: !!bool no
+ reliability: high
+ - name: readability-magic-numbers
+ # Bug 1553495 - we must see first its impact on our code.
+ publish: !!bool no
+ reliability: high
+ - name: readability-misleading-indentation
+ reliability: high
+ - name: readability-non-const-parameter
+ reliability: high
+ - name: readability-qualified-auto
+ reliability: high
+ - name: readability-redundant-control-flow
+ reliability: high
+ - name: readability-redundant-preprocessor
+ reliability: high
+ - name: readability-redundant-smartptr-get
+ reliability: high
+ - name: readability-redundant-string-cstr
+ reliability: high
+ - name: readability-redundant-string-init
+ reliability: high
+ - name: readability-static-accessed-through-instance
+ reliability: high
+ - name: readability-simplify-boolean-expr
+ reliability: high
+ config:
+ - key: SimplifyDeMorgan
+ # Don't want to enable DeMorgan expressions because of MOZ_ASSERT()
+ # See Bug 1804160
+ value: 0
+ - name: readability-uniqueptr-delete-release
+ reliability: high
+ # We don't publish the google checkers since we are interested in only having
+ # a general idea how our code complies with the rules added by these checkers.
+ - name: google-build-explicit-make-pair
+ reliability: low
+ publish: !!bool no
+ - name: google-build-namespaces
+ reliability: low
+ publish: !!bool no
+ - name: google-build-using-namespace
+ reliability: low
+ publish: !!bool no
+ - name: google-default-arguments
+ reliability: low
+ publish: !!bool no
+ - name: google-explicit-constructor
+ reliability: low
+ publish: !!bool no
+ - name: google-global-names-in-headers
+ reliability: low
+ publish: !!bool no
+ - name: google-readability-casting
+ reliability: low
+ publish: !!bool no
+ - name: google-readability-function-size
+ reliability: low
+ publish: !!bool no
+ - name: google-readability-namespace-comments
+ reliability: low
+ publish: !!bool no
+ - name: google-readability-todo
+ reliability: low
+ publish: !!bool no
+ - name: google-runtime-int
+ reliability: low
+ publish: !!bool no
+ - name: google-runtime-operator
+ reliability: low
+ publish: !!bool no
+ - name: google-runtime-references
+ reliability: low
+ publish: !!bool no
diff --git a/tools/clang-tidy/test/bugprone-argument-comment.cpp b/tools/clang-tidy/test/bugprone-argument-comment.cpp
new file mode 100644
index 0000000000..3099575a35
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-argument-comment.cpp
@@ -0,0 +1,6 @@
+// bugprone-argument-comment
+
+void f(int x, int y);
+void g() {
+ f(/*y=*/0, /*z=*/0);
+}
diff --git a/tools/clang-tidy/test/bugprone-argument-comment.json b/tools/clang-tidy/test/bugprone-argument-comment.json
new file mode 100644
index 0000000000..034f6dbf87
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-argument-comment.json
@@ -0,0 +1,13 @@
+[
+ [
+ "warning",
+ "argument name 'y' in comment does not match parameter name 'x'",
+ "bugprone-argument-comment"
+ ],
+ [
+ "warning",
+ "argument name 'z' in comment does not match parameter name 'y'",
+ "bugprone-argument-comment"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-assert-side-effect.cpp b/tools/clang-tidy/test/bugprone-assert-side-effect.cpp
new file mode 100644
index 0000000000..7cc0a79cf1
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-assert-side-effect.cpp
@@ -0,0 +1,8 @@
+#include "structures.h"
+
+// bugprone-assert-side-effect
+void misc_assert_side_effect() {
+ int X = 0;
+ assert(X == 1);
+ assert(X = 1);
+}
diff --git a/tools/clang-tidy/test/bugprone-assert-side-effect.json b/tools/clang-tidy/test/bugprone-assert-side-effect.json
new file mode 100644
index 0000000000..b17a456064
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-assert-side-effect.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "side effect in assert() condition discarded in release builds",
+ "bugprone-assert-side-effect"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-bool-pointer-implicit-conversion.cpp b/tools/clang-tidy/test/bugprone-bool-pointer-implicit-conversion.cpp
new file mode 100644
index 0000000000..602fa9a578
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-bool-pointer-implicit-conversion.cpp
@@ -0,0 +1,20 @@
+// https://clang.llvm.org/extra/clang-tidy/checks/bugprone-bool-pointer-implicit-conversion.html
+
+bool test(bool* pointer_to_bool, int* pointer_to_int)
+{
+ if (pointer_to_bool) { // warning for pointer to bool
+ }
+
+ if (pointer_to_int) { // no warning for pointer to int
+ }
+
+ if (!pointer_to_bool) { // no warning, but why not??
+ }
+
+ if (pointer_to_bool != nullptr) { // no warning for nullptr comparison
+ }
+
+ // no warning on return, but why not??
+ // clang-tidy bug: https://bugs.llvm.org/show_bug.cgi?id=38060
+ return pointer_to_bool;
+}
diff --git a/tools/clang-tidy/test/bugprone-bool-pointer-implicit-conversion.json b/tools/clang-tidy/test/bugprone-bool-pointer-implicit-conversion.json
new file mode 100644
index 0000000000..e4d64ee683
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-bool-pointer-implicit-conversion.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "dubious check of 'bool *' against 'nullptr', did you mean to dereference it?",
+ "bugprone-bool-pointer-implicit-conversion"
+ ],
+ { "reliability": "low" }
+]
diff --git a/tools/clang-tidy/test/bugprone-forward-declaration-namespace.cpp b/tools/clang-tidy/test/bugprone-forward-declaration-namespace.cpp
new file mode 100644
index 0000000000..f93d54b0a1
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-forward-declaration-namespace.cpp
@@ -0,0 +1,3 @@
+namespace na { struct A; }
+namespace nb { struct A {}; }
+nb::A a;
diff --git a/tools/clang-tidy/test/bugprone-forward-declaration-namespace.json b/tools/clang-tidy/test/bugprone-forward-declaration-namespace.json
new file mode 100644
index 0000000000..aee1ec88e5
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-forward-declaration-namespace.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "no definition found for 'A', but a definition with the same name 'A' found in another namespace 'nb'",
+ "bugprone-forward-declaration-namespace"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-incorrect-roundings.cpp b/tools/clang-tidy/test/bugprone-incorrect-roundings.cpp
new file mode 100644
index 0000000000..ee37b56ae0
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-incorrect-roundings.cpp
@@ -0,0 +1,7 @@
+void f1()
+{
+ double d;
+ int x;
+
+ x = (d + 0.5);
+}
diff --git a/tools/clang-tidy/test/bugprone-incorrect-roundings.json b/tools/clang-tidy/test/bugprone-incorrect-roundings.json
new file mode 100644
index 0000000000..f8da228b16
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-incorrect-roundings.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "casting (double + 0.5) to integer leads to incorrect rounding; consider using lround (#include <cmath>) instead",
+ "bugprone-incorrect-roundings"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-integer-division.cpp b/tools/clang-tidy/test/bugprone-integer-division.cpp
new file mode 100644
index 0000000000..058edffe39
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-integer-division.cpp
@@ -0,0 +1,5 @@
+float f() {
+ int a = 2;
+ int b = 10;
+ return a/b;
+}
diff --git a/tools/clang-tidy/test/bugprone-integer-division.json b/tools/clang-tidy/test/bugprone-integer-division.json
new file mode 100644
index 0000000000..95c43fc8e0
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-integer-division.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "result of integer division used in a floating point context; possible loss of precision",
+ "bugprone-integer-division"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-macro-parentheses.cpp b/tools/clang-tidy/test/bugprone-macro-parentheses.cpp
new file mode 100644
index 0000000000..53c22090a1
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-macro-parentheses.cpp
@@ -0,0 +1,5 @@
+#define BAD1 -1
+#define BAD2 1+2
+#define BAD3(A) (A+1)
+#define BAD4(x) ((unsigned char)(x & 0xff))
+#define BAD5(X) A*B=(C*)X+2
diff --git a/tools/clang-tidy/test/bugprone-macro-parentheses.json b/tools/clang-tidy/test/bugprone-macro-parentheses.json
new file mode 100644
index 0000000000..c50bf76cbd
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-macro-parentheses.json
@@ -0,0 +1,28 @@
+[
+ [
+ "warning",
+ "macro replacement list should be enclosed in parentheses",
+ "bugprone-macro-parentheses"
+ ],
+ [
+ "warning",
+ "macro replacement list should be enclosed in parentheses",
+ "bugprone-macro-parentheses"
+ ],
+ [
+ "warning",
+ "macro argument should be enclosed in parentheses",
+ "bugprone-macro-parentheses"
+ ],
+ [
+ "warning",
+ "macro argument should be enclosed in parentheses",
+ "bugprone-macro-parentheses"
+ ],
+ [
+ "warning",
+ "macro argument should be enclosed in parentheses",
+ "bugprone-macro-parentheses"
+ ],
+ { "reliability": "medium" }
+]
diff --git a/tools/clang-tidy/test/bugprone-macro-repeated-side-effects.cpp b/tools/clang-tidy/test/bugprone-macro-repeated-side-effects.cpp
new file mode 100644
index 0000000000..2dedb3aca9
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-macro-repeated-side-effects.cpp
@@ -0,0 +1,28 @@
+// https://clang.llvm.org/extra/clang-tidy/checks/bugprone-macro-repeated-side-effects.html
+
+#define MACRO_WITHOUT_REPEATED_ARG(x) (x)
+#define MACRO_WITH_REPEATED_ARG(x) ((x) + (x))
+
+static int g;
+
+int function_with_side_effects(int i)
+{
+ g += i;
+ return g;
+}
+
+void test()
+{
+ int i;
+ i = MACRO_WITHOUT_REPEATED_ARG(1); // OK
+ i = MACRO_WITH_REPEATED_ARG(1); // OK
+
+ i = MACRO_WITHOUT_REPEATED_ARG(i); // OK
+ i = MACRO_WITH_REPEATED_ARG(i); // OK
+
+ i = MACRO_WITHOUT_REPEATED_ARG(function_with_side_effects(i)); // OK
+ i = MACRO_WITH_REPEATED_ARG(function_with_side_effects(i)); // NO WARNING
+
+ i = MACRO_WITHOUT_REPEATED_ARG(i++); // OK
+ i = MACRO_WITH_REPEATED_ARG(i++); // WARNING
+}
diff --git a/tools/clang-tidy/test/bugprone-macro-repeated-side-effects.json b/tools/clang-tidy/test/bugprone-macro-repeated-side-effects.json
new file mode 100644
index 0000000000..236120ae05
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-macro-repeated-side-effects.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "side effects in the 1st macro argument 'x' are repeated in macro expansion",
+ "bugprone-macro-repeated-side-effects"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-misplaced-widening-cast.cpp b/tools/clang-tidy/test/bugprone-misplaced-widening-cast.cpp
new file mode 100644
index 0000000000..e75541bf6e
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-misplaced-widening-cast.cpp
@@ -0,0 +1,3 @@
+long f(int x) {
+ return (long)(x * 1000);
+}
diff --git a/tools/clang-tidy/test/bugprone-misplaced-widening-cast.json b/tools/clang-tidy/test/bugprone-misplaced-widening-cast.json
new file mode 100644
index 0000000000..bd0d9f2c00
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-misplaced-widening-cast.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "either cast from 'int' to 'long' is ineffective, or there is loss of precision before the conversion",
+ "bugprone-misplaced-widening-cast"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-move-forwarding-reference.cpp b/tools/clang-tidy/test/bugprone-move-forwarding-reference.cpp
new file mode 100644
index 0000000000..45be15ee65
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-move-forwarding-reference.cpp
@@ -0,0 +1,25 @@
+
+namespace std {
+template <typename> struct remove_reference;
+
+template <typename _Tp> struct remove_reference { typedef _Tp type; };
+
+template <typename _Tp> struct remove_reference<_Tp &> { typedef _Tp type; };
+
+template <typename _Tp> struct remove_reference<_Tp &&> { typedef _Tp type; };
+
+template <typename _Tp>
+constexpr typename std::remove_reference<_Tp>::type &&move(_Tp &&__t);
+
+} // namespace std
+
+// Standard case.
+template <typename T, typename U> void f1(U &&SomeU) {
+ T SomeT(std::move(SomeU));
+ // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: forwarding reference passed to
+ // CHECK-FIXES: T SomeT(std::forward<U>(SomeU));
+}
+
+void foo() {
+ f1<int, int>(2);
+}
diff --git a/tools/clang-tidy/test/bugprone-move-forwarding-reference.json b/tools/clang-tidy/test/bugprone-move-forwarding-reference.json
new file mode 100644
index 0000000000..43166e4af1
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-move-forwarding-reference.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "forwarding reference passed to std::move(), which may unexpectedly cause lvalues to be moved; use std::forward() instead",
+ "bugprone-move-forwarding-reference"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-multiple-statement-macro.cpp b/tools/clang-tidy/test/bugprone-multiple-statement-macro.cpp
new file mode 100644
index 0000000000..7ad2a2df64
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-multiple-statement-macro.cpp
@@ -0,0 +1,10 @@
+void F();
+
+#define BAD_MACRO(x) \
+ F(); \
+ F()
+
+void positives() {
+ if (1)
+ BAD_MACRO(1);
+}
diff --git a/tools/clang-tidy/test/bugprone-multiple-statement-macro.json b/tools/clang-tidy/test/bugprone-multiple-statement-macro.json
new file mode 100644
index 0000000000..81c3dc89e5
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-multiple-statement-macro.json
@@ -0,0 +1,7 @@
+[
+ [
+ "warning",
+ "multiple statement macro used without braces; some statements will be unconditionally executed",
+ "bugprone-multiple-statement-macro"
+ ]
+]
diff --git a/tools/clang-tidy/test/bugprone-sizeof-expression.cpp b/tools/clang-tidy/test/bugprone-sizeof-expression.cpp
new file mode 100644
index 0000000000..f5f1f469ce
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-sizeof-expression.cpp
@@ -0,0 +1,3 @@
+class C {
+ int size() { return sizeof(this); }
+};
diff --git a/tools/clang-tidy/test/bugprone-sizeof-expression.json b/tools/clang-tidy/test/bugprone-sizeof-expression.json
new file mode 100644
index 0000000000..438194296b
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-sizeof-expression.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "suspicious usage of 'sizeof(this)'; did you mean 'sizeof(*this)'",
+ "bugprone-sizeof-expression"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-string-constructor.cpp b/tools/clang-tidy/test/bugprone-string-constructor.cpp
new file mode 100644
index 0000000000..8b6a4980a3
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-string-constructor.cpp
@@ -0,0 +1,17 @@
+// https://clang.llvm.org/extra/clang-tidy/checks/bugprone-string-constructor.html
+
+#include "structures.h"
+
+void test()
+{
+ // A common mistake is to swap parameters to the ‘fill’ string-constructor.
+ std::string str('x', 50); // should be str(50, 'x')
+
+ // Calling the string-literal constructor with a length bigger than the
+ // literal is suspicious and adds extra random characters to the string.
+ std::string("test", 200); // Will include random characters after "test".
+
+ // Creating an empty string from constructors with parameters is considered
+ // suspicious. The programmer should use the empty constructor instead.
+ std::string("test", 0); // Creation of an empty string.
+}
diff --git a/tools/clang-tidy/test/bugprone-string-constructor.json b/tools/clang-tidy/test/bugprone-string-constructor.json
new file mode 100644
index 0000000000..7e2ba1764f
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-string-constructor.json
@@ -0,0 +1,18 @@
+[
+ [
+ "warning",
+ "string constructor parameters are probably swapped; expecting string(count, character)",
+ "bugprone-string-constructor"
+ ],
+ [
+ "warning",
+ "length is bigger than string literal size",
+ "bugprone-string-constructor"
+ ],
+ [
+ "warning",
+ "constructor creating an empty string",
+ "bugprone-string-constructor"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-string-integer-assignment.cpp b/tools/clang-tidy/test/bugprone-string-integer-assignment.cpp
new file mode 100644
index 0000000000..30ef46b922
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-string-integer-assignment.cpp
@@ -0,0 +1,28 @@
+// https://clang.llvm.org/extra/clang-tidy/checks/bugprone-string-integer-assignment.html
+
+#include "structures.h"
+
+void test_int()
+{
+ // Numeric types can be implicitly casted to character types.
+ std::string s;
+ int x = 5965;
+ s = 6; // warning
+ s = x; // warning
+}
+
+void test_conversion()
+{
+ // Use the appropriate conversion functions or character literals.
+ std::string s;
+ int x = 5965;
+ s = '6'; // OK
+ s = std::to_string(x); // OK
+}
+
+void test_cast()
+{
+ // In order to suppress false positives, use an explicit cast.
+ std::string s;
+ s = static_cast<char>(6); // OK
+}
diff --git a/tools/clang-tidy/test/bugprone-string-integer-assignment.json b/tools/clang-tidy/test/bugprone-string-integer-assignment.json
new file mode 100644
index 0000000000..37912fd950
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-string-integer-assignment.json
@@ -0,0 +1,13 @@
+[
+ [
+ "warning",
+ "an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility",
+ "bugprone-string-integer-assignment"
+ ],
+ [
+ "warning",
+ "an integer is interpreted as a character code when assigning it to a string; if this is intended, cast the integer to the appropriate character type; if you want a string representation, use the appropriate conversion facility",
+ "bugprone-string-integer-assignment"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-suspicious-memset-usage.cpp b/tools/clang-tidy/test/bugprone-suspicious-memset-usage.cpp
new file mode 100644
index 0000000000..71fe7239a1
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-suspicious-memset-usage.cpp
@@ -0,0 +1,22 @@
+// https://clang.llvm.org/extra/clang-tidy/checks/bugprone-suspicious-memset-usage.html
+
+#include "structures.h"
+
+void test(int* ip, char* cp)
+{
+ // Case 1: Fill value is a character '0' instead of NUL '\0'.
+ memset(ip, '0', 1); // WARNING: suspicious for non-char pointers
+ memset(cp, '0', 1); // OK for char pointers
+
+ // Case 2: Fill value is truncated.
+ memset(ip, 0xabcd, 1); // WARNING: fill value gets truncated
+ memset(ip, 0x00cd, 1); // OK because value 0xcd is not truncated.
+ memset(ip, 0x00, 1); // OK because value is not truncated.
+
+ // Case 3: Byte count is zero.
+ memset(ip, sizeof(int), 0); // WARNING: zero length, potentially swapped
+ memset(ip, sizeof(int), 1); // OK with non-zero length
+
+ // See clang bug https://bugs.llvm.org/show_bug.cgi?id=38098
+ memset(ip, 8, 0); // OK with zero length without sizeof
+}
diff --git a/tools/clang-tidy/test/bugprone-suspicious-memset-usage.json b/tools/clang-tidy/test/bugprone-suspicious-memset-usage.json
new file mode 100644
index 0000000000..73f26cf7c1
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-suspicious-memset-usage.json
@@ -0,0 +1,18 @@
+[
+ [
+ "warning",
+ "memset fill value is char '0', potentially mistaken for int 0",
+ "bugprone-suspicious-memset-usage"
+ ],
+ [
+ "warning",
+ "memset fill value is out of unsigned character range, gets truncated",
+ "bugprone-suspicious-memset-usage"
+ ],
+ [
+ "warning",
+ "memset of size zero, potentially swapped arguments",
+ "bugprone-suspicious-memset-usage"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-suspicious-missing-comma.cpp b/tools/clang-tidy/test/bugprone-suspicious-missing-comma.cpp
new file mode 100644
index 0000000000..de1634e11f
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-suspicious-missing-comma.cpp
@@ -0,0 +1,9 @@
+const char* Cartoons[] = {
+ "Bugs Bunny",
+ "Homer Simpson",
+ "Mickey Mouse",
+ "Bart Simpson",
+ "Charlie Brown" // There is a missing comma here.
+ "Fred Flintstone",
+ "Popeye",
+};
diff --git a/tools/clang-tidy/test/bugprone-suspicious-missing-comma.json b/tools/clang-tidy/test/bugprone-suspicious-missing-comma.json
new file mode 100644
index 0000000000..f4adb6b33a
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-suspicious-missing-comma.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "suspicious string literal, probably missing a comma",
+ "bugprone-suspicious-missing-comma"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-suspicious-semicolon.cpp b/tools/clang-tidy/test/bugprone-suspicious-semicolon.cpp
new file mode 100644
index 0000000000..7a90a87cd3
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-suspicious-semicolon.cpp
@@ -0,0 +1,8 @@
+
+// bugprone-suspicious-semicolon
+void nop();
+void fail1()
+{
+ int x = 0;
+ if(x > 5); nop();
+}
diff --git a/tools/clang-tidy/test/bugprone-suspicious-semicolon.json b/tools/clang-tidy/test/bugprone-suspicious-semicolon.json
new file mode 100644
index 0000000000..c94a1d5abb
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-suspicious-semicolon.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "potentially unintended semicolon",
+ "bugprone-suspicious-semicolon"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-suspicious-string-compare.cpp b/tools/clang-tidy/test/bugprone-suspicious-string-compare.cpp
new file mode 100644
index 0000000000..505a9d282c
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-suspicious-string-compare.cpp
@@ -0,0 +1,8 @@
+static const char A[] = "abc";
+
+int strcmp(const char *, const char *);
+
+int test_warning_patterns() {
+ if (strcmp(A, "a"))
+ return 0;
+}
diff --git a/tools/clang-tidy/test/bugprone-suspicious-string-compare.json b/tools/clang-tidy/test/bugprone-suspicious-string-compare.json
new file mode 100644
index 0000000000..eda430ef01
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-suspicious-string-compare.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "function 'strcmp' is called without explicitly comparing result",
+ "bugprone-suspicious-string-compare"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-swapped-arguments.cpp b/tools/clang-tidy/test/bugprone-swapped-arguments.cpp
new file mode 100644
index 0000000000..074df52050
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-swapped-arguments.cpp
@@ -0,0 +1,26 @@
+// https://clang.llvm.org/extra/clang-tidy/checks/bugprone-swapped-arguments.html
+
+void test_d_i(double d, int i);
+void test_d_i_i(double d, int i, int ii);
+void test_i_d(int i, double d);
+void test_i_i_d(int i, int ii, double d);
+
+void test()
+{
+ double d = 1;
+ int i = 1;
+
+ test_d_i(d, i); // OK
+ test_d_i(i, d); // WARNING
+
+ test_i_d(i, d); // OK
+ test_i_d(d, i); // WARNING
+
+ test_i_i_d(i, i, d); // OK
+ test_i_i_d(i, d, i); // WARNING
+ test_i_i_d(d, i, i); // NO WARNING after second parameter
+
+ test_d_i_i(d, i, i); // OK
+ test_d_i_i(i, d, i); // WARNING
+ test_d_i_i(i, i, d); // NO WARNING after second parameter
+}
diff --git a/tools/clang-tidy/test/bugprone-swapped-arguments.json b/tools/clang-tidy/test/bugprone-swapped-arguments.json
new file mode 100644
index 0000000000..44c8093e52
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-swapped-arguments.json
@@ -0,0 +1,23 @@
+[
+ [
+ "warning",
+ "argument with implicit conversion from 'double' to 'int' followed by argument converted from 'int' to 'double', potentially swapped arguments.",
+ "bugprone-swapped-arguments"
+ ],
+ [
+ "warning",
+ "argument with implicit conversion from 'int' to 'double' followed by argument converted from 'double' to 'int', potentially swapped arguments.",
+ "bugprone-swapped-arguments"
+ ],
+ [
+ "warning",
+ "argument with implicit conversion from 'int' to 'double' followed by argument converted from 'double' to 'int', potentially swapped arguments.",
+ "bugprone-swapped-arguments"
+ ],
+ [
+ "warning",
+ "argument with implicit conversion from 'double' to 'int' followed by argument converted from 'int' to 'double', potentially swapped arguments.",
+ "bugprone-swapped-arguments"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-too-small-loop-variable.cpp b/tools/clang-tidy/test/bugprone-too-small-loop-variable.cpp
new file mode 100644
index 0000000000..4dc8ed7a22
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-too-small-loop-variable.cpp
@@ -0,0 +1,4 @@
+int main() {
+ long size = 294967296l;
+ for (short i = 0; i < size; ++i) {}
+}
diff --git a/tools/clang-tidy/test/bugprone-too-small-loop-variable.json b/tools/clang-tidy/test/bugprone-too-small-loop-variable.json
new file mode 100644
index 0000000000..23f781936c
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-too-small-loop-variable.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "loop variable has narrower type 'short' than iteration's upper bound 'long'",
+ "bugprone-too-small-loop-variable"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-unused-raii.cpp b/tools/clang-tidy/test/bugprone-unused-raii.cpp
new file mode 100644
index 0000000000..6a4a0a15ab
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-unused-raii.cpp
@@ -0,0 +1,25 @@
+// https://clang.llvm.org/extra/clang-tidy/checks/bugprone-unused-raii.html
+
+struct scoped_lock
+{
+ scoped_lock() {}
+ ~scoped_lock() {}
+};
+
+#define SCOPED_LOCK_MACRO(m) scoped_lock()
+
+struct trivial_scoped_lock
+{
+ trivial_scoped_lock() {}
+};
+
+scoped_lock test()
+{
+ scoped_lock(); // misc-unused-raii warning!
+
+ SCOPED_LOCK_MACRO(); // no warning for macros
+
+ trivial_scoped_lock(); // no warning for trivial objects without destructors
+
+ return scoped_lock(); // no warning for return values
+}
diff --git a/tools/clang-tidy/test/bugprone-unused-raii.json b/tools/clang-tidy/test/bugprone-unused-raii.json
new file mode 100644
index 0000000000..99a9936485
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-unused-raii.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "object destroyed immediately after creation; did you mean to name the object?",
+ "bugprone-unused-raii"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/bugprone-use-after-move.cpp b/tools/clang-tidy/test/bugprone-use-after-move.cpp
new file mode 100644
index 0000000000..f90a8700d6
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-use-after-move.cpp
@@ -0,0 +1,62 @@
+namespace std {
+typedef unsigned size_t;
+
+template <typename T>
+struct unique_ptr {
+ unique_ptr();
+ T *get() const;
+ explicit operator bool() const;
+ void reset(T *ptr);
+ T &operator*() const;
+ T *operator->() const;
+ T& operator[](size_t i) const;
+};
+
+template <typename>
+struct remove_reference;
+
+template <typename _Tp>
+struct remove_reference {
+ typedef _Tp type;
+};
+
+template <typename _Tp>
+struct remove_reference<_Tp &> {
+ typedef _Tp type;
+};
+
+template <typename _Tp>
+struct remove_reference<_Tp &&> {
+ typedef _Tp type;
+};
+
+template <typename _Tp>
+constexpr typename std::remove_reference<_Tp>::type &&move(_Tp &&__t) noexcept {
+ return static_cast<typename remove_reference<_Tp>::type &&>(__t);
+}
+}
+
+class A {
+public:
+ A();
+ A(const A &);
+ A(A &&);
+
+ A &operator=(const A &);
+ A &operator=(A &&);
+
+ void foo() const;
+ int getInt() const;
+
+ operator bool() const;
+
+ int i;
+};
+
+void func() {
+ std::unique_ptr<A> ptr;
+ std::move(ptr);
+ ptr.get();
+ static_cast<bool>(ptr);
+ *ptr;
+}
diff --git a/tools/clang-tidy/test/bugprone-use-after-move.json b/tools/clang-tidy/test/bugprone-use-after-move.json
new file mode 100644
index 0000000000..50d7210781
--- /dev/null
+++ b/tools/clang-tidy/test/bugprone-use-after-move.json
@@ -0,0 +1,4 @@
+[
+ ["warning", "'ptr' used after it was moved", "bugprone-use-after-move"],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-core.CallAndMessage.cpp b/tools/clang-tidy/test/clang-analyzer-core.CallAndMessage.cpp
new file mode 100644
index 0000000000..286189e25b
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.CallAndMessage.cpp
@@ -0,0 +1,10 @@
+struct S {
+ int x;
+};
+
+void f(struct S s);
+
+void test() {
+ struct S s;
+ f(s);
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-core.CallAndMessage.json b/tools/clang-tidy/test/clang-analyzer-core.CallAndMessage.json
new file mode 100644
index 0000000000..ecf097e287
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.CallAndMessage.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Passed-by-value struct argument contains uninitialized data (e.g., field: 'x')",
+ "clang-analyzer-core.CallAndMessage"
+ ],
+ { "reliability": "medium" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-core.DivideZero.cpp b/tools/clang-tidy/test/clang-analyzer-core.DivideZero.cpp
new file mode 100644
index 0000000000..aac9f7c9f6
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.DivideZero.cpp
@@ -0,0 +1,4 @@
+void test(int z) {
+ if (z == 0)
+ int x = 1 / z;
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-core.DivideZero.json b/tools/clang-tidy/test/clang-analyzer-core.DivideZero.json
new file mode 100644
index 0000000000..78a64ad35b
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.DivideZero.json
@@ -0,0 +1,4 @@
+[
+ ["warning", "Division by zero", "clang-analyzer-core.DivideZero"],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-core.NonNullParamChecker.cpp b/tools/clang-tidy/test/clang-analyzer-core.NonNullParamChecker.cpp
new file mode 100644
index 0000000000..bc071f5453
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.NonNullParamChecker.cpp
@@ -0,0 +1,6 @@
+int f(int *p) __attribute__((nonnull));
+
+void test(int *p) {
+ if (!p)
+ f(p); // warn
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-core.NonNullParamChecker.json b/tools/clang-tidy/test/clang-analyzer-core.NonNullParamChecker.json
new file mode 100644
index 0000000000..deaae128ff
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.NonNullParamChecker.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Null pointer passed to 1st parameter expecting 'nonnull'",
+ "clang-analyzer-core.NonNullParamChecker"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-core.NullDereference.cpp b/tools/clang-tidy/test/clang-analyzer-core.NullDereference.cpp
new file mode 100644
index 0000000000..6c9c555532
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.NullDereference.cpp
@@ -0,0 +1,9 @@
+class C {
+public:
+ int x;
+};
+
+void test() {
+ C *pc = 0;
+ int k = pc->x;
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-core.NullDereference.json b/tools/clang-tidy/test/clang-analyzer-core.NullDereference.json
new file mode 100644
index 0000000000..4c9258b2b7
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.NullDereference.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Access to field 'x' results in a dereference of a null pointer (loaded from variable 'pc')",
+ "clang-analyzer-core.NullDereference"
+ ],
+ { "reliability": "medium" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-core.UndefinedBinaryOperatorResult.cpp b/tools/clang-tidy/test/clang-analyzer-core.UndefinedBinaryOperatorResult.cpp
new file mode 100644
index 0000000000..1351c35f44
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.UndefinedBinaryOperatorResult.cpp
@@ -0,0 +1,4 @@
+void test() {
+ int x;
+ int y = x + 1;
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-core.UndefinedBinaryOperatorResult.json b/tools/clang-tidy/test/clang-analyzer-core.UndefinedBinaryOperatorResult.json
new file mode 100644
index 0000000000..9ec6c8a809
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.UndefinedBinaryOperatorResult.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "The left operand of '+' is a garbage value",
+ "clang-analyzer-core.UndefinedBinaryOperatorResult"
+ ],
+ { "reliability": "medium" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-core.uninitialized.Assign.cpp b/tools/clang-tidy/test/clang-analyzer-core.uninitialized.Assign.cpp
new file mode 100644
index 0000000000..e9685d48a4
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.uninitialized.Assign.cpp
@@ -0,0 +1,4 @@
+void test() {
+ int x;
+ x |= 1;
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-core.uninitialized.Assign.json b/tools/clang-tidy/test/clang-analyzer-core.uninitialized.Assign.json
new file mode 100644
index 0000000000..3691af741c
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.uninitialized.Assign.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage",
+ "clang-analyzer-core.uninitialized.Assign"
+ ],
+ { "reliability": "medium" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-core.uninitialized.Branch.cpp b/tools/clang-tidy/test/clang-analyzer-core.uninitialized.Branch.cpp
new file mode 100644
index 0000000000..7a985eb080
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.uninitialized.Branch.cpp
@@ -0,0 +1,6 @@
+void test() {
+ int x;
+ if (x) {
+ return;
+ }
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-core.uninitialized.Branch.json b/tools/clang-tidy/test/clang-analyzer-core.uninitialized.Branch.json
new file mode 100644
index 0000000000..00c6b3ad1e
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-core.uninitialized.Branch.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Branch condition evaluates to a garbage value",
+ "clang-analyzer-core.uninitialized.Branch"
+ ],
+ { "reliability": "medium" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-cplusplus.Move.cpp b/tools/clang-tidy/test/clang-analyzer-cplusplus.Move.cpp
new file mode 100644
index 0000000000..65f2e36561
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-cplusplus.Move.cpp
@@ -0,0 +1,10 @@
+class P {};
+
+void bar(P) {}
+
+void foo(int n) {
+ P x;
+ for (int i = n; i >= 0; --i) {
+ bar(static_cast<P&&>(x));
+ }
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-cplusplus.Move.json b/tools/clang-tidy/test/clang-analyzer-cplusplus.Move.json
new file mode 100644
index 0000000000..e60f052e86
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-cplusplus.Move.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Moved-from object 'x' is moved",
+ "clang-analyzer-cplusplus.Move"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-cplusplus.NewDelete.cpp b/tools/clang-tidy/test/clang-analyzer-cplusplus.NewDelete.cpp
new file mode 100644
index 0000000000..d886d74989
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-cplusplus.NewDelete.cpp
@@ -0,0 +1,50 @@
+// https://clang-analyzer.llvm.org/available_checks.html
+
+void use(int *p);
+
+void test_use_parameter_after_delete(int *p)
+{
+ delete p;
+ use(p); // warning: use after free
+}
+
+class SomeClass {
+public:
+ void f();
+};
+
+void test_use_local_after_delete()
+{
+ SomeClass *c = new SomeClass;
+ delete c;
+ c->f(); // warning: use after free
+}
+
+// XXX clang documentation says this should cause a warning but it doesn't!
+void test_delete_alloca()
+{
+ int *p = (int *)__builtin_alloca(sizeof(int));
+ delete p; // NO warning: deleting memory allocated by alloca
+}
+
+void test_double_free()
+{
+ int *p = new int;
+ delete p;
+ delete p; // warning: attempt to free released
+}
+
+void test_delete_local()
+{
+ int i;
+ delete &i; // warning: delete address of local
+}
+
+// XXX clang documentation says this should cause a warning but it doesn't!
+void test_delete_offset()
+{
+ int *p = new int[1];
+ delete[] (++p);
+ // NO warning: argument to 'delete[]' is offset by 4 bytes
+ // from the start of memory allocated by 'new[]'
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-cplusplus.NewDelete.json b/tools/clang-tidy/test/clang-analyzer-cplusplus.NewDelete.json
new file mode 100644
index 0000000000..99a9cd0dd2
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-cplusplus.NewDelete.json
@@ -0,0 +1,23 @@
+[
+ [
+ "warning",
+ "Use of memory after it is freed",
+ "clang-analyzer-cplusplus.NewDelete"
+ ],
+ [
+ "warning",
+ "Use of memory after it is freed",
+ "clang-analyzer-cplusplus.NewDelete"
+ ],
+ [
+ "warning",
+ "Attempt to free released memory",
+ "clang-analyzer-cplusplus.NewDelete"
+ ],
+ [
+ "warning",
+ "Argument to 'delete' is the address of the local variable 'i', which is not memory allocated by 'new'",
+ "clang-analyzer-cplusplus.NewDelete"
+ ],
+ { "reliability": "medium" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-cplusplus.NewDeleteLeaks.cpp b/tools/clang-tidy/test/clang-analyzer-cplusplus.NewDeleteLeaks.cpp
new file mode 100644
index 0000000000..60772a30db
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-cplusplus.NewDeleteLeaks.cpp
@@ -0,0 +1,6 @@
+// https://clang-analyzer.llvm.org/available_checks.html
+
+void test()
+{
+ int *p = new int;
+} // warning
diff --git a/tools/clang-tidy/test/clang-analyzer-cplusplus.NewDeleteLeaks.json b/tools/clang-tidy/test/clang-analyzer-cplusplus.NewDeleteLeaks.json
new file mode 100644
index 0000000000..37490a67f8
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-cplusplus.NewDeleteLeaks.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Potential leak of memory pointed to by 'p'",
+ "clang-analyzer-cplusplus.NewDeleteLeaks"
+ ],
+ { "reliability": "medium" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-deadcode.DeadStores.cpp b/tools/clang-tidy/test/clang-analyzer-deadcode.DeadStores.cpp
new file mode 100644
index 0000000000..4e1c2c851d
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-deadcode.DeadStores.cpp
@@ -0,0 +1,6 @@
+
+// clang-analyzer-deadcode.DeadStores
+void test() {
+ int x;
+ x = 1; // warn
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-deadcode.DeadStores.json b/tools/clang-tidy/test/clang-analyzer-deadcode.DeadStores.json
new file mode 100644
index 0000000000..c46d5f2c2a
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-deadcode.DeadStores.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Value stored to 'x' is never read",
+ "clang-analyzer-deadcode.DeadStores"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-optin.performance.Padding.cpp b/tools/clang-tidy/test/clang-analyzer-optin.performance.Padding.cpp
new file mode 100644
index 0000000000..0b851a68d3
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-optin.performance.Padding.cpp
@@ -0,0 +1,6 @@
+struct OverlyAlignedChar {
+ char c1;
+ int x;
+ char c2;
+ char c __attribute__((aligned(4096)));
+};
diff --git a/tools/clang-tidy/test/clang-analyzer-optin.performance.Padding.json b/tools/clang-tidy/test/clang-analyzer-optin.performance.Padding.json
new file mode 100644
index 0000000000..a7ce9df9a5
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-optin.performance.Padding.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Excessive padding in 'struct OverlyAlignedChar' (8185 padding bytes, where 4089 is optimal). Optimal fields order: c, c1, c2, x, consider reordering the fields or adding explicit padding members",
+ "clang-analyzer-optin.performance.Padding"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-security.FloatLoopCounter.cpp b/tools/clang-tidy/test/clang-analyzer-security.FloatLoopCounter.cpp
new file mode 100644
index 0000000000..60dcdad746
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.FloatLoopCounter.cpp
@@ -0,0 +1,3 @@
+void test() {
+ for (float x = 0.1f; x <= 1.0f; x += 0.1f) {}
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-security.FloatLoopCounter.json b/tools/clang-tidy/test/clang-analyzer-security.FloatLoopCounter.json
new file mode 100644
index 0000000000..792f5b13dc
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.FloatLoopCounter.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Variable 'x' with floating point type 'float' should not be used as a loop counter",
+ "clang-analyzer-security.FloatLoopCounter"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.UncheckedReturn.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.UncheckedReturn.cpp
new file mode 100644
index 0000000000..f1dede2d51
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.UncheckedReturn.cpp
@@ -0,0 +1,5 @@
+#include "structures.h"
+
+void test() {
+ setuid(1);
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.UncheckedReturn.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.UncheckedReturn.json
new file mode 100644
index 0000000000..a4f89bc0d9
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.UncheckedReturn.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "The return value from the call to 'setuid' is not checked. If an error occurs in 'setuid', the following code may execute with unexpected privileges",
+ "clang-analyzer-security.insecureAPI.UncheckedReturn"
+ ],
+ { "reliability": "low" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.cpp
new file mode 100644
index 0000000000..8821807518
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.cpp
@@ -0,0 +1,5 @@
+#include "structures.h"
+
+int test_bcmp(void *a, void *b, size_t n) {
+ return bcmp(a, b, n);
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.json
new file mode 100644
index 0000000000..ea7d6267ee
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcmp.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "The bcmp() function is obsoleted by memcmp()",
+ "clang-analyzer-security.insecureAPI.bcmp"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.cpp
new file mode 100644
index 0000000000..67df7d1638
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.cpp
@@ -0,0 +1,5 @@
+#include "structures.h"
+
+void test_bcopy(void *a, void *b, size_t n) {
+ bcopy(a, b, n);
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.json
new file mode 100644
index 0000000000..d752f6c7a8
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bcopy.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "The bcopy() function is obsoleted by memcpy() or memmove()",
+ "clang-analyzer-security.insecureAPI.bcopy"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.cpp
new file mode 100644
index 0000000000..d3b5aa685f
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.cpp
@@ -0,0 +1,5 @@
+#include "structures.h"
+
+void test_bzero(void *a, size_t n) {
+ bzero(a, n);
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.json
new file mode 100644
index 0000000000..cdc654a176
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.bzero.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "The bzero() function is obsoleted by memset()",
+ "clang-analyzer-security.insecureAPI.bzero"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.getpw.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.getpw.cpp
new file mode 100644
index 0000000000..c3da0b1970
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.getpw.cpp
@@ -0,0 +1,6 @@
+#include "structures.h"
+
+void test() {
+ char buff[1024];
+ getpw(2, buff);
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.getpw.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.getpw.json
new file mode 100644
index 0000000000..2f80393d54
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.getpw.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "The getpw() function is dangerous as it may overflow the provided buffer. It is obsoleted by getpwuid()",
+ "clang-analyzer-security.insecureAPI.getpw"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.gets.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.gets.cpp
new file mode 100644
index 0000000000..f096c29de3
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.gets.cpp
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void test() {
+ char buff[1024];
+ gets(buff);
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.gets.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.gets.json
new file mode 100644
index 0000000000..1d2212ee27
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.gets.json
@@ -0,0 +1 @@
+"[[\"error\", \"use of undeclared identifier 'gets'\", \"clang-diagnostic-error\"]]"
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mkstemp.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mkstemp.cpp
new file mode 100644
index 0000000000..904fc92ce6
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mkstemp.cpp
@@ -0,0 +1,5 @@
+#include "structures.h"
+
+void test() {
+ mkstemp("XX");
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mkstemp.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mkstemp.json
new file mode 100644
index 0000000000..cca843ce93
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mkstemp.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Call to 'mkstemp' should have at least 6 'X's in the format string to be secure (2 'X's seen)",
+ "clang-analyzer-security.insecureAPI.mkstemp"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mktemp.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mktemp.cpp
new file mode 100644
index 0000000000..8bb511a7d7
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mktemp.cpp
@@ -0,0 +1,5 @@
+#include "structures.h"
+
+void test() {
+ char *x = mktemp("/tmp/zxcv");
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mktemp.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mktemp.json
new file mode 100644
index 0000000000..ce58bfdddf
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.mktemp.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Call to function 'mktemp' is insecure as it always creates or uses insecure temporary file. Use 'mkstemp' instead",
+ "clang-analyzer-security.insecureAPI.mktemp"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.rand.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.rand.cpp
new file mode 100644
index 0000000000..2274127c50
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.rand.cpp
@@ -0,0 +1,4 @@
+#include <stdlib.h>
+void test() {
+ random();
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.rand.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.rand.json
new file mode 100644
index 0000000000..7669f38d3e
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.rand.json
@@ -0,0 +1 @@
+"[[\"warning\", \"The 'random' function produces a sequence of values that an adversary may be able to predict. Use 'arc4random' instead\", \"clang-analyzer-security.insecureAPI.rand\"]]"
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.strcpy.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.strcpy.cpp
new file mode 100644
index 0000000000..41713adb4e
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.strcpy.cpp
@@ -0,0 +1,7 @@
+#include <string.h>
+void test() {
+ char x[4];
+ char *y = "abcd";
+
+ strcpy(x, y);
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.strcpy.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.strcpy.json
new file mode 100644
index 0000000000..874de88ded
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.strcpy.json
@@ -0,0 +1 @@
+"[[\"warning\", \"Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119\", \"clang-analyzer-security.insecureAPI.strcpy\"], [\"note\", \"Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119\", null]]"
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.vfork.cpp b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.vfork.cpp
new file mode 100644
index 0000000000..619d986cf7
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.vfork.cpp
@@ -0,0 +1,5 @@
+#include "structures.h"
+
+void test() {
+ vfork();
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.vfork.json b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.vfork.json
new file mode 100644
index 0000000000..dd681fd537
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-security.insecureAPI.vfork.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Call to function 'vfork' is insecure as it can lead to denial of service situations in the parent process. Replace calls to vfork with calls to the safer 'posix_spawn' function",
+ "clang-analyzer-security.insecureAPI.vfork"
+ ],
+ { "reliability": "medium" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-unix.Malloc.cpp b/tools/clang-tidy/test/clang-analyzer-unix.Malloc.cpp
new file mode 100644
index 0000000000..a08422b336
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-unix.Malloc.cpp
@@ -0,0 +1,37 @@
+// https://clang-analyzer.llvm.org/available_checks.html
+
+#include "structures.h"
+
+void test_malloc()
+{
+ int *p = (int*) malloc(1);
+ free(p);
+ free(p); // warning: attempt to free released memory
+}
+
+void test_use_after_free()
+{
+ int *p = (int*) malloc(sizeof(int));
+ free(p);
+ *p = 1; // warning: use after free
+}
+
+void test_leak()
+{
+ int *p = (int*) malloc(1);
+ if (p)
+ return; // warning: memory is never released
+}
+
+void test_free_local()
+{
+ int a[] = { 1 };
+ free(a); // warning: argument is not allocated by malloc
+}
+
+void test_free_offset()
+{
+ int *p = (int*) malloc(sizeof(char));
+ p = p - 1;
+ free(p); // warning: argument to free() is offset by -4 bytes
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-unix.Malloc.json b/tools/clang-tidy/test/clang-analyzer-unix.Malloc.json
new file mode 100644
index 0000000000..701cbba680
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-unix.Malloc.json
@@ -0,0 +1,20 @@
+[
+ ["warning", "Attempt to free released memory", "clang-analyzer-unix.Malloc"],
+ ["warning", "Use of memory after it is freed", "clang-analyzer-unix.Malloc"],
+ [
+ "warning",
+ "Potential leak of memory pointed to by 'p'",
+ "clang-analyzer-unix.Malloc"
+ ],
+ [
+ "warning",
+ "Argument to free() is the address of the local variable 'a', which is not memory allocated by malloc()",
+ "clang-analyzer-unix.Malloc"
+ ],
+ [
+ "warning",
+ "Argument to free() is offset by -4 bytes from the start of memory allocated by malloc()",
+ "clang-analyzer-unix.Malloc"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-unix.cstring.BadSizeArg.cpp b/tools/clang-tidy/test/clang-analyzer-unix.cstring.BadSizeArg.cpp
new file mode 100644
index 0000000000..124737c3f4
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-unix.cstring.BadSizeArg.cpp
@@ -0,0 +1,9 @@
+// https://clang-analyzer.llvm.org/available_checks.html
+
+#include "structures.h"
+
+void test()
+{
+ char dest[3];
+ strncat(dest, "***", sizeof(dest)); // warning : potential buffer overflow
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-unix.cstring.BadSizeArg.json b/tools/clang-tidy/test/clang-analyzer-unix.cstring.BadSizeArg.json
new file mode 100644
index 0000000000..dc6b9facf1
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-unix.cstring.BadSizeArg.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Potential buffer overflow. Replace with 'sizeof(dest) - strlen(dest) - 1' or use a safer 'strlcat' API",
+ "clang-analyzer-unix.cstring.BadSizeArg"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/clang-analyzer-unix.cstring.NullArg.cpp b/tools/clang-tidy/test/clang-analyzer-unix.cstring.NullArg.cpp
new file mode 100644
index 0000000000..30cdaf6ce9
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-unix.cstring.NullArg.cpp
@@ -0,0 +1,14 @@
+// https://clang-analyzer.llvm.org/available_checks.html
+
+#include "structures.h"
+
+int my_strlen(const char* s)
+{
+ return strlen(s); // warning
+}
+
+int bad_caller()
+{
+ const char* s = nullptr;
+ return my_strlen(s);
+}
diff --git a/tools/clang-tidy/test/clang-analyzer-unix.cstring.NullArg.json b/tools/clang-tidy/test/clang-analyzer-unix.cstring.NullArg.json
new file mode 100644
index 0000000000..a1270cafd8
--- /dev/null
+++ b/tools/clang-tidy/test/clang-analyzer-unix.cstring.NullArg.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "Null pointer passed as 1st argument to string length function",
+ "clang-analyzer-unix.cstring.NullArg"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/cppcoreguidelines-narrowing-conversions.cpp b/tools/clang-tidy/test/cppcoreguidelines-narrowing-conversions.cpp
new file mode 100644
index 0000000000..b10b0fa1c3
--- /dev/null
+++ b/tools/clang-tidy/test/cppcoreguidelines-narrowing-conversions.cpp
@@ -0,0 +1,4 @@
+class Foo {
+ int f;
+ void a_f(double val) { f = val;}
+};
diff --git a/tools/clang-tidy/test/cppcoreguidelines-narrowing-conversions.json b/tools/clang-tidy/test/cppcoreguidelines-narrowing-conversions.json
new file mode 100644
index 0000000000..9dca259044
--- /dev/null
+++ b/tools/clang-tidy/test/cppcoreguidelines-narrowing-conversions.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "narrowing conversion from 'double' to 'int'",
+ "cppcoreguidelines-narrowing-conversions"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/cppcoreguidelines-pro-type-member-init.cpp b/tools/clang-tidy/test/cppcoreguidelines-pro-type-member-init.cpp
new file mode 100644
index 0000000000..be331829f3
--- /dev/null
+++ b/tools/clang-tidy/test/cppcoreguidelines-pro-type-member-init.cpp
@@ -0,0 +1,7 @@
+struct Foo final {
+ int x;
+};
+
+void foo() {
+ Foo y;
+}
diff --git a/tools/clang-tidy/test/cppcoreguidelines-pro-type-member-init.json b/tools/clang-tidy/test/cppcoreguidelines-pro-type-member-init.json
new file mode 100644
index 0000000000..11e79f1579
--- /dev/null
+++ b/tools/clang-tidy/test/cppcoreguidelines-pro-type-member-init.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "uninitialized record type: 'y'",
+ "cppcoreguidelines-pro-type-member-init"
+ ],
+ { "reliability": "medium" }
+]
diff --git a/tools/clang-tidy/test/misc-non-copyable-objects.cpp b/tools/clang-tidy/test/misc-non-copyable-objects.cpp
new file mode 100644
index 0000000000..2f9060a818
--- /dev/null
+++ b/tools/clang-tidy/test/misc-non-copyable-objects.cpp
@@ -0,0 +1,5 @@
+namespace std {
+typedef struct FILE {} FILE;
+}
+
+void g(std::FILE f);
diff --git a/tools/clang-tidy/test/misc-non-copyable-objects.json b/tools/clang-tidy/test/misc-non-copyable-objects.json
new file mode 100644
index 0000000000..30826f3700
--- /dev/null
+++ b/tools/clang-tidy/test/misc-non-copyable-objects.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "'f' declared as type 'FILE', which is unsafe to copy; did you mean 'FILE *'?",
+ "misc-non-copyable-objects"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/misc-redundant-expression.cpp b/tools/clang-tidy/test/misc-redundant-expression.cpp
new file mode 100644
index 0000000000..0ccc9c55f7
--- /dev/null
+++ b/tools/clang-tidy/test/misc-redundant-expression.cpp
@@ -0,0 +1,3 @@
+int TestSimpleEquivalent(int X, int Y) {
+ if (X - X) return 1;
+}
diff --git a/tools/clang-tidy/test/misc-redundant-expression.json b/tools/clang-tidy/test/misc-redundant-expression.json
new file mode 100644
index 0000000000..e4bffef44c
--- /dev/null
+++ b/tools/clang-tidy/test/misc-redundant-expression.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "both sides of operator are equivalent",
+ "misc-redundant-expression"
+ ],
+ { "reliability": "medium" }
+]
diff --git a/tools/clang-tidy/test/misc-unused-alias-decls.cpp b/tools/clang-tidy/test/misc-unused-alias-decls.cpp
new file mode 100644
index 0000000000..1bbaa2db0a
--- /dev/null
+++ b/tools/clang-tidy/test/misc-unused-alias-decls.cpp
@@ -0,0 +1,18 @@
+// https://clang.llvm.org/extra/clang-tidy/checks/misc-unused-alias-decls.html
+
+namespace n1 {
+ namespace n2 {
+ namespace n3 {
+ int qux = 42;
+ }
+ }
+}
+
+namespace n1_unused = ::n1; // WARNING
+namespace n12_unused = n1::n2; // WARNING
+namespace n123 = n1::n2::n3; // OK
+
+int test()
+{
+ return n123::qux;
+}
diff --git a/tools/clang-tidy/test/misc-unused-alias-decls.json b/tools/clang-tidy/test/misc-unused-alias-decls.json
new file mode 100644
index 0000000000..1144566e4e
--- /dev/null
+++ b/tools/clang-tidy/test/misc-unused-alias-decls.json
@@ -0,0 +1,13 @@
+[
+ [
+ "warning",
+ "namespace alias decl 'n1_unused' is unused",
+ "misc-unused-alias-decls"
+ ],
+ [
+ "warning",
+ "namespace alias decl 'n12_unused' is unused",
+ "misc-unused-alias-decls"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/misc-unused-using-decls.cpp b/tools/clang-tidy/test/misc-unused-using-decls.cpp
new file mode 100644
index 0000000000..6564711aba
--- /dev/null
+++ b/tools/clang-tidy/test/misc-unused-using-decls.cpp
@@ -0,0 +1,4 @@
+
+// misc-unused-using-decls
+namespace n { class C; }
+using n::C;
diff --git a/tools/clang-tidy/test/misc-unused-using-decls.json b/tools/clang-tidy/test/misc-unused-using-decls.json
new file mode 100644
index 0000000000..fc4156adca
--- /dev/null
+++ b/tools/clang-tidy/test/misc-unused-using-decls.json
@@ -0,0 +1,4 @@
+[
+ ["warning", "using decl 'C' is unused", "misc-unused-using-decls"],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/modernize-avoid-bind.cpp b/tools/clang-tidy/test/modernize-avoid-bind.cpp
new file mode 100644
index 0000000000..c46fb31cd5
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-avoid-bind.cpp
@@ -0,0 +1,6 @@
+#include "structures.h"
+
+int add(int x, int y) { return x + y; }
+void f_bind() {
+ auto clj = std::bind(add, 2, 2);
+}
diff --git a/tools/clang-tidy/test/modernize-avoid-bind.json b/tools/clang-tidy/test/modernize-avoid-bind.json
new file mode 100644
index 0000000000..915f62f042
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-avoid-bind.json
@@ -0,0 +1,4 @@
+[
+ ["warning", "prefer a lambda to std::bind", "modernize-avoid-bind"],
+ { "reliability": "medium" }
+]
diff --git a/tools/clang-tidy/test/modernize-concat-nested-namespaces.cpp b/tools/clang-tidy/test/modernize-concat-nested-namespaces.cpp
new file mode 100644
index 0000000000..0ff35d0e07
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-concat-nested-namespaces.cpp
@@ -0,0 +1,5 @@
+namespace mozilla {
+namespace dom {
+void foo();
+}
+}
diff --git a/tools/clang-tidy/test/modernize-concat-nested-namespaces.json b/tools/clang-tidy/test/modernize-concat-nested-namespaces.json
new file mode 100644
index 0000000000..2c7bc6f52b
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-concat-nested-namespaces.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "nested namespaces can be concatenated",
+ "modernize-concat-nested-namespaces"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/modernize-deprecated-ios-base-aliases.cpp b/tools/clang-tidy/test/modernize-deprecated-ios-base-aliases.cpp
new file mode 100644
index 0000000000..288fac8483
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-deprecated-ios-base-aliases.cpp
@@ -0,0 +1,18 @@
+namespace std {
+class ios_base {
+public:
+ typedef int io_state;
+ typedef int open_mode;
+ typedef int seek_dir;
+
+ typedef int streampos;
+ typedef int streamoff;
+};
+
+template <class CharT>
+class basic_ios : public ios_base {
+};
+} // namespace std
+
+// Test function return values (declaration)
+std::ios_base::io_state f_5();
diff --git a/tools/clang-tidy/test/modernize-deprecated-ios-base-aliases.json b/tools/clang-tidy/test/modernize-deprecated-ios-base-aliases.json
new file mode 100644
index 0000000000..7d6d0d055f
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-deprecated-ios-base-aliases.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "'std::ios_base::io_state' is deprecated; use 'std::ios_base::iostate' instead",
+ "modernize-deprecated-ios-base-aliases"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/modernize-loop-convert.cpp b/tools/clang-tidy/test/modernize-loop-convert.cpp
new file mode 100644
index 0000000000..2205846c7e
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-loop-convert.cpp
@@ -0,0 +1,7 @@
+int arr[6] = {1, 2, 3, 4, 5, 6};
+
+void bar(void) {
+ for (int i = 0; i < 6; ++i) {
+ (void)arr[i];
+ }
+}
diff --git a/tools/clang-tidy/test/modernize-loop-convert.json b/tools/clang-tidy/test/modernize-loop-convert.json
new file mode 100644
index 0000000000..105e44bc2b
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-loop-convert.json
@@ -0,0 +1,4 @@
+[
+ ["warning", "use range-based for loop instead", "modernize-loop-convert"],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/modernize-raw-string-literal.cpp b/tools/clang-tidy/test/modernize-raw-string-literal.cpp
new file mode 100644
index 0000000000..d120aad9bf
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-raw-string-literal.cpp
@@ -0,0 +1 @@
+char const *const ManyQuotes("quotes:\'\'\'\'");
diff --git a/tools/clang-tidy/test/modernize-raw-string-literal.json b/tools/clang-tidy/test/modernize-raw-string-literal.json
new file mode 100644
index 0000000000..595deaa7db
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-raw-string-literal.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "escaped string literal can be written as a raw string literal",
+ "modernize-raw-string-literal"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/modernize-redundant-void-arg.cpp b/tools/clang-tidy/test/modernize-redundant-void-arg.cpp
new file mode 100644
index 0000000000..078e0e13ca
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-redundant-void-arg.cpp
@@ -0,0 +1,5 @@
+// modernize-redundant-void-arg
+
+int foo(void) {
+ return 0;
+}
diff --git a/tools/clang-tidy/test/modernize-redundant-void-arg.json b/tools/clang-tidy/test/modernize-redundant-void-arg.json
new file mode 100644
index 0000000000..a34b4069b6
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-redundant-void-arg.json
@@ -0,0 +1 @@
+"[[\"warning\", \"redundant void argument list in function definition\", \"modernize-redundant-void-arg\"]]"
diff --git a/tools/clang-tidy/test/modernize-shrink-to-fit.cpp b/tools/clang-tidy/test/modernize-shrink-to-fit.cpp
new file mode 100644
index 0000000000..c545a517a3
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-shrink-to-fit.cpp
@@ -0,0 +1,10 @@
+#include "structures.h"
+
+void f() {
+ std::vector<int> v;
+
+ std::vector<int>(v).swap(v);
+
+ std::vector<int> &vref = v;
+ std::vector<int>(vref).swap(vref);
+}
diff --git a/tools/clang-tidy/test/modernize-shrink-to-fit.json b/tools/clang-tidy/test/modernize-shrink-to-fit.json
new file mode 100644
index 0000000000..f8e4eda19f
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-shrink-to-fit.json
@@ -0,0 +1,13 @@
+[
+ [
+ "warning",
+ "the shrink_to_fit method should be used to reduce the capacity of a shrinkable container",
+ "modernize-shrink-to-fit"
+ ],
+ [
+ "warning",
+ "the shrink_to_fit method should be used to reduce the capacity of a shrinkable container",
+ "modernize-shrink-to-fit"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/modernize-use-auto.cpp b/tools/clang-tidy/test/modernize-use-auto.cpp
new file mode 100644
index 0000000000..ba54d0cb8a
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-auto.cpp
@@ -0,0 +1,11 @@
+#include <vector>
+
+void func() {
+ int val = 42;
+ std::vector<int> my_container;
+ for (std::vector<int>::iterator I = my_container.begin(),
+ E = my_container.end();
+ I != E;
+ ++I) {
+ }
+}
diff --git a/tools/clang-tidy/test/modernize-use-auto.json b/tools/clang-tidy/test/modernize-use-auto.json
new file mode 100644
index 0000000000..5885e8b6d5
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-auto.json
@@ -0,0 +1 @@
+"[[\"warning\", \"use auto when declaring iterators\", \"modernize-use-auto\"]]"
diff --git a/tools/clang-tidy/test/modernize-use-bool-literals.cpp b/tools/clang-tidy/test/modernize-use-bool-literals.cpp
new file mode 100644
index 0000000000..58b7ec8f29
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-bool-literals.cpp
@@ -0,0 +1,5 @@
+void foo() {
+ bool p = 1;
+ bool f = static_cast<bool>(1);
+ bool x = p ? 1 : 0;
+}
diff --git a/tools/clang-tidy/test/modernize-use-bool-literals.json b/tools/clang-tidy/test/modernize-use-bool-literals.json
new file mode 100644
index 0000000000..4d5effc1b9
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-bool-literals.json
@@ -0,0 +1,23 @@
+[
+ [
+ "warning",
+ "converting integer literal to bool, use bool literal instead",
+ "modernize-use-bool-literals"
+ ],
+ [
+ "warning",
+ "converting integer literal to bool, use bool literal instead",
+ "modernize-use-bool-literals"
+ ],
+ [
+ "warning",
+ "converting integer literal to bool, use bool literal instead",
+ "modernize-use-bool-literals"
+ ],
+ [
+ "warning",
+ "converting integer literal to bool, use bool literal instead",
+ "modernize-use-bool-literals"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/modernize-use-equals-default.cpp b/tools/clang-tidy/test/modernize-use-equals-default.cpp
new file mode 100644
index 0000000000..ea5f71d93a
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-equals-default.cpp
@@ -0,0 +1,6 @@
+
+class IL {
+public:
+ IL() {}
+ ~IL() {}
+};
diff --git a/tools/clang-tidy/test/modernize-use-equals-default.json b/tools/clang-tidy/test/modernize-use-equals-default.json
new file mode 100644
index 0000000000..5119e361b3
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-equals-default.json
@@ -0,0 +1,13 @@
+[
+ [
+ "warning",
+ "use '= default' to define a trivial default constructor",
+ "modernize-use-equals-default"
+ ],
+ [
+ "warning",
+ "use '= default' to define a trivial destructor",
+ "modernize-use-equals-default"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/modernize-use-equals-delete.cpp b/tools/clang-tidy/test/modernize-use-equals-delete.cpp
new file mode 100644
index 0000000000..f08848c0a6
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-equals-delete.cpp
@@ -0,0 +1,7 @@
+struct PositivePrivate {
+private:
+ PositivePrivate();
+ PositivePrivate(const PositivePrivate &);
+ PositivePrivate &operator=(PositivePrivate &&);
+ ~PositivePrivate();
+};
diff --git a/tools/clang-tidy/test/modernize-use-equals-delete.json b/tools/clang-tidy/test/modernize-use-equals-delete.json
new file mode 100644
index 0000000000..bcb9354149
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-equals-delete.json
@@ -0,0 +1,23 @@
+[
+ [
+ "warning",
+ "use '= delete' to prohibit calling of a special member function",
+ "modernize-use-equals-delete"
+ ],
+ [
+ "warning",
+ "use '= delete' to prohibit calling of a special member function",
+ "modernize-use-equals-delete"
+ ],
+ [
+ "warning",
+ "use '= delete' to prohibit calling of a special member function",
+ "modernize-use-equals-delete"
+ ],
+ [
+ "warning",
+ "use '= delete' to prohibit calling of a special member function",
+ "modernize-use-equals-delete"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/modernize-use-nullptr.cpp b/tools/clang-tidy/test/modernize-use-nullptr.cpp
new file mode 100644
index 0000000000..4b8b3ee3c0
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-nullptr.cpp
@@ -0,0 +1,5 @@
+#define NULL 0
+void f(void) {
+ char *str = NULL; // ok
+ (void)str;
+}
diff --git a/tools/clang-tidy/test/modernize-use-nullptr.json b/tools/clang-tidy/test/modernize-use-nullptr.json
new file mode 100644
index 0000000000..44bd18a10c
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-nullptr.json
@@ -0,0 +1 @@
+[["warning", "use nullptr", "modernize-use-nullptr"], { "reliability": "high" }]
diff --git a/tools/clang-tidy/test/modernize-use-override.cpp b/tools/clang-tidy/test/modernize-use-override.cpp
new file mode 100644
index 0000000000..1cbec3868c
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-override.cpp
@@ -0,0 +1,8 @@
+class Base {
+public:
+ virtual void foo() = 0;
+};
+
+class Deriv : public Base {
+ void foo();
+};
diff --git a/tools/clang-tidy/test/modernize-use-override.json b/tools/clang-tidy/test/modernize-use-override.json
new file mode 100644
index 0000000000..64f8b6e870
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-override.json
@@ -0,0 +1 @@
+"[[\"warning\", \"annotate this function with 'override' or (rarely) 'final'\", \"modernize-use-override\"]]"
diff --git a/tools/clang-tidy/test/modernize-use-using.cpp b/tools/clang-tidy/test/modernize-use-using.cpp
new file mode 100644
index 0000000000..0e7b73222c
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-using.cpp
@@ -0,0 +1,5 @@
+template <typename T>
+class Test {
+ typedef typename T::iterator Iter;
+};
+typedef int Type;
diff --git a/tools/clang-tidy/test/modernize-use-using.json b/tools/clang-tidy/test/modernize-use-using.json
new file mode 100644
index 0000000000..50ee7060a9
--- /dev/null
+++ b/tools/clang-tidy/test/modernize-use-using.json
@@ -0,0 +1,5 @@
+[
+ ["warning", "use 'using' instead of 'typedef'", "modernize-use-using"],
+ ["warning", "use 'using' instead of 'typedef'", "modernize-use-using"],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/performance-faster-string-find.cpp b/tools/clang-tidy/test/performance-faster-string-find.cpp
new file mode 100644
index 0000000000..d7ac3d0c3c
--- /dev/null
+++ b/tools/clang-tidy/test/performance-faster-string-find.cpp
@@ -0,0 +1,6 @@
+#include "structures.h"
+
+void foo() {
+ std::string str;
+ str.find("A");
+}
diff --git a/tools/clang-tidy/test/performance-faster-string-find.json b/tools/clang-tidy/test/performance-faster-string-find.json
new file mode 100644
index 0000000000..1ab2d7ba08
--- /dev/null
+++ b/tools/clang-tidy/test/performance-faster-string-find.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "'find' called with a string literal consisting of a single character; consider using the more effective overload accepting a character",
+ "performance-faster-string-find"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/performance-for-range-copy.cpp b/tools/clang-tidy/test/performance-for-range-copy.cpp
new file mode 100644
index 0000000000..264dd42896
--- /dev/null
+++ b/tools/clang-tidy/test/performance-for-range-copy.cpp
@@ -0,0 +1,30 @@
+template <typename T>
+struct Iterator {
+ void operator++() {}
+ const T& operator*() {
+ static T* TT = new T();
+ return *TT;
+ }
+ bool operator!=(const Iterator &) { return false; }
+ typedef const T& const_reference;
+};
+template <typename T>
+struct View {
+ T begin() { return T(); }
+ T begin() const { return T(); }
+ T end() { return T(); }
+ T end() const { return T(); }
+ typedef typename T::const_reference const_reference;
+};
+
+struct S {
+ S();
+ S(const S &);
+ ~S();
+ S &operator=(const S &);
+};
+
+void negativeConstReference() {
+ for (const S S1 : View<Iterator<S>>()) {
+ }
+}
diff --git a/tools/clang-tidy/test/performance-for-range-copy.json b/tools/clang-tidy/test/performance-for-range-copy.json
new file mode 100644
index 0000000000..2082041aad
--- /dev/null
+++ b/tools/clang-tidy/test/performance-for-range-copy.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "the loop variable's type is not a reference type; this creates a copy in each iteration; consider making this a reference",
+ "performance-for-range-copy"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/performance-implicit-conversion-in-loop.cpp b/tools/clang-tidy/test/performance-implicit-conversion-in-loop.cpp
new file mode 100644
index 0000000000..75ed510f3f
--- /dev/null
+++ b/tools/clang-tidy/test/performance-implicit-conversion-in-loop.cpp
@@ -0,0 +1,43 @@
+// Iterator returning by value.
+template <typename T>
+struct Iterator {
+ void operator++();
+ T operator*();
+ bool operator!=(const Iterator& other);
+};
+
+// The template argument is an iterator type, and a view is an object you can
+// run a for loop on.
+template <typename T>
+struct View {
+ T begin();
+ T end();
+};
+
+// With this class, the implicit conversion is a call to the (implicit)
+// constructor of the class.
+template <typename T>
+class ImplicitWrapper {
+ public:
+ // Implicit!
+ ImplicitWrapper(const T& t);
+};
+
+template <typename T>
+class OperatorWrapper {
+ public:
+ OperatorWrapper() = delete;
+};
+
+struct SimpleClass {
+ int foo;
+ operator OperatorWrapper<SimpleClass>();
+};
+
+typedef View<Iterator<SimpleClass>> SimpleView;
+
+void ImplicitSimpleClassIterator() {
+ for (const ImplicitWrapper<SimpleClass>& foo : SimpleView()) {}
+ for (const ImplicitWrapper<SimpleClass> foo : SimpleView()) {}
+ for (ImplicitWrapper<SimpleClass> foo : SimpleView()) {}
+}
diff --git a/tools/clang-tidy/test/performance-implicit-conversion-in-loop.json b/tools/clang-tidy/test/performance-implicit-conversion-in-loop.json
new file mode 100644
index 0000000000..d9bcb1e00a
--- /dev/null
+++ b/tools/clang-tidy/test/performance-implicit-conversion-in-loop.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "the type of the loop variable 'foo' is different from the one returned by the iterator and generates an implicit conversion; you can either change the type to the matching one ('const SimpleClass &' but 'const auto&' is always a valid option) or remove the reference to make it explicit that you are creating a new value",
+ "performance-implicit-conversion-in-loop"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/performance-inefficient-algorithm.cpp b/tools/clang-tidy/test/performance-inefficient-algorithm.cpp
new file mode 100644
index 0000000000..b508260dbd
--- /dev/null
+++ b/tools/clang-tidy/test/performance-inefficient-algorithm.cpp
@@ -0,0 +1,30 @@
+namespace std {
+template <typename T> struct less {
+ bool operator()(const T &lhs, const T &rhs) { return lhs < rhs; }
+};
+
+template <typename T> struct greater {
+ bool operator()(const T &lhs, const T &rhs) { return lhs > rhs; }
+};
+
+struct iterator_type {};
+
+template <typename K, typename Cmp = less<K>> struct set {
+ typedef iterator_type iterator;
+ iterator find(const K &k);
+ unsigned count(const K &k);
+
+ iterator begin();
+ iterator end();
+ iterator begin() const;
+ iterator end() const;
+};
+
+template <typename FwIt, typename K>
+FwIt find(FwIt, FwIt end, const K &) { return end; }
+}
+
+template <typename T> void f(const T &t) {
+ std::set<int> s;
+ find(s.begin(), s.end(), 46);
+}
diff --git a/tools/clang-tidy/test/performance-inefficient-algorithm.json b/tools/clang-tidy/test/performance-inefficient-algorithm.json
new file mode 100644
index 0000000000..e3c575bd85
--- /dev/null
+++ b/tools/clang-tidy/test/performance-inefficient-algorithm.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "this STL algorithm call should be replaced with a container method",
+ "performance-inefficient-algorithm"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/performance-inefficient-string-concatenation.cpp b/tools/clang-tidy/test/performance-inefficient-string-concatenation.cpp
new file mode 100644
index 0000000000..5a5860f215
--- /dev/null
+++ b/tools/clang-tidy/test/performance-inefficient-string-concatenation.cpp
@@ -0,0 +1,13 @@
+#include "structures.h"
+
+extern void fstring(std::string);
+
+void foo() {
+ std::string mystr1, mystr2;
+ auto myautostr1 = mystr1;
+ auto myautostr2 = mystr2;
+
+ for (int i = 0; i < 10; ++i) {
+ fstring(mystr1 + mystr2 + mystr1);
+ }
+}
diff --git a/tools/clang-tidy/test/performance-inefficient-string-concatenation.json b/tools/clang-tidy/test/performance-inefficient-string-concatenation.json
new file mode 100644
index 0000000000..8c7223db6d
--- /dev/null
+++ b/tools/clang-tidy/test/performance-inefficient-string-concatenation.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead",
+ "performance-inefficient-string-concatenation"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/performance-inefficient-vector-operation.cpp b/tools/clang-tidy/test/performance-inefficient-vector-operation.cpp
new file mode 100644
index 0000000000..4f0e143aa2
--- /dev/null
+++ b/tools/clang-tidy/test/performance-inefficient-vector-operation.cpp
@@ -0,0 +1,10 @@
+#include "structures.h"
+
+void foo()
+{
+ std::vector<int> v;
+ int n = 100;
+ for (int i = 0; i < n; ++i) {
+ v.push_back(n);
+ }
+}
diff --git a/tools/clang-tidy/test/performance-inefficient-vector-operation.json b/tools/clang-tidy/test/performance-inefficient-vector-operation.json
new file mode 100644
index 0000000000..d3e9e769d2
--- /dev/null
+++ b/tools/clang-tidy/test/performance-inefficient-vector-operation.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "'push_back' is called inside a loop; consider pre-allocating the container capacity before the loop",
+ "performance-inefficient-vector-operation"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/performance-move-const-arg.cpp b/tools/clang-tidy/test/performance-move-const-arg.cpp
new file mode 100644
index 0000000000..39f1ce06ec
--- /dev/null
+++ b/tools/clang-tidy/test/performance-move-const-arg.cpp
@@ -0,0 +1,33 @@
+namespace std {
+template <typename _Tp>
+struct remove_reference {
+ typedef _Tp type;
+};
+
+template <typename _Tp>
+constexpr typename std::remove_reference<_Tp>::type &&move(_Tp &&__t) {
+ return static_cast<typename std::remove_reference<_Tp>::type &&>(__t);
+}
+} // namespace std
+
+struct TriviallyCopyable {
+ int i;
+};
+
+class A {
+public:
+ A() {}
+ A(const A &rhs) {}
+ A(A &&rhs) {}
+};
+
+void f(TriviallyCopyable) {}
+
+void g() {
+ TriviallyCopyable obj;
+ f(std::move(obj));
+}
+
+A f5(const A x5) {
+ return std::move(x5);
+}
diff --git a/tools/clang-tidy/test/performance-move-const-arg.json b/tools/clang-tidy/test/performance-move-const-arg.json
new file mode 100644
index 0000000000..d56fe6bf37
--- /dev/null
+++ b/tools/clang-tidy/test/performance-move-const-arg.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "std::move of the const variable 'x5' has no effect; remove std::move() or make the variable non-const",
+ "performance-move-const-arg"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/performance-move-constructor-init.cpp b/tools/clang-tidy/test/performance-move-constructor-init.cpp
new file mode 100644
index 0000000000..243b399e95
--- /dev/null
+++ b/tools/clang-tidy/test/performance-move-constructor-init.cpp
@@ -0,0 +1,11 @@
+struct B {
+ B() {}
+ B(const B&) {}
+ B(B &&) {}
+};
+
+struct D : B {
+ D() : B() {}
+ D(const D &RHS) : B(RHS) {}
+ D(D &&RHS) : B(RHS) {}
+};
diff --git a/tools/clang-tidy/test/performance-move-constructor-init.json b/tools/clang-tidy/test/performance-move-constructor-init.json
new file mode 100644
index 0000000000..17582a86e7
--- /dev/null
+++ b/tools/clang-tidy/test/performance-move-constructor-init.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "move constructor initializes base class by calling a copy constructor",
+ "performance-move-constructor-init"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/performance-noexcept-move-constructor.cpp b/tools/clang-tidy/test/performance-noexcept-move-constructor.cpp
new file mode 100644
index 0000000000..8b4900b00d
--- /dev/null
+++ b/tools/clang-tidy/test/performance-noexcept-move-constructor.cpp
@@ -0,0 +1,4 @@
+class A {
+ A(A &&);
+ A &operator=(A &&);
+};
diff --git a/tools/clang-tidy/test/performance-noexcept-move-constructor.json b/tools/clang-tidy/test/performance-noexcept-move-constructor.json
new file mode 100644
index 0000000000..94823b9ed5
--- /dev/null
+++ b/tools/clang-tidy/test/performance-noexcept-move-constructor.json
@@ -0,0 +1,13 @@
+[
+ [
+ "warning",
+ "move constructors should be marked noexcept",
+ "performance-noexcept-move-constructor"
+ ],
+ [
+ "warning",
+ "move assignment operators should be marked noexcept",
+ "performance-noexcept-move-constructor"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/performance-type-promotion-in-math-fn.cpp b/tools/clang-tidy/test/performance-type-promotion-in-math-fn.cpp
new file mode 100644
index 0000000000..9a6fcf9848
--- /dev/null
+++ b/tools/clang-tidy/test/performance-type-promotion-in-math-fn.cpp
@@ -0,0 +1,7 @@
+double acos(double);
+
+void check_all_fns()
+{
+ float a;
+ acos(a);
+}
diff --git a/tools/clang-tidy/test/performance-type-promotion-in-math-fn.json b/tools/clang-tidy/test/performance-type-promotion-in-math-fn.json
new file mode 100644
index 0000000000..577d2ddc91
--- /dev/null
+++ b/tools/clang-tidy/test/performance-type-promotion-in-math-fn.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "call to 'acos' promotes float to double",
+ "performance-type-promotion-in-math-fn"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/performance-unnecessary-copy-initialization.cpp b/tools/clang-tidy/test/performance-unnecessary-copy-initialization.cpp
new file mode 100644
index 0000000000..ca0f591a3e
--- /dev/null
+++ b/tools/clang-tidy/test/performance-unnecessary-copy-initialization.cpp
@@ -0,0 +1,7 @@
+#include "structures.h"
+
+extern const std::string& constReference();
+
+void foo() {
+ const std::string UnnecessaryCopy = constReference();
+}
diff --git a/tools/clang-tidy/test/performance-unnecessary-copy-initialization.json b/tools/clang-tidy/test/performance-unnecessary-copy-initialization.json
new file mode 100644
index 0000000000..fcb16746ed
--- /dev/null
+++ b/tools/clang-tidy/test/performance-unnecessary-copy-initialization.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "the const qualified variable 'UnnecessaryCopy' is copy-constructed from a const reference but is never used; consider removing the statement",
+ "performance-unnecessary-copy-initialization"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/performance-unnecessary-value-param.cpp b/tools/clang-tidy/test/performance-unnecessary-value-param.cpp
new file mode 100644
index 0000000000..ed5f36f7fa
--- /dev/null
+++ b/tools/clang-tidy/test/performance-unnecessary-value-param.cpp
@@ -0,0 +1,4 @@
+#include "structures.h"
+
+void f(const std::string Value) {
+}
diff --git a/tools/clang-tidy/test/performance-unnecessary-value-param.json b/tools/clang-tidy/test/performance-unnecessary-value-param.json
new file mode 100644
index 0000000000..35ed09e4be
--- /dev/null
+++ b/tools/clang-tidy/test/performance-unnecessary-value-param.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "the const qualified parameter 'Value' is copied for each invocation; consider making it a reference",
+ "performance-unnecessary-value-param"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-braces-around-statements.cpp b/tools/clang-tidy/test/readability-braces-around-statements.cpp
new file mode 100644
index 0000000000..ce456ec2e3
--- /dev/null
+++ b/tools/clang-tidy/test/readability-braces-around-statements.cpp
@@ -0,0 +1,38 @@
+
+void do_something(const char *) {}
+
+bool cond(const char *) {
+ return false;
+}
+
+void test() {
+if (cond("if0") /*comment*/) do_something("same-line");
+
+if (cond("if1") /*comment*/)
+ do_something("next-line");
+
+ if (!1) return;
+ if (!2) { return; }
+
+ if (!3)
+ return;
+
+ if (!4) {
+ return;
+ }
+}
+
+void foo() {
+if (1) while (2) if (3) for (;;) do ; while(false) /**/;/**/
+}
+
+void f() {}
+
+void foo2() {
+ constexpr bool a = true;
+ if constexpr (a) {
+ f();
+ } else {
+ f();
+ }
+}
diff --git a/tools/clang-tidy/test/readability-braces-around-statements.json b/tools/clang-tidy/test/readability-braces-around-statements.json
new file mode 100644
index 0000000000..7cc8ae280a
--- /dev/null
+++ b/tools/clang-tidy/test/readability-braces-around-statements.json
@@ -0,0 +1,13 @@
+[
+ [
+ "warning",
+ "statement should be inside braces",
+ "readability-braces-around-statements"
+ ],
+ [
+ "warning",
+ "statement should be inside braces",
+ "readability-braces-around-statements"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-const-return-type.cpp b/tools/clang-tidy/test/readability-const-return-type.cpp
new file mode 100644
index 0000000000..695ed1d83f
--- /dev/null
+++ b/tools/clang-tidy/test/readability-const-return-type.cpp
@@ -0,0 +1,5 @@
+const int p1() {
+// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness
+// CHECK-FIXES: int p1() {
+ return 1;
+}
diff --git a/tools/clang-tidy/test/readability-const-return-type.json b/tools/clang-tidy/test/readability-const-return-type.json
new file mode 100644
index 0000000000..f6c634c0b1
--- /dev/null
+++ b/tools/clang-tidy/test/readability-const-return-type.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "return type 'const int' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness",
+ "readability-const-return-type"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-container-size-empty.cpp b/tools/clang-tidy/test/readability-container-size-empty.cpp
new file mode 100644
index 0000000000..1dcfe68bd7
--- /dev/null
+++ b/tools/clang-tidy/test/readability-container-size-empty.cpp
@@ -0,0 +1,7 @@
+#include "structures.h"
+
+void foo() {
+ std::string a;
+ if (a.size())
+ return;
+}
diff --git a/tools/clang-tidy/test/readability-container-size-empty.json b/tools/clang-tidy/test/readability-container-size-empty.json
new file mode 100644
index 0000000000..8c51b1c039
--- /dev/null
+++ b/tools/clang-tidy/test/readability-container-size-empty.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "the 'empty' method should be used to check for emptiness instead of 'size'",
+ "readability-container-size-empty"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-delete-null-pointer.cpp b/tools/clang-tidy/test/readability-delete-null-pointer.cpp
new file mode 100644
index 0000000000..e083404043
--- /dev/null
+++ b/tools/clang-tidy/test/readability-delete-null-pointer.cpp
@@ -0,0 +1,6 @@
+void func() {
+ int* f = 0;
+ if (f) {
+ delete f;
+ }
+}
diff --git a/tools/clang-tidy/test/readability-delete-null-pointer.json b/tools/clang-tidy/test/readability-delete-null-pointer.json
new file mode 100644
index 0000000000..2a7184cdb1
--- /dev/null
+++ b/tools/clang-tidy/test/readability-delete-null-pointer.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "'if' statement is unnecessary; deleting null pointer has no effect",
+ "readability-delete-null-pointer"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-else-after-return.cpp b/tools/clang-tidy/test/readability-else-after-return.cpp
new file mode 100644
index 0000000000..2c72b68a92
--- /dev/null
+++ b/tools/clang-tidy/test/readability-else-after-return.cpp
@@ -0,0 +1,10 @@
+void f() {
+
+}
+
+void foo() {
+ if (true)
+ return;
+ else
+ f();
+}
diff --git a/tools/clang-tidy/test/readability-else-after-return.json b/tools/clang-tidy/test/readability-else-after-return.json
new file mode 100644
index 0000000000..7d2f8b0adf
--- /dev/null
+++ b/tools/clang-tidy/test/readability-else-after-return.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "do not use 'else' after 'return'",
+ "readability-else-after-return"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-implicit-bool-conversion.cpp b/tools/clang-tidy/test/readability-implicit-bool-conversion.cpp
new file mode 100644
index 0000000000..c30089a126
--- /dev/null
+++ b/tools/clang-tidy/test/readability-implicit-bool-conversion.cpp
@@ -0,0 +1,55 @@
+
+#define MOZ_IMPLICIT __attribute__((annotate("moz_implicit")))
+
+void takesChar(char);
+void takesShort(short);
+void takesInt(int);
+void takesLong(long);
+
+void takesUChar(unsigned char);
+void takesUShort(unsigned short);
+void takesUInt(unsigned int);
+void takesULong(unsigned long);
+
+struct InitializedWithInt {
+ MOZ_IMPLICIT InitializedWithInt(int);
+};
+
+void f() {
+ bool b = true;
+ char s0 = b;
+ short s1 = b;
+ int s2 = b;
+ long s3 = b;
+
+ unsigned char u0 = b;
+ unsigned short u1 = b;
+ unsigned u2 = b;
+ unsigned long u3 = b;
+
+ takesChar(b);
+ takesShort(b);
+ takesInt(b);
+ takesLong(b);
+ takesUChar(b);
+ takesUShort(b);
+ takesUInt(b);
+ takesULong(b);
+
+ InitializedWithInt i = b;
+ (InitializedWithInt(b));
+
+ bool x = b;
+
+ int exp = (int)true;
+
+ if (x == b) {}
+ if (x != b) {}
+
+ if (b == exp) {}
+ if (exp == b) {}
+
+ char* ptr;
+ // Shouldn't trigger a checker warning since we are using AllowPointerConditions
+ if (ptr) {}
+}
diff --git a/tools/clang-tidy/test/readability-implicit-bool-conversion.json b/tools/clang-tidy/test/readability-implicit-bool-conversion.json
new file mode 100644
index 0000000000..b10044f03f
--- /dev/null
+++ b/tools/clang-tidy/test/readability-implicit-bool-conversion.json
@@ -0,0 +1,102 @@
+[
+ [
+ "warning",
+ "implicit conversion bool -> 'char'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'short'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'int'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'long'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'unsigned char'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'unsigned short'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'unsigned int'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'unsigned long'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'char'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'short'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'int'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'long'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'unsigned char'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'unsigned short'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'unsigned int'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'unsigned long'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'int'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'int'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'int'",
+ "readability-implicit-bool-conversion"
+ ],
+ [
+ "warning",
+ "implicit conversion bool -> 'int'",
+ "readability-implicit-bool-conversion"
+ ]
+]
diff --git a/tools/clang-tidy/test/readability-inconsistent-declaration-parameter-name.cpp b/tools/clang-tidy/test/readability-inconsistent-declaration-parameter-name.cpp
new file mode 100644
index 0000000000..acf13b240b
--- /dev/null
+++ b/tools/clang-tidy/test/readability-inconsistent-declaration-parameter-name.cpp
@@ -0,0 +1,6 @@
+struct S {
+ void f(int x);
+};
+
+void S::f(int y) {
+}
diff --git a/tools/clang-tidy/test/readability-inconsistent-declaration-parameter-name.json b/tools/clang-tidy/test/readability-inconsistent-declaration-parameter-name.json
new file mode 100644
index 0000000000..f5e04a1041
--- /dev/null
+++ b/tools/clang-tidy/test/readability-inconsistent-declaration-parameter-name.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "function 'S::f' has a definition with different parameter names",
+ "readability-inconsistent-declaration-parameter-name"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-isolate-declaration.cpp b/tools/clang-tidy/test/readability-isolate-declaration.cpp
new file mode 100644
index 0000000000..5d64e0171f
--- /dev/null
+++ b/tools/clang-tidy/test/readability-isolate-declaration.cpp
@@ -0,0 +1,7 @@
+void f() {
+ int * pointer = nullptr, value = 42, * const const_ptr = &value;
+ // This declaration will be diagnosed and transformed into:
+ // int * pointer = nullptr;
+ // int value = 42;
+ // int * const const_ptr = &value;
+}
diff --git a/tools/clang-tidy/test/readability-isolate-declaration.json b/tools/clang-tidy/test/readability-isolate-declaration.json
new file mode 100644
index 0000000000..3f8ccf52fa
--- /dev/null
+++ b/tools/clang-tidy/test/readability-isolate-declaration.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "multiple declarations in a single statement reduces readability",
+ "readability-isolate-declaration"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-magic-numbers.cpp b/tools/clang-tidy/test/readability-magic-numbers.cpp
new file mode 100644
index 0000000000..430fa17056
--- /dev/null
+++ b/tools/clang-tidy/test/readability-magic-numbers.cpp
@@ -0,0 +1,4 @@
+void func() {
+ int radius = 2;
+ double circleArea = 3.1415926535 * radius * radius;
+}
diff --git a/tools/clang-tidy/test/readability-magic-numbers.json b/tools/clang-tidy/test/readability-magic-numbers.json
new file mode 100644
index 0000000000..ee5d0f204c
--- /dev/null
+++ b/tools/clang-tidy/test/readability-magic-numbers.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "3.1415926535 is a magic number; consider replacing it with a named constant",
+ "readability-magic-numbers"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-misleading-indentation.cpp b/tools/clang-tidy/test/readability-misleading-indentation.cpp
new file mode 100644
index 0000000000..8b23010170
--- /dev/null
+++ b/tools/clang-tidy/test/readability-misleading-indentation.cpp
@@ -0,0 +1,20 @@
+void f()
+{
+}
+
+void foo() {
+ if (1)
+ if (0)
+ f();
+ else
+ f();
+}
+
+void foo2() {
+ constexpr bool a = true;
+ if constexpr (a) {
+ f();
+ } else {
+ f();
+ }
+}
diff --git a/tools/clang-tidy/test/readability-misleading-indentation.json b/tools/clang-tidy/test/readability-misleading-indentation.json
new file mode 100644
index 0000000000..9ef6d30c45
--- /dev/null
+++ b/tools/clang-tidy/test/readability-misleading-indentation.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "different indentation for 'if' and corresponding 'else'",
+ "readability-misleading-indentation"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-non-const-parameter.cpp b/tools/clang-tidy/test/readability-non-const-parameter.cpp
new file mode 100644
index 0000000000..5a0ffd0e30
--- /dev/null
+++ b/tools/clang-tidy/test/readability-non-const-parameter.cpp
@@ -0,0 +1,5 @@
+void warn1(int *first, int *last) {
+ *first = 0;
+ if (first < last) {
+ }
+}
diff --git a/tools/clang-tidy/test/readability-non-const-parameter.json b/tools/clang-tidy/test/readability-non-const-parameter.json
new file mode 100644
index 0000000000..fb83ec8572
--- /dev/null
+++ b/tools/clang-tidy/test/readability-non-const-parameter.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "pointer parameter 'last' can be pointer to const",
+ "readability-non-const-parameter"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-qualified-auto.cpp b/tools/clang-tidy/test/readability-qualified-auto.cpp
new file mode 100644
index 0000000000..03c5164e2c
--- /dev/null
+++ b/tools/clang-tidy/test/readability-qualified-auto.cpp
@@ -0,0 +1,6 @@
+typedef int *MyPtr;
+MyPtr getPtr();
+
+void foo() {
+ auto TdNakedPtr = getPtr();
+}
diff --git a/tools/clang-tidy/test/readability-qualified-auto.json b/tools/clang-tidy/test/readability-qualified-auto.json
new file mode 100644
index 0000000000..eaf0a176cf
--- /dev/null
+++ b/tools/clang-tidy/test/readability-qualified-auto.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "'auto TdNakedPtr' can be declared as 'auto *TdNakedPtr'",
+ "readability-qualified-auto"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-redundant-control-flow.cpp b/tools/clang-tidy/test/readability-redundant-control-flow.cpp
new file mode 100644
index 0000000000..d221715542
--- /dev/null
+++ b/tools/clang-tidy/test/readability-redundant-control-flow.cpp
@@ -0,0 +1,5 @@
+extern void g();
+void f() {
+ g();
+ return;
+}
diff --git a/tools/clang-tidy/test/readability-redundant-control-flow.json b/tools/clang-tidy/test/readability-redundant-control-flow.json
new file mode 100644
index 0000000000..efedaf1009
--- /dev/null
+++ b/tools/clang-tidy/test/readability-redundant-control-flow.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "redundant return statement at the end of a function with a void return type",
+ "readability-redundant-control-flow"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-redundant-preprocessor.cpp b/tools/clang-tidy/test/readability-redundant-preprocessor.cpp
new file mode 100644
index 0000000000..317905dab8
--- /dev/null
+++ b/tools/clang-tidy/test/readability-redundant-preprocessor.cpp
@@ -0,0 +1,5 @@
+#ifndef FOO
+#ifdef FOO // inner ifdef is considered redundant
+void f();
+#endif
+#endif
diff --git a/tools/clang-tidy/test/readability-redundant-preprocessor.json b/tools/clang-tidy/test/readability-redundant-preprocessor.json
new file mode 100644
index 0000000000..e3b7fb4ce1
--- /dev/null
+++ b/tools/clang-tidy/test/readability-redundant-preprocessor.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "nested redundant #ifdef; consider removing it",
+ "readability-redundant-preprocessor"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-redundant-smartptr-get.cpp b/tools/clang-tidy/test/readability-redundant-smartptr-get.cpp
new file mode 100644
index 0000000000..66eb8d6c37
--- /dev/null
+++ b/tools/clang-tidy/test/readability-redundant-smartptr-get.cpp
@@ -0,0 +1,19 @@
+#define NULL __null
+
+namespace std {
+
+template <typename T>
+struct unique_ptr {
+ T& operator*() const;
+ T* operator->() const;
+ T* get() const;
+ explicit operator bool() const noexcept;
+};
+}
+
+struct A {
+};
+
+void foo() {
+ A& b2 = *std::unique_ptr<A>().get();
+}
diff --git a/tools/clang-tidy/test/readability-redundant-smartptr-get.json b/tools/clang-tidy/test/readability-redundant-smartptr-get.json
new file mode 100644
index 0000000000..c5f06cbc21
--- /dev/null
+++ b/tools/clang-tidy/test/readability-redundant-smartptr-get.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "redundant get() call on smart pointer",
+ "readability-redundant-smartptr-get"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-redundant-string-cstr.cpp b/tools/clang-tidy/test/readability-redundant-string-cstr.cpp
new file mode 100644
index 0000000000..d35a2998e5
--- /dev/null
+++ b/tools/clang-tidy/test/readability-redundant-string-cstr.cpp
@@ -0,0 +1,7 @@
+#include "structures.h"
+
+void foo() {
+ std::string a = "Mozilla";
+ std::string tmp;
+ tmp.assign(a.c_str());
+}
diff --git a/tools/clang-tidy/test/readability-redundant-string-cstr.json b/tools/clang-tidy/test/readability-redundant-string-cstr.json
new file mode 100644
index 0000000000..cce79a38a2
--- /dev/null
+++ b/tools/clang-tidy/test/readability-redundant-string-cstr.json
@@ -0,0 +1,4 @@
+[
+ ["warning", "redundant call to 'c_str'", "readability-redundant-string-cstr"],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-redundant-string-init.cpp b/tools/clang-tidy/test/readability-redundant-string-init.cpp
new file mode 100644
index 0000000000..39bae4bd56
--- /dev/null
+++ b/tools/clang-tidy/test/readability-redundant-string-init.cpp
@@ -0,0 +1,5 @@
+#include "structures.h"
+
+int foo() {
+ std::string a = "";
+}
diff --git a/tools/clang-tidy/test/readability-redundant-string-init.json b/tools/clang-tidy/test/readability-redundant-string-init.json
new file mode 100644
index 0000000000..3092808205
--- /dev/null
+++ b/tools/clang-tidy/test/readability-redundant-string-init.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "redundant string initialization",
+ "readability-redundant-string-init"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-simplify-boolean-expr.cpp b/tools/clang-tidy/test/readability-simplify-boolean-expr.cpp
new file mode 100644
index 0000000000..277a469880
--- /dev/null
+++ b/tools/clang-tidy/test/readability-simplify-boolean-expr.cpp
@@ -0,0 +1,2 @@
+bool a1 = false;
+bool aa = false == a1;
diff --git a/tools/clang-tidy/test/readability-simplify-boolean-expr.json b/tools/clang-tidy/test/readability-simplify-boolean-expr.json
new file mode 100644
index 0000000000..45eb9e1a66
--- /dev/null
+++ b/tools/clang-tidy/test/readability-simplify-boolean-expr.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "redundant boolean literal supplied to boolean operator",
+ "readability-simplify-boolean-expr"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-static-accessed-through-instance.cpp b/tools/clang-tidy/test/readability-static-accessed-through-instance.cpp
new file mode 100644
index 0000000000..95f13b994c
--- /dev/null
+++ b/tools/clang-tidy/test/readability-static-accessed-through-instance.cpp
@@ -0,0 +1,11 @@
+struct C {
+ static int x;
+};
+
+int C::x = 0;
+
+// Expressions with side effects
+C &f(int, int, int, int);
+void g() {
+ f(1, 2, 3, 4).x;
+}
diff --git a/tools/clang-tidy/test/readability-static-accessed-through-instance.json b/tools/clang-tidy/test/readability-static-accessed-through-instance.json
new file mode 100644
index 0000000000..67c84c188b
--- /dev/null
+++ b/tools/clang-tidy/test/readability-static-accessed-through-instance.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "static member accessed through instance",
+ "readability-static-accessed-through-instance"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/readability-uniqueptr-delete-release.cpp b/tools/clang-tidy/test/readability-uniqueptr-delete-release.cpp
new file mode 100644
index 0000000000..4fce9cde4e
--- /dev/null
+++ b/tools/clang-tidy/test/readability-uniqueptr-delete-release.cpp
@@ -0,0 +1,6 @@
+#include "structures.h"
+
+int foo() {
+ std::unique_ptr<int> P;
+ delete P.release();
+}
diff --git a/tools/clang-tidy/test/readability-uniqueptr-delete-release.json b/tools/clang-tidy/test/readability-uniqueptr-delete-release.json
new file mode 100644
index 0000000000..79330346e1
--- /dev/null
+++ b/tools/clang-tidy/test/readability-uniqueptr-delete-release.json
@@ -0,0 +1,8 @@
+[
+ [
+ "warning",
+ "prefer '= nullptr' to reset 'unique_ptr<>' objects",
+ "readability-uniqueptr-delete-release"
+ ],
+ { "reliability": "high" }
+]
diff --git a/tools/clang-tidy/test/structures.h b/tools/clang-tidy/test/structures.h
new file mode 100644
index 0000000000..0966109635
--- /dev/null
+++ b/tools/clang-tidy/test/structures.h
@@ -0,0 +1,108 @@
+// Proxy file in order to define generic data types, to avoid binding with system headers
+
+typedef __SIZE_TYPE__ size_t;
+
+namespace std {
+
+typedef size_t size_t;
+
+template <class T>
+class vector {
+ public:
+ typedef T* iterator;
+ typedef const T* const_iterator;
+ typedef T& reference;
+ typedef const T& const_reference;
+ typedef size_t size_type;
+
+ explicit vector();
+ explicit vector(size_type n);
+
+ void swap(vector &other);
+ void push_back(const T& val);
+
+ template <class... Args> void emplace_back(Args &&... args);
+
+ void reserve(size_t n);
+ void resize(size_t n);
+
+ size_t size();
+ const_reference operator[] (size_type) const;
+ reference operator[] (size_type);
+
+ const_iterator begin() const;
+ const_iterator end() const;
+};
+
+template <typename T>
+class basic_string {
+public:
+ typedef basic_string<T> _Type;
+ basic_string() {}
+ basic_string(const T *p);
+ basic_string(const T *p, size_t count);
+ basic_string(size_t count, char ch);
+ ~basic_string() {}
+ size_t size() const;
+ bool empty() const;
+ size_t find (const char* s, size_t pos = 0) const;
+ const T *c_str() const;
+ _Type& assign(const T *s);
+ basic_string<T> &operator=(T ch);
+ basic_string<T> *operator+=(const basic_string<T> &) {}
+ friend basic_string<T> operator+(const basic_string<T> &, const basic_string<T> &) {}
+};
+typedef basic_string<char> string;
+typedef basic_string<wchar_t> wstring;
+
+string to_string(int value);
+
+template <typename T>
+struct default_delete {};
+
+template <typename T, typename D = default_delete<T>>
+class unique_ptr {
+ public:
+ unique_ptr();
+ ~unique_ptr();
+ explicit unique_ptr(T*);
+ template <typename U, typename E>
+ unique_ptr(unique_ptr<U, E>&&);
+ T* release();
+};
+
+template <class Fp, class... Arguments>
+class bind_rt {};
+
+template <class Fp, class... Arguments>
+bind_rt<Fp, Arguments...> bind(Fp &&, Arguments &&...);
+}
+
+typedef unsigned int uid_t;
+typedef unsigned int pid_t;
+
+int bcmp(void *, void *, size_t);
+void bcopy(void *, void *, size_t);
+void bzero(void *, size_t);
+
+int getpw(uid_t uid, char *buf);
+int setuid(uid_t uid);
+
+int mkstemp(char *tmpl);
+char *mktemp(char *tmpl);
+
+pid_t vfork(void);
+
+int abort() { return 0; }
+
+#define assert(x) \
+ if (!(x)) \
+ (void)abort()
+
+size_t strlen(const char *s);
+char *strncat(char *s1, const char *s2, size_t);
+
+void free(void *ptr);
+void *malloc(size_t size);
+
+void *memset(void *b, int c, size_t len);