You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
change-namespace
clang-apply-replacements
clang-move
clang-query
clang-reorder-fields
clang-tidy
clang-tidy-vs
clangd
docs
include-fixer
modularize
pp-trace
test
Unit
change-namespace
clang-apply-replacements
clang-move
clang-query
clang-reorder-fields
clang-tidy
Inputs
android-cloexec-accept.cpp
android-cloexec-accept4.cpp
android-cloexec-creat.cpp
android-cloexec-dup.cpp
android-cloexec-epoll-create.cpp
android-cloexec-epoll-create1.cpp
android-cloexec-fopen.cpp
android-cloexec-inotify-init.cpp
android-cloexec-inotify-init1.cpp
android-cloexec-memfd-create.cpp
android-cloexec-open.cpp
android-cloexec-socket.cpp
basic.cpp
boost-use-to-string.cpp
bugprone-argument-comment-gmock.cpp
bugprone-argument-comment-strict.cpp
bugprone-argument-comment.cpp
bugprone-assert-side-effect.cpp
bugprone-bool-pointer-implicit-conversion.cpp
bugprone-copy-constructor-init.cpp
bugprone-dangling-handle.cpp
bugprone-fold-init-type.cpp
bugprone-forward-declaration-namespace.cpp
bugprone-inaccurate-erase.cpp
bugprone-integer-division.cpp
bugprone-misplaced-operator-in-strlen-in-alloc.c
bugprone-misplaced-operator-in-strlen-in-alloc.cpp
bugprone-move-forwarding-reference.cpp
bugprone-multiple-statement-macro.cpp
bugprone-string-constructor.cpp
bugprone-suspicious-memset-usage.cpp
bugprone-undefined-memory-manipulation.cpp
bugprone-use-after-move.cpp
bugprone-virtual-near-miss.cpp
cert-dcl21-cpp.cpp
cert-dcl58-cpp.cpp
cert-env33-c.c
cert-err34-c.c
cert-err34-c.cpp
cert-flp30-c.c
cert-limited-randomness.c
cert-limited-randomness.cpp
cert-oop11-cpp.cpp
cert-setlongjmp.cpp
cert-static-object-exception.cpp
cert-throw-exception-type.cpp
cert-variadic-function-def.cpp
check_clang_tidy.py
clang-tidy-diff.cpp
clang-tidy-run-with-database.cpp
clean-up-code.cpp
config-files.cpp
cppcoreguidelines-interfaces-global-init.cpp
cppcoreguidelines-no-malloc-custom.cpp
cppcoreguidelines-no-malloc-no-functions.cpp
cppcoreguidelines-no-malloc.cpp
cppcoreguidelines-owning-memory-containers.cpp
cppcoreguidelines-owning-memory-legacy-functions.cpp
cppcoreguidelines-owning-memory.cpp
cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp
cppcoreguidelines-pro-bounds-constant-array-index-c++03.cpp
cppcoreguidelines-pro-bounds-constant-array-index-gslheader.cpp
cppcoreguidelines-pro-bounds-constant-array-index.cpp
cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp
cppcoreguidelines-pro-type-const-cast.cpp
cppcoreguidelines-pro-type-cstyle-cast.cpp
cppcoreguidelines-pro-type-member-init-cxx98.cpp
cppcoreguidelines-pro-type-member-init-delayed.cpp
cppcoreguidelines-pro-type-member-init.cpp
cppcoreguidelines-pro-type-reinterpret-cast.cpp
cppcoreguidelines-pro-type-static-cast-downcast.cpp
cppcoreguidelines-pro-type-union-access.cpp
cppcoreguidelines-pro-type-vararg.cpp
cppcoreguidelines-slicing.cpp
cppcoreguidelines-special-member-functions-cxx-03.cpp
cppcoreguidelines-special-member-functions-relaxed.cpp
cppcoreguidelines-special-member-functions.cpp
custom-diagnostics.cpp
deduplication.cpp
diagnostic.cpp
explain-checks.cpp
extra-args.cpp
file-filter.cpp
fix-errors.cpp
fix.cpp
fuchsia-default-arguments.cpp
fuchsia-overloaded-operator.cpp
fuchsia-virtual-inheritance.cpp
google-build-explicit-make-pair.cpp
google-default-arguments.cpp
google-explicit-constructor.cpp
google-module.cpp
google-namespaces.cpp
google-objc-avoid-throwing-exception.m
google-objc-global-variable-declaration.m
google-overloaded-unary-and.cpp
google-readability-casting.c
google-readability-casting.cpp
google-readability-namespace-comments.cpp
google-readability-todo.cpp
google-runtime-int-std.cpp
google-runtime-int.c
google-runtime-int.cpp
google-runtime-member-string-references.cpp
google-runtime-references.cpp
hicpp-exception-baseclass.cpp
hicpp-no-assembler-msvc.cpp
hicpp-no-assembler.cpp
hicpp-signed-bitwise-bug34747.cpp
hicpp-signed-bitwise-standard-types.cpp
hicpp-signed-bitwise-standard-types.h
hicpp-signed-bitwise.cpp
line-filter.cpp
list-checks.cpp
llvm-include-order.cpp
llvm-twine-local.cpp
macros.cpp
misc-definitions-in-headers-1z.hpp
misc-definitions-in-headers.hpp
misc-forwarding-reference-overload.cpp
misc-incorrect-roundings.cpp
misc-lambda-function-name.cpp
misc-macro-parentheses-cmdline.cpp
misc-macro-parentheses.cpp
misc-macro-repeated-side-effects.c
misc-misplaced-const.c
misc-misplaced-const.cpp
misc-misplaced-widening-cast-explicit-only.cpp
misc-misplaced-widening-cast-implicit-enabled.cpp
misc-new-delete-overloads-sized-dealloc.cpp
misc-new-delete-overloads.cpp
misc-non-copyable-objects.c
misc-non-copyable-objects.cpp
misc-redundant-expression.cpp
misc-sizeof-container.cpp
misc-sizeof-expression.cpp
misc-static-assert.c
misc-static-assert.cpp
misc-string-compare.cpp
misc-string-integer-assignment.cpp
misc-string-literal-with-embedded-nul.cpp
misc-suspicious-enum-usage-strict.cpp
misc-suspicious-enum-usage.cpp
misc-suspicious-missing-comma.cpp
misc-suspicious-semicolon-fail.cpp
misc-suspicious-semicolon.cpp
misc-suspicious-string-compare.c
misc-suspicious-string-compare.cpp
misc-swapped-arguments.cpp
misc-throw-by-value-catch-by-reference.cpp
misc-unconventional-assign-operator.cpp
misc-undelegated-constructor-cxx98.cpp
misc-undelegated-constructor.cpp
misc-uniqueptr-reset-release.cpp
misc-unused-alias-decls.cpp
misc-unused-parameters.c
misc-unused-parameters.cpp
misc-unused-raii.cpp
misc-unused-using-decls-errors.cpp
misc-unused-using-decls.cpp
modernize-avoid-bind.cpp
modernize-deprecated-headers-cxx03.cpp
modernize-deprecated-headers-cxx11.cpp
modernize-loop-convert-assert-failure.cpp
modernize-loop-convert-basic.cpp
modernize-loop-convert-camelback.cpp
modernize-loop-convert-const.cpp
modernize-loop-convert-extra.cpp
modernize-loop-convert-lowercase.cpp
modernize-loop-convert-negative.cpp
modernize-loop-convert-uppercase.cpp
modernize-loop-convert.c
modernize-make-shared-header.cpp
modernize-make-shared.cpp
modernize-make-unique-header.cpp
modernize-make-unique-macros.cpp
modernize-make-unique.cpp
modernize-pass-by-value-header.cpp
modernize-pass-by-value-macro-header.cpp
modernize-pass-by-value-multi-fixes.cpp
modernize-pass-by-value.cpp
modernize-raw-string-literal-delimiter.cpp
modernize-raw-string-literal-replace-shorter.cpp
modernize-raw-string-literal.cpp
modernize-redundant-void-arg-delayed.cpp
modernize-redundant-void-arg.c
modernize-redundant-void-arg.cpp
modernize-replace-auto-ptr.cpp
modernize-replace-random-shuffle.cpp
modernize-return-braced-init-list.cpp
modernize-shrink-to-fit.cpp
modernize-unary-static-assert.cpp
modernize-use-auto-cast-remove-stars.cpp
modernize-use-auto-cast.cpp
modernize-use-auto-iterator.cpp
modernize-use-auto-new-remove-stars.cpp
modernize-use-auto-new.cpp
modernize-use-bool-literals-ignore-macros.cpp
modernize-use-bool-literals.cpp
modernize-use-default-member-init-assignment.cpp
modernize-use-default-member-init-macros.cpp
modernize-use-default-member-init.cpp
modernize-use-emplace-ignore-implicit-constructors.cpp
modernize-use-emplace.cpp
modernize-use-equals-default-copy.cpp
modernize-use-equals-default-delayed.cpp
modernize-use-equals-default-macros.cpp
modernize-use-equals-default.cpp
modernize-use-equals-delete.cpp
modernize-use-noexcept-macro.cpp
modernize-use-noexcept-opt.cpp
modernize-use-noexcept.cpp
modernize-use-nullptr-basic.cpp
modernize-use-nullptr.c
modernize-use-nullptr.cpp
modernize-use-override-cxx98.cpp
modernize-use-override-ms.cpp
modernize-use-override.cpp
modernize-use-transparent-functors.cpp
modernize-use-using-macros.cpp
modernize-use-using.cpp
mpi-buffer-deref.cpp
mpi-type-mismatch.cpp
nolint.cpp
nolintnextline.cpp
nonstandard-file-extension.test
objc-arc-and-properties.m
objc-avoid-nserror-init.m
objc-avoid-spinlock.m
objc-forbidden-subclassing-custom.m
objc-forbidden-subclassing.m
objc-no-arc-or-properties.m
objc-property-declaration-custom.m
objc-property-declaration.m
overlapping.cpp
performance-faster-string-find.cpp
performance-for-range-copy-warn-on-all-auto-copies.cpp
performance-for-range-copy.cpp
performance-implicit-conversion-in-loop.cpp
performance-inefficient-algorithm.cpp
performance-inefficient-string-concatenation.cpp
performance-inefficient-vector-operation.cpp
performance-move-const-arg-trivially-copyable.cpp
performance-move-const-arg.cpp
performance-move-constructor-init.cpp
performance-noexcept-move-constructor.cpp
performance-type-promotion-in-math-fn.cpp
performance-unnecessary-copy-initialization.cpp
performance-unnecessary-value-param-delayed.cpp
performance-unnecessary-value-param-header.cpp
performance-unnecessary-value-param-incomplete-type.cpp
performance-unnecessary-value-param.cpp
readability-avoid-const-params-in-decls.cpp
readability-braces-around-statements-assert-failure.cpp
readability-braces-around-statements-few-lines.cpp
readability-braces-around-statements-format.cpp
readability-braces-around-statements-same-line.cpp
readability-braces-around-statements-single-line.cpp
readability-braces-around-statements.cpp
readability-container-size-empty.cpp
readability-delete-null-pointer.cpp
readability-deleted-default.cpp
readability-else-after-return.cpp
readability-function-size.cpp
readability-identifier-naming.cpp
readability-implicit-bool-conversion-allow-in-conditions.cpp
readability-implicit-bool-conversion-cxx98.cpp
readability-implicit-bool-conversion.cpp
readability-inconsistent-declaration-parameter-name.cpp
readability-misleading-indentation.cpp
readability-misplaced-array-index.cpp
readability-named-parameter.cpp
readability-non-const-parameter.cpp
readability-redundant-control-flow.cpp
readability-redundant-declaration-ignore-macros.cpp
readability-redundant-declaration.cpp
readability-redundant-function-ptr-dereference.cpp
readability-redundant-member-init.cpp
readability-redundant-smartptr-get.cpp
readability-redundant-string-cstr-msvc.cpp
readability-redundant-string-cstr.cpp
readability-redundant-string-init-msvc.cpp
readability-redundant-string-init.cpp
readability-simplify-bool-expr-chained-conditional-assignment.cpp
readability-simplify-bool-expr-chained-conditional-return.cpp
readability-simplify-bool-expr.cpp
readability-static-accessed-through-instance-nesting-threshold.cpp
readability-static-accessed-through-instance.cpp
readability-static-definition-in-anonymous-namespace.cpp
readability-uniqueptr-delete-release.cpp
select-checks.cpp
serialize-diagnostics.cpp
static-analyzer-config.cpp
static-analyzer.cpp
temporaries.cpp
validate-check-names.cpp
werrors-diagnostics.cpp
werrors-plural.cpp
werrors.cpp
clangd
include-fixer
modularize
pp-trace
.clang-format
CMakeLists.txt
lit.cfg
lit.site.cfg.in
tool-template
unittests
.arcconfig
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
LICENSE.TXT
README.txt
compiler-rt
eng
libcxx
libcxxabi
libunwind
lld
lldb
llvm
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
189 lines
4.5 KiB
C++
189 lines
4.5 KiB
C++
// RUN: %check_clang_tidy %s bugprone-copy-constructor-init %t
|
|
|
|
class NonCopyable {
|
|
public:
|
|
NonCopyable() = default;
|
|
NonCopyable(const NonCopyable &) = delete;
|
|
|
|
private:
|
|
int a;
|
|
};
|
|
|
|
class NonCopyable2 {
|
|
public:
|
|
NonCopyable2() = default;
|
|
|
|
private:
|
|
NonCopyable2(const NonCopyable2 &);
|
|
int a;
|
|
};
|
|
|
|
class Copyable {
|
|
public:
|
|
Copyable() = default;
|
|
Copyable(const Copyable &) = default;
|
|
|
|
private:
|
|
int a;
|
|
};
|
|
|
|
class Copyable2 {
|
|
public:
|
|
Copyable2() = default;
|
|
Copyable2(const Copyable2 &) = default;
|
|
|
|
private:
|
|
int a;
|
|
};
|
|
|
|
class Copyable3 : public Copyable {
|
|
public:
|
|
Copyable3() = default;
|
|
Copyable3(const Copyable3 &) = default;
|
|
};
|
|
|
|
template <class C>
|
|
class Copyable4 {
|
|
public:
|
|
Copyable4() = default;
|
|
Copyable4(const Copyable4 &) = default;
|
|
|
|
private:
|
|
int a;
|
|
};
|
|
|
|
template <class T, class S>
|
|
class Copyable5 {
|
|
public:
|
|
Copyable5() = default;
|
|
Copyable5(const Copyable5 &) = default;
|
|
|
|
private:
|
|
int a;
|
|
};
|
|
|
|
class EmptyCopyable {
|
|
public:
|
|
EmptyCopyable() = default;
|
|
EmptyCopyable(const EmptyCopyable &) = default;
|
|
};
|
|
|
|
template <typename T>
|
|
using CopyableAlias = Copyable5<T, int>;
|
|
|
|
typedef Copyable5<int, int> CopyableAlias2;
|
|
|
|
class X : public Copyable, public EmptyCopyable {
|
|
X(const X &other) : Copyable(other) {}
|
|
};
|
|
|
|
class X2 : public Copyable2 {
|
|
X2(const X2 &other) {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor other than the copy constructor [bugprone-copy-constructor-init]
|
|
// CHECK-FIXES: X2(const X2 &other) : Copyable2(other) {}
|
|
};
|
|
|
|
class X2_A : public Copyable2 {
|
|
X2_A(const X2_A &) {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
|
|
// CHECK-FIXES: X2_A(const X2_A &) {}
|
|
};
|
|
|
|
class X3 : public Copyable, public Copyable2 {
|
|
X3(const X3 &other) : Copyable(other) {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
|
|
// CHECK-FIXES: X3(const X3 &other) : Copyable(other) {}
|
|
};
|
|
|
|
class X4 : public Copyable {
|
|
X4(const X4 &other) : Copyable() {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
|
|
// CHECK-FIXES: X4(const X4 &other) : Copyable(other) {}
|
|
};
|
|
|
|
class X5 : public Copyable3 {
|
|
X5(const X5 &other) {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
|
|
// CHECK-FIXES: X5(const X5 &other) : Copyable3(other) {}
|
|
};
|
|
|
|
class X6 : public Copyable2, public Copyable3 {
|
|
X6(const X6 &other) {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
|
|
// CHECK-FIXES: X6(const X6 &other) : Copyable2(other), Copyable3(other) {}
|
|
};
|
|
|
|
class X7 : public Copyable, public Copyable2 {
|
|
X7(const X7 &other) : Copyable() {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
|
|
// CHECK-FIXES: X7(const X7 &other) : Copyable(other) {}
|
|
};
|
|
|
|
class X8 : public Copyable4<int> {
|
|
X8(const X8 &other) : Copyable4(other) {}
|
|
};
|
|
|
|
class X9 : public Copyable4<int> {
|
|
X9(const X9 &other) : Copyable4() {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
|
|
// CHECK-FIXES: X9(const X9 &other) : Copyable4(other) {}
|
|
};
|
|
|
|
class X10 : public Copyable4<int> {
|
|
X10(const X10 &other) {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
|
|
// CHECK-FIXES: X10(const X10 &other) : Copyable4(other) {}
|
|
};
|
|
|
|
class X11 : public Copyable5<int, float> {
|
|
X11(const X11 &other) {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
|
|
// CHECK-FIXES: X11(const X11 &other) : Copyable5(other) {}
|
|
};
|
|
|
|
class X12 : public CopyableAlias<float> {
|
|
X12(const X12 &other) {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
|
|
// CHECK-FIXES: X12(const X12 &other) {}
|
|
};
|
|
|
|
template <typename T>
|
|
class X13 : T {
|
|
X13(const X13 &other) {}
|
|
};
|
|
|
|
template class X13<EmptyCopyable>;
|
|
template class X13<Copyable>;
|
|
|
|
#define FROMMACRO \
|
|
class X14 : public Copyable2 { \
|
|
X14(const X14 &other) {} \
|
|
};
|
|
|
|
FROMMACRO
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: calling a base constructor
|
|
|
|
class X15 : public CopyableAlias2 {
|
|
X15(const X15 &other) {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
|
|
// CHECK-FIXES: X15(const X15 &other) {}
|
|
};
|
|
|
|
class X16 : public NonCopyable {
|
|
X16(const X16 &other) {}
|
|
};
|
|
|
|
class X17 : public NonCopyable2 {
|
|
X17(const X17 &other) {}
|
|
};
|
|
|
|
class X18 : private Copyable {
|
|
X18(const X18 &other) {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: calling a base constructor
|
|
// CHECK-FIXES: X18(const X18 &other) : Copyable(other) {}
|
|
};
|
|
|
|
class X19 : private Copyable {
|
|
X19(const X19 &other) : Copyable(other) {}
|
|
};
|