Author: Sirraide Date: 2025-02-20T20:02:05+01:00 New Revision: 624bd5c40f81a9ece34f65dfdc639621daeaaac9
URL: https://github.com/llvm/llvm-project/commit/624bd5c40f81a9ece34f65dfdc639621daeaaac9 DIFF: https://github.com/llvm/llvm-project/commit/624bd5c40f81a9ece34f65dfdc639621daeaaac9.diff LOG: Revert "[Clang] [NFC] Fix more `-Wreturn-type` warnings in tests everywhere (…" This reverts commit b0210fee94bc29a507f900da1fb97f0e50ab2637. Added: Modified: clang-tools-extra/clangd/unittests/ASTTests.cpp clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp clang-tools-extra/clangd/unittests/ParsedASTTests.cpp clang-tools-extra/clangd/unittests/QualityTests.cpp clang-tools-extra/clangd/unittests/RenameTests.cpp clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp clang-tools-extra/clangd/unittests/SymbolInfoTests.cpp clang-tools-extra/clangd/unittests/XRefsTests.cpp clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp clang-tools-extra/clangd/unittests/tweaks/ExpandDeducedTypeTests.cpp clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/strings/internal-file.h clang-tools-extra/test/clang-tidy/checkers/boost/use-to-string.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-rethrow.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone/fold-init-type.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone/inc-dec-in-conditions-bitint-no-crash.c clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.c clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone/stringview-nullptr.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-string-compare.cpp clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp clang-tools-extra/test/clang-tidy/checkers/fuchsia/multiple-inheritance.cpp clang-tools-extra/test/clang-tidy/checkers/google/runtime-int-std.cpp clang-tools-extra/test/clang-tidy/checkers/google/upgrade-googletest-case.cpp clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-transform-values.cpp clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-values.cpp clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.cpp clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-auto/containers.h clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-bind.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-c++20.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-main.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-three-arg-main.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/loop-convert-basic.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format.cpp clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type.cpp clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header-fixed.h clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header.h clang-tools-extra/test/clang-tidy/checkers/performance/inefficient-string-concatenation.cpp clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-header.cpp clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style1/header.h clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style2/header.h clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type-macros.cpp clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp clang-tools-extra/test/clang-tidy/checkers/readability/convert-member-functions-to-static.cpp clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.c clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.cpp clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp clang-tools-extra/test/clang-tidy/infrastructure/duplicate-fixes-of-alias-checkers.cpp clang/test/CodeGen/armv7k-abi.c clang/test/CodeGenOpenCL/atomics-cas-remarks-gfx90a.cl compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c compiler-rt/test/ubsan/TestCases/Misc/Posix/diag-stacktrace.cpp compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/unittests/ASTTests.cpp b/clang-tools-extra/clangd/unittests/ASTTests.cpp index d0bc3c4d7db98..32c8e8a63a215 100644 --- a/clang-tools-extra/clangd/unittests/ASTTests.cpp +++ b/clang-tools-extra/clangd/unittests/ASTTests.cpp @@ -329,7 +329,7 @@ TEST(ClangdAST, GetContainedAutoParamType) { auto &&d, auto *&e, auto (*f)(int) - ){ return 0; }; + ){}; int withoutAuto( int a, @@ -338,7 +338,7 @@ TEST(ClangdAST, GetContainedAutoParamType) { int &&d, int *&e, int (*f)(int) - ){ return 0; }; + ){}; )cpp"); TU.ExtraArgs.push_back("-std=c++20"); auto AST = TU.build(); diff --git a/clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp b/clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp index 282859c51a66f..4276a44275f53 100644 --- a/clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp +++ b/clang-tools-extra/clangd/unittests/FindSymbolsTests.cpp @@ -113,7 +113,7 @@ TEST(WorkspaceSymbols, Unnamed) { TEST(WorkspaceSymbols, InMainFile) { TestTU TU; TU.Code = R"cpp( - int test() { return 0; } + int test() {} static void test2() {} )cpp"; EXPECT_THAT(getSymbols(TU, "test"), @@ -537,14 +537,12 @@ TEST(DocumentSymbols, InHeaderFile) { TestTU TU; TU.AdditionalFiles["bar.h"] = R"cpp( int foo() { - return 0; } )cpp"; TU.Code = R"cpp( int i; // declaration to finish preamble #include "bar.h" int test() { - return 0; } )cpp"; EXPECT_THAT(getSymbols(TU.build()), @@ -782,7 +780,7 @@ TEST(DocumentSymbols, FuncTemplates) { TestTU TU; Annotations Source(R"cpp( template <class T> - T foo() { return T{}; } + T foo() {} auto x = foo<int>(); auto y = foo<double>(); diff --git a/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp b/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp index f9752d5d44f97..6ee641caeefe3 100644 --- a/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp +++ b/clang-tools-extra/clangd/unittests/ParsedASTTests.cpp @@ -251,7 +251,7 @@ TEST(ParsedASTTest, NoCrashOnTokensWithTidyCheck) { // this check runs the preprocessor, we need to make sure it does not break // our recording logic. TU.ClangTidyProvider = addTidyChecks("modernize-use-trailing-return-type"); - TU.Code = "inline int foo() { return 0; }"; + TU.Code = "inline int foo() {}"; auto AST = TU.build(); const syntax::TokenBuffer &T = AST.getTokens(); diff --git a/clang-tools-extra/clangd/unittests/QualityTests.cpp b/clang-tools-extra/clangd/unittests/QualityTests.cpp index 619ea32115357..576779fa3270a 100644 --- a/clang-tools-extra/clangd/unittests/QualityTests.cpp +++ b/clang-tools-extra/clangd/unittests/QualityTests.cpp @@ -108,7 +108,7 @@ TEST(QualityTests, SymbolRelevanceSignalExtraction) { using flags::FLAGS_FOO; - int ::header_main() { return 0; } + int ::header_main() {} int main(); [[deprecated]] diff --git a/clang-tools-extra/clangd/unittests/RenameTests.cpp b/clang-tools-extra/clangd/unittests/RenameTests.cpp index 15866f43affa0..142ed171d1a1c 100644 --- a/clang-tools-extra/clangd/unittests/RenameTests.cpp +++ b/clang-tools-extra/clangd/unittests/RenameTests.cpp @@ -214,7 +214,7 @@ TEST(RenameTest, WithinFileRename) { template<typename T> class Foo { public: - static T [[f^oo]]() { return T(); } + static T [[f^oo]]() {} }; void bar() { @@ -225,7 +225,7 @@ TEST(RenameTest, WithinFileRename) { template<typename T> class Foo { public: - T [[f^oo]]() { return T(); } + T [[f^oo]]() {} }; void bar() { @@ -827,7 +827,7 @@ TEST(RenameTest, WithinFileRename) { // Issue 170: Rename symbol introduced by UsingDecl R"cpp( - namespace ns { void [[f^oo]](); } + namespace ns { void [[f^oo]](); } using ns::[[f^oo]]; @@ -1307,7 +1307,7 @@ TEST(RenameTest, Renameable) { "no symbol", false}, {R"cpp(// FIXME we probably want to rename both overloads here, - // but renaming currently assumes there's only a + // but renaming currently assumes there's only a // single canonical declaration. namespace ns { int foo(int); char foo(char); } using ns::^foo; @@ -1776,7 +1776,7 @@ TEST(CrossFileRenameTests, WithUpToDateIndex) { void [[foo]]() override {}; }; - void func(Base* b, Derived1* d1, + void func(Base* b, Derived1* d1, Derived2* d2, NotDerived* nd) { b->[[foo]](); d1->[[foo]](); diff --git a/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp b/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp index 94cecce1f038c..1ec51d862d0a6 100644 --- a/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp +++ b/clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp @@ -741,7 +741,6 @@ sizeof...($TemplateParameter[[Elements]]); $Class[[Foo]].$Field_static[[sharedInstance]].$Field[[someProperty]] $Operator[[=]] 1; self.$Field[[someProperty]] $Operator[[=]] self.$Field[[someProperty]] $Operator[[+]] self.$Field[[otherMethod]] $Operator[[+]] 1; self->$Field[[_someProperty]] $Operator[[=]] $Field[[_someProperty]] $Operator[[+]] 1; - return 0; } @end )cpp", diff --git a/clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp b/clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp index 7ede19c321bc6..7faef6f95d8f9 100644 --- a/clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp +++ b/clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp @@ -201,7 +201,6 @@ TEST(FoldingRanges, ASTAll) { R"cpp( #define FOO int foo() {\ int Variable = 42; \ - return 0; \ } // Do not generate folding range for braces within macro expansion. @@ -337,18 +336,18 @@ TEST(FoldingRanges, PseudoParserWithoutLineFoldings) { ]]}; )cpp", R"cpp( - /*[[ Multi + /*[[ Multi * line - * comment + * comment ]]*/ )cpp", R"cpp( //[[ Comment // 1]] - + //[[ Comment // 2]] - + // No folding for single line comment. /*[[ comment 3 diff --git a/clang-tools-extra/clangd/unittests/SymbolInfoTests.cpp b/clang-tools-extra/clangd/unittests/SymbolInfoTests.cpp index 95b6eaedce97c..6c91f3783a622 100644 --- a/clang-tools-extra/clangd/unittests/SymbolInfoTests.cpp +++ b/clang-tools-extra/clangd/unittests/SymbolInfoTests.cpp @@ -36,7 +36,6 @@ TEST(SymbolInfoTests, All) { void $decl[[foo]](); int bar() { fo^o(); - return 0; } )cpp", {ExpectedSymbolDetails{"foo", "", "c:@F@foo#", "decl"}}}, @@ -45,7 +44,6 @@ TEST(SymbolInfoTests, All) { void $def[[foo]]() {} int bar() { fo^o(); - return 0; } )cpp", {ExpectedSymbolDetails{"foo", "", "c:@F@foo#", "def", "def"}}}, @@ -55,7 +53,6 @@ TEST(SymbolInfoTests, All) { void $def[[foo]]() {} int bar() { fo^o(); - return 0; } )cpp", {ExpectedSymbolDetails{"foo", "", "c:@F@foo#", "decl", "def"}}}, @@ -86,7 +83,6 @@ TEST(SymbolInfoTests, All) { void $decl[[foo]](); int baz() { fo^o(); - return 0; } } )cpp", @@ -100,7 +96,6 @@ TEST(SymbolInfoTests, All) { namespace barbar { int baz() { bar::fo^o(); - return 0; } } )cpp", @@ -113,7 +108,6 @@ TEST(SymbolInfoTests, All) { namespace Nbaz { int baz() { ::fo^o(); - return 0; } } } @@ -127,7 +121,6 @@ TEST(SymbolInfoTests, All) { namespace barbar { int baz() { fo^o(); - return 0; } } )cpp", @@ -143,7 +136,6 @@ TEST(SymbolInfoTests, All) { int baz() { bar::BarType b; fo^o(b); - return 0; } } )cpp", diff --git a/clang-tools-extra/clangd/unittests/XRefsTests.cpp b/clang-tools-extra/clangd/unittests/XRefsTests.cpp index e12d7691c58fb..475b56b1dc230 100644 --- a/clang-tools-extra/clangd/unittests/XRefsTests.cpp +++ b/clang-tools-extra/clangd/unittests/XRefsTests.cpp @@ -95,7 +95,7 @@ TEST(HighlightsTest, All) { )cpp", R"cpp(// Function - int [[^foo]](int) { return 0; } + int [[^foo]](int) {} int main() { [[foo]]([[foo]](42)); auto *X = &[[foo]]; @@ -2140,7 +2140,7 @@ TEST(FindReferences, WithinAST) { )cpp", R"cpp(// Function - int $def[[foo]](int) { return 0; } + int $def[[foo]](int) {} int main() { auto *X = &$(main)[[^foo]]; $(main)[[foo]](42); @@ -2160,7 +2160,7 @@ TEST(FindReferences, WithinAST) { R"cpp(// Method call struct Foo { int $decl(Foo)[[foo]](); }; - int Foo::$def(Foo)[[foo]]() { return 0; } + int Foo::$def(Foo)[[foo]]() {} int main() { Foo f; f.$(main)[[^foo]](); @@ -2258,7 +2258,7 @@ TEST(FindReferences, WithinAST) { )cpp", R"cpp(// Dependent code template <typename T> void $decl[[foo]](T t); - template <typename T> void bar(T t) { $(bar)[[foo]](t); } // foo in bar is uninstantiated. + template <typename T> void bar(T t) { $(bar)[[foo]](t); } // foo in bar is uninstantiated. void baz(int x) { $(baz)[[f^oo]](x); } )cpp", R"cpp( @@ -2508,7 +2508,6 @@ TEST(FindReferences, ExplicitSymbols) { X $def(test)[[a]]; $(test)[[a]].operator bool(); if ($(test)[[a^]]) {} // ignore implicit conversion-operator AST node - return 0; } )cpp", }; @@ -2544,7 +2543,7 @@ TEST(FindReferences, UsedSymbolsFromInclude) { #define BAR 5 int bar1(); int bar2(); - class Bar {}; + class Bar {}; )cpp"); TU.AdditionalFiles["system/vector"] = guard(R"cpp( namespace std { @@ -2561,7 +2560,7 @@ TEST(FindReferences, UsedSymbolsFromInclude) { std::vector<Matcher<ReferencesResult::Reference>> ExpectedLocations; for (const auto &R : T.ranges()) ExpectedLocations.push_back(AllOf(rangeIs(R), attrsAre(0u))); - for (const auto &P : T.points()) + for (const auto &P : T.points()) EXPECT_THAT(findReferences(AST, P, 0).References, UnorderedElementsAreArray(ExpectedLocations)) << "Failed for Refs at " << P << "\n" @@ -2636,7 +2635,6 @@ TEST(FindReferences, NeedsIndexForMacro) { Annotations IndexedMain(R"cpp( int indexed_main() { int a = [[MACRO]](1); - return 0; } )cpp"); diff --git a/clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp index 5ec12396ae927..8d496b2a3ee73 100644 --- a/clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp +++ b/clang-tools-extra/clangd/unittests/tweaks/DefineInlineTests.cpp @@ -935,11 +935,10 @@ TEST_F(DefineInlineTest, AddInline) { // Check we put inline before cv-qualifiers. ExtraFiles["a.h"] = "const int foo();"; apply(R"cpp(#include "a.h" - const int fo^o() { return 0; })cpp", + const int fo^o() {})cpp", &EditedFiles); - EXPECT_THAT(EditedFiles, - testing::ElementsAre(FileWithContents( - testPath("a.h"), "inline const int foo(){ return 0; }"))); + EXPECT_THAT(EditedFiles, testing::ElementsAre(FileWithContents( + testPath("a.h"), "inline const int foo(){}"))); // No double inline. ExtraFiles["a.h"] = "inline void foo();"; diff --git a/clang-tools-extra/clangd/unittests/tweaks/ExpandDeducedTypeTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/ExpandDeducedTypeTests.cpp index 8da394d74b54d..3730ab4a87136 100644 --- a/clang-tools-extra/clangd/unittests/tweaks/ExpandDeducedTypeTests.cpp +++ b/clang-tools-extra/clangd/unittests/tweaks/ExpandDeducedTypeTests.cpp @@ -69,8 +69,8 @@ TEST_F(ExpandDeducedTypeTest, Test) { EXPECT_THAT(apply(R"cpp(au^to s = &"foobar";)cpp"), StartsWith("fail: Could not expand type")); - EXPECT_EQ(apply("ns::Class * foo() { au^to c = foo(); return nullptr; }"), - "ns::Class * foo() { ns::Class * c = foo(); return nullptr; }"); + EXPECT_EQ(apply("ns::Class * foo() { au^to c = foo(); }"), + "ns::Class * foo() { ns::Class * c = foo(); }"); EXPECT_EQ( apply("void ns::Func() { au^to x = new ns::Class::Nested{}; }"), "void ns::Func() { ns::Class::Nested * x = new ns::Class::Nested{}; }"); diff --git a/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp index 3c65a58d6c945..552e693c0363a 100644 --- a/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp +++ b/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp @@ -116,7 +116,6 @@ TEST_F(ExtractVariableTest, Test) { struct T { int bar(int a = [[1]]) { int b = [[z]]; - return 0; } int z = [[1]]; } t; diff --git a/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/strings/internal-file.h b/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/strings/internal-file.h index b9ce1c875ed13..31798661a80fc 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/strings/internal-file.h +++ b/clang-tools-extra/test/clang-tidy/checkers/abseil/Inputs/absl/strings/internal-file.h @@ -10,7 +10,7 @@ std::string StringsFunction(std::string s1) { return s1; } class SomeContainer {}; namespace strings_internal { void InternalFunction() {} -template <class P> void InternalTemplateFunction(P a) { int; } +template <class P> P InternalTemplateFunction(P a) {} } // namespace strings_internal namespace container_internal { diff --git a/clang-tools-extra/test/clang-tidy/checkers/boost/use-to-string.cpp b/clang-tools-extra/test/clang-tidy/checkers/boost/use-to-string.cpp index f888c430e6883..44ba172c2ff0b 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/boost/use-to-string.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/boost/use-to-string.cpp @@ -18,7 +18,7 @@ T lexical_cast(const V &) { struct my_weird_type {}; -std::string fun(const std::string &) { return {}; } +std::string fun(const std::string &) {} void test_to_string1() { @@ -75,7 +75,7 @@ void test_to_string2() { fun(boost::lexical_cast<std::string>(j)); } -std::string fun(const std::wstring &); +std::string fun(const std::wstring &) {} void test_to_wstring() { int a; diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp index aff13d19fd209..222577b124dce 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-coro.cpp @@ -1,5 +1,5 @@ // RUN: %check_clang_tidy -std=c++20 %s bugprone-exception-escape %t -- \ -// RUN: -- -fexceptions -Wno-error=return-type +// RUN: -- -fexceptions namespace std { diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-rethrow.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-rethrow.cpp index 6f961a247b9d2..b20333d5b0b3b 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-rethrow.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape-rethrow.cpp @@ -20,7 +20,6 @@ int throwsAndCallsRethrower() noexcept { } catch(...) { rethrower(); } - return 1; } int throwsAndCallsCallsRethrower() noexcept { @@ -30,7 +29,6 @@ int throwsAndCallsCallsRethrower() noexcept { } catch(...) { callsRethrower(); } - return 1; } void rethrowerNoexcept() noexcept { diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape.cpp index aae957dd7e090..26c443b139629 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/exception-escape.cpp @@ -665,7 +665,6 @@ int indirectly_recursive(int n) noexcept; int recursion_helper(int n) { indirectly_recursive(n); - return 0; } int indirectly_recursive(int n) noexcept { diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/fold-init-type.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/fold-init-type.cpp index c813213c3dd0f..2a49960e02895 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/fold-init-type.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/fold-init-type.cpp @@ -8,25 +8,24 @@ T accumulate(InputIt first, InputIt last, T init) { // is instantiated. In practice this happens somewhere in the implementation // of `accumulate`. For tests, do it here. (void)*first; - return init; } template <class InputIt, class T> -T reduce(InputIt first, InputIt last, T init) { (void)*first; return init; } +T reduce(InputIt first, InputIt last, T init) { (void)*first; } template <class ExecutionPolicy, class InputIt, class T> T reduce(ExecutionPolicy &&policy, - InputIt first, InputIt last, T init) { (void)*first; return init; } + InputIt first, InputIt last, T init) { (void)*first; } struct parallel_execution_policy {}; constexpr parallel_execution_policy par{}; template <class InputIt1, class InputIt2, class T> T inner_product(InputIt1 first1, InputIt1 last1, - InputIt2 first2, T value) { (void)*first1; (void)*first2; return value; } + InputIt2 first2, T value) { (void)*first1; (void)*first2; } template <class ExecutionPolicy, class InputIt1, class InputIt2, class T> T inner_product(ExecutionPolicy &&policy, InputIt1 first1, InputIt1 last1, - InputIt2 first2, T value) { (void)*first1; (void)*first2; return value; } + InputIt2 first2, T value) { (void)*first1; (void)*first2; } } // namespace std diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/inc-dec-in-conditions-bitint-no-crash.c b/clang-tools-extra/test/clang-tidy/checkers/bugprone/inc-dec-in-conditions-bitint-no-crash.c index 5cfa264e42d68..cfb64c10fe46c 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/inc-dec-in-conditions-bitint-no-crash.c +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/inc-dec-in-conditions-bitint-no-crash.c @@ -5,6 +5,5 @@ _BitInt(8) v_401_0() { _BitInt(5) y = 0; 16777215wb ?: ++y; }); - return 0; } -// CHECK-MESSAGES: warning +// CHECK-MESSAGES: warning diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.c b/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.c index 36b1215978603..8b84474d3f2d3 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.c +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.c @@ -12,9 +12,9 @@ typedef struct cnd_t { } cnd_t; struct timespec {}; -int cnd_wait(cnd_t *cond, mtx_t *mutex){ return 0; }; +int cnd_wait(cnd_t *cond, mtx_t *mutex){}; int cnd_timedwait(cnd_t *cond, mtx_t *mutex, - const struct timespec *time_point){ return 0; }; + const struct timespec *time_point){}; struct Node1 list_c; static mtx_t lock; diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.cpp index d7508009e19ad..6db92ef939fa3 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/spuriously-wake-up-functions.cpp @@ -90,18 +90,18 @@ class condition_variable { void wait(unique_lock<mutex> &lock, Predicate pred); template <class Clock, class Duration> cv_status wait_until(unique_lock<mutex> &lock, - const chrono::time_point<Clock, Duration> &abs_time){ return cv_status::no_timeout; }; + const chrono::time_point<Clock, Duration> &abs_time){}; template <class Clock, class Duration, class Predicate> bool wait_until(unique_lock<mutex> &lock, const chrono::time_point<Clock, Duration> &abs_time, - Predicate pred){ return false; }; + Predicate pred){}; template <class Rep, class Period> cv_status wait_for(unique_lock<mutex> &lock, - const chrono::duration<Rep, Period> &rel_time){ return cv_status::no_timeout; }; + const chrono::duration<Rep, Period> &rel_time){}; template <class Rep, class Period, class Predicate> bool wait_for(unique_lock<mutex> &lock, const chrono::duration<Rep, Period> &rel_time, - Predicate pred){ return false; }; + Predicate pred){}; }; } // namespace std diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/stringview-nullptr.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/stringview-nullptr.cpp index ff5b256e71781..02fcab31dcf3e 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/stringview-nullptr.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/stringview-nullptr.cpp @@ -27,7 +27,7 @@ class basic_string_view { constexpr basic_string_view(const basic_string_view &) {} - constexpr basic_string_view &operator=(const basic_string_view &) { return *this; } + constexpr basic_string_view &operator=(const basic_string_view &) {} }; template <typename CharT> diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-string-compare.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-string-compare.cpp index c14b094f3fca3..7e1dd6b444393 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-string-compare.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/suspicious-string-compare.cpp @@ -89,8 +89,6 @@ int test_warning_patterns() { if (strcmp(A, "a") < 0.) return 0; // CHECK-MESSAGES: [[@LINE-2]]:7: warning: function 'strcmp' has suspicious implicit cast - - return 1; } int test_valid_patterns() { diff --git a/clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp b/clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp index ed7bcc7dacc30..50b6d4c5676c3 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp @@ -2,7 +2,7 @@ int foo(int value = 5) { return value; } -void f() { +int f() { foo(); // CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls] // CHECK-NOTES: [[@LINE-5]]:9: note: default parameter was declared here @@ -10,7 +10,7 @@ void f() { int bar(int value) { return value; } -void n() { +int n() { foo(0); bar(0); } diff --git a/clang-tools-extra/test/clang-tidy/checkers/fuchsia/multiple-inheritance.cpp b/clang-tools-extra/test/clang-tidy/checkers/fuchsia/multiple-inheritance.cpp index d53b3fde7736b..6ce9ce8e65536 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/fuchsia/multiple-inheritance.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/fuchsia/multiple-inheritance.cpp @@ -144,7 +144,7 @@ struct WithTemplBase : T { WithTemplBase(); }; -void test_no_crash() { +int test_no_crash() { auto foo = []() {}; WithTemplBase<decltype(foo)>(); } diff --git a/clang-tools-extra/test/clang-tidy/checkers/google/runtime-int-std.cpp b/clang-tools-extra/test/clang-tidy/checkers/google/runtime-int-std.cpp index cd65de51a5ce9..30f9b3cf1e90c 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/google/runtime-int-std.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/google/runtime-int-std.cpp @@ -54,5 +54,4 @@ short bar(const short, unsigned short) { tmpl<short>(); // CHECK-MESSAGES: [[@LINE-1]]:8: warning: consider replacing 'short' with 'std::int16_t' - return 0; } diff --git a/clang-tools-extra/test/clang-tidy/checkers/google/upgrade-googletest-case.cpp b/clang-tools-extra/test/clang-tidy/checkers/google/upgrade-googletest-case.cpp index 39ff9b7f39634..ce70e79183521 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/google/upgrade-googletest-case.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/google/upgrade-googletest-case.cpp @@ -221,9 +221,9 @@ class FooTestInfo : public testing::TestInfo { // CHECK-FIXES: const char *test_suite_name() const; }; -const char *FooTestInfo::test_case_name() const { return nullptr; } +const char *FooTestInfo::test_case_name() const {} // CHECK-MESSAGES: [[@LINE-1]]:26: warning: Google Test APIs named with 'case' -// CHECK-FIXES: const char *FooTestInfo::test_suite_name() const { return nullptr; } +// CHECK-FIXES: const char *FooTestInfo::test_suite_name() const {} class BarTestInfo : public testing::TestInfo { public: @@ -491,26 +491,26 @@ class FooUnitTest : public testing::UnitTest { // CHECK-FIXES: const testing::TestSuite *GetTestSuite(int) const; }; -testing::TestCase *FooUnitTest::current_test_case() const { return nullptr; } +testing::TestCase *FooUnitTest::current_test_case() const {} // CHECK-MESSAGES: [[@LINE-1]]:10: warning: Google Test APIs named with 'case' // CHECK-MESSAGES: [[@LINE-2]]:33: warning: Google Test APIs named with 'case' -// CHECK-FIXES: testing::TestSuite *FooUnitTest::current_test_suite() const { return nullptr; } -int FooUnitTest::successful_test_case_count() const { return 0; } +// CHECK-FIXES: testing::TestSuite *FooUnitTest::current_test_suite() const {} +int FooUnitTest::successful_test_case_count() const {} // CHECK-MESSAGES: [[@LINE-1]]:18: warning: Google Test APIs named with 'case' -// CHECK-FIXES: int FooUnitTest::successful_test_suite_count() const { return 0; } -int FooUnitTest::failed_test_case_count() const { return 0; } +// CHECK-FIXES: int FooUnitTest::successful_test_suite_count() const {} +int FooUnitTest::failed_test_case_count() const {} // CHECK-MESSAGES: [[@LINE-1]]:18: warning: Google Test APIs named with 'case' -// CHECK-FIXES: int FooUnitTest::failed_test_suite_count() const { return 0; } -int FooUnitTest::total_test_case_count() const { return 0; } +// CHECK-FIXES: int FooUnitTest::failed_test_suite_count() const {} +int FooUnitTest::total_test_case_count() const {} // CHECK-MESSAGES: [[@LINE-1]]:18: warning: Google Test APIs named with 'case' -// CHECK-FIXES: int FooUnitTest::total_test_suite_count() const { return 0; } -int FooUnitTest::test_case_to_run_count() const { return 0; } +// CHECK-FIXES: int FooUnitTest::total_test_suite_count() const {} +int FooUnitTest::test_case_to_run_count() const {} // CHECK-MESSAGES: [[@LINE-1]]:18: warning: Google Test APIs named with 'case' -// CHECK-FIXES: int FooUnitTest::test_suite_to_run_count() const { return 0; } -const testing::TestCase *FooUnitTest::GetTestCase(int) const { return 0; } +// CHECK-FIXES: int FooUnitTest::test_suite_to_run_count() const {} +const testing::TestCase *FooUnitTest::GetTestCase(int) const {} // CHECK-MESSAGES: [[@LINE-1]]:16: warning: Google Test APIs named with 'case' // CHECK-MESSAGES: [[@LINE-2]]:39: warning: Google Test APIs named with 'case' -// CHECK-FIXES: const testing::TestSuite *FooUnitTest::GetTestSuite(int) const { return 0; } +// CHECK-FIXES: const testing::TestSuite *FooUnitTest::GetTestSuite(int) const {} // Type derived from testing::TestCase class BarUnitTest : public testing::UnitTest { diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-transform-values.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-transform-values.cpp index 109eddc195558..9a4eb010609b4 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-transform-values.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-transform-values.cpp @@ -54,8 +54,8 @@ void template_instantiation() { struct ConstNonConstClass { ConstNonConstClass(); ConstNonConstClass(double &np_local0); - double nonConstMethod() { return 0; } - double constMethod() const { return 0; } + double nonConstMethod() {} + double constMethod() const {} double modifyingMethod(double &np_arg0) const; double NonConstMember; diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-values.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-values.cpp index 5efb64bca2374..0d1ff0db58371 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-values.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-values.cpp @@ -283,8 +283,8 @@ void template_instantiation() { struct ConstNonConstClass { ConstNonConstClass(); ConstNonConstClass(double &np_local0); - double nonConstMethod() { return 0; } - double constMethod() const { return 0; } + double nonConstMethod() {} + double constMethod() const {} double modifyingMethod(double &np_arg0) const; double NonConstMember; diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.cpp index 9b3dd070405b5..524de45463e36 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters.cpp @@ -33,9 +33,9 @@ void f(void (*fn)()) {;} // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: parameter 'fn' is unused [misc-unused-parameters] // CHECK-FIXES: {{^}}void f(void (* /*fn*/)()) {;}{{$}} -int *k([[clang::lifetimebound]] int *i) { return nullptr; } +int *k([[clang::lifetimebound]] int *i) {;} // CHECK-MESSAGES: :[[@LINE-1]]:38: warning: parameter 'i' is unused [misc-unused-parameters] -// CHECK-FIXES: {{^}}int *k({{\[\[clang::lifetimebound\]\]}} int * /*i*/) { return nullptr; }{{$}} +// CHECK-FIXES: {{^}}int *k({{\[\[clang::lifetimebound\]\]}} int * /*i*/) {;}{{$}} #define ATTR_BEFORE(x) [[clang::lifetimebound]] x int* m(ATTR_BEFORE(const int *i)) { return nullptr; } diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp b/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp index abf95b857c192..68951fcf0aaac 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-func.cpp @@ -17,25 +17,25 @@ void func_cpp_inc() {} // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'func_cpp_inc' // CHECK-FIXES: static void func_cpp_inc() {} -int* func_cpp_inc_return_ptr() { return nullptr; } +int* func_cpp_inc_return_ptr() {} // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'func_cpp_inc_return_ptr' -// CHECK-FIXES: static int* func_cpp_inc_return_ptr() { return nullptr; } +// CHECK-FIXES: static int* func_cpp_inc_return_ptr() {} -const int* func_cpp_inc_return_const_ptr() { return nullptr; } +const int* func_cpp_inc_return_const_ptr() {} // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: function 'func_cpp_inc_return_const_ptr' -// CHECK-FIXES: static const int* func_cpp_inc_return_const_ptr() { return nullptr; } +// CHECK-FIXES: static const int* func_cpp_inc_return_const_ptr() {} -int const* func_cpp_inc_return_ptr_const() { return nullptr; } +int const* func_cpp_inc_return_ptr_const() {} // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: function 'func_cpp_inc_return_ptr_const' -// CHECK-FIXES: static int const* func_cpp_inc_return_ptr_const() { return nullptr; } +// CHECK-FIXES: static int const* func_cpp_inc_return_ptr_const() {} -int * const func_cpp_inc_return_const() { return nullptr; } +int * const func_cpp_inc_return_const() {} // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: function 'func_cpp_inc_return_const' -// CHECK-FIXES: static int * const func_cpp_inc_return_const() { return nullptr; } +// CHECK-FIXES: static int * const func_cpp_inc_return_const() {} -volatile const int* func_cpp_inc_return_volatile_const_ptr() { return nullptr; } +volatile const int* func_cpp_inc_return_volatile_const_ptr() {} // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: function 'func_cpp_inc_return_volatile_const_ptr' -// CHECK-FIXES: static volatile const int* func_cpp_inc_return_volatile_const_ptr() { return nullptr; } +// CHECK-FIXES: static volatile const int* func_cpp_inc_return_volatile_const_ptr() {} [[nodiscard]] void func_nodiscard() {} // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: function 'func_nodiscard' diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-auto/containers.h b/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-auto/containers.h index 2c90d762f5d8a..c99b7a4407d5c 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-auto/containers.h +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-auto/containers.h @@ -214,8 +214,8 @@ class map : public bidirectional_iterable<iterator<pair<key, value>>> { public: map() {} - iterator<pair<key, value>> find(const key &); - const_iterator<iterator<pair<key, value>>> find(const key &) const; + iterator<pair<key, value>> find(const key &) {} + const_iterator<iterator<pair<key, value>>> find(const key &) const {} }; template <typename key, typename value> diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-bind.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-bind.cpp index 0d100ffa38b27..22b24d45fe63f 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-bind.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-bind.cpp @@ -46,7 +46,7 @@ struct D { operator bool() const { return true; } void MemberFunction(int x) {} - int MemberFunctionWithReturn(int x) { return 0; } + int MemberFunctionWithReturn(int x) {} static D *create(); }; @@ -342,7 +342,7 @@ void testCapturedSubexpressions() { struct E { void MemberFunction(int x) {} - int MemberFunctionWithReturn(int x) { return 0; } + int MemberFunctionWithReturn(int x) {} int operator()(int x, int y) const { return x + y; } void testMemberFunctions() { diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-c++20.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-c++20.cpp index c9391e3339623..1eb8ebe3d51e3 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-c++20.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-c++20.cpp @@ -1,11 +1,11 @@ // RUN: %check_clang_tidy -std=c++20 %s modernize-avoid-c-arrays %t -void f1(int data[], int size) { - // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: do not declare C-style arrays, use 'std::span' instead +int f1(int data[], int size) { + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: do not declare C-style arrays, use 'std::span' instead int f4[] = {1, 2}; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use 'std::array' instead } -void f2(int data[100]) { - // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: do not declare C-style arrays, use 'std::array' instead +int f2(int data[100]) { + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: do not declare C-style arrays, use 'std::array' instead } diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-main.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-main.cpp index 8e1890c234223..a0c79bb55a686 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-main.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-main.cpp @@ -1,13 +1,9 @@ // RUN: %check_clang_tidy -std=c++17 %s modernize-avoid-c-arrays %t -namespace X { -// Not main -int main(int argc, char *argv[]) { - // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead +int not_main(int argc, char *argv[]) { + // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead int f4[] = {1, 2}; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use 'std::array' instead - return 0; -} } int main(int argc, char *argv[]) { diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-three-arg-main.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-three-arg-main.cpp index 58eced408733a..bd39f0fb4f1c8 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-three-arg-main.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/avoid-c-arrays-ignores-three-arg-main.cpp @@ -1,23 +1,19 @@ // RUN: %check_clang_tidy -std=c++17 %s modernize-avoid-c-arrays %t -namespace X { -// Not main. -int main(int argc, char *argv[], char *argw[]) { - // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead - // CHECK-MESSAGES: :[[@LINE-2]]:34: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead +int not_main(int argc, char *argv[], char *argw[]) { + // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead + // CHECK-MESSAGES: :[[@LINE-2]]:38: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead int f4[] = {1, 2}; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use 'std::array' instead - return 0; -} } int main(int argc, char *argv[], char *argw[]) { int f5[] = {1, 2}; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use 'std::array' instead - auto main = [](int argc, char *argv[], char *argw[]) { - // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead - // CHECK-MESSAGES: :[[@LINE-2]]:42: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead + auto not_main = [](int argc, char *argv[], char *argw[]) { + // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead + // CHECK-MESSAGES: :[[@LINE-2]]:46: warning: do not declare C-style arrays, use 'std::array' or 'std::vector' instead int f6[] = {1, 2}; // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not declare C-style arrays, use 'std::array' instead }; diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/loop-convert-basic.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/loop-convert-basic.cpp index 8d1d7378e5cff..df2a2c1af1f54 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/loop-convert-basic.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/loop-convert-basic.cpp @@ -170,8 +170,6 @@ const int *constArray() { // CHECK-FIXES: for (const int & I : ConstArr) // CHECK-FIXES-NEXT: if (Something) // CHECK-FIXES-NEXT: return &I; - - return nullptr; } struct HasArr { diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp index e6562cd18dbab..3f4a14cd9bb64 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-emplace.cpp @@ -49,7 +49,7 @@ class vector { template <typename... Args> void emplace_back(Args &&... args){}; template <typename... Args> - iterator emplace(const_iterator pos, Args &&...args); + iterator emplace(const_iterator pos, Args &&...args){}; ~vector(); }; @@ -69,7 +69,7 @@ class list { void push_back(T &&) {} template <typename... Args> - iterator emplace(const_iterator pos, Args &&...args); + iterator emplace(const_iterator pos, Args &&...args){}; template <typename... Args> void emplace_back(Args &&... args){}; template <typename... Args> @@ -93,7 +93,7 @@ class deque { void push_front(T &&) {} template <typename... Args> - iterator emplace(const_iterator pos, Args &&...args); + iterator emplace(const_iterator pos, Args &&...args){}; template <typename... Args> void emplace_back(Args &&... args){}; template <typename... Args> @@ -116,7 +116,7 @@ class forward_list { template <typename... Args> void emplace_front(Args &&...args){}; template <typename... Args> - iterator emplace_after(const_iterator pos, Args &&...args); + iterator emplace_after(const_iterator pos, Args &&...args){}; }; template <typename T> @@ -131,7 +131,7 @@ class set { template <typename... Args> void emplace(Args &&...args){}; template <typename... Args> - iterator emplace_hint(const_iterator pos, Args &&...args); + iterator emplace_hint(const_iterator pos, Args &&...args){}; }; template <typename Key, typename T> @@ -146,7 +146,7 @@ class map { template <typename... Args> void emplace(Args &&...args){}; template <typename... Args> - iterator emplace_hint(const_iterator pos, Args &&...args); + iterator emplace_hint(const_iterator pos, Args &&...args){}; }; template <typename T> @@ -161,7 +161,7 @@ class multiset { template <typename... Args> void emplace(Args &&...args){}; template <typename... Args> - iterator emplace_hint(const_iterator pos, Args &&...args); + iterator emplace_hint(const_iterator pos, Args &&...args){}; }; template <typename Key, typename T> @@ -176,7 +176,7 @@ class multimap { template <typename... Args> void emplace(Args &&...args){}; template <typename... Args> - iterator emplace_hint(const_iterator pos, Args &&...args); + iterator emplace_hint(const_iterator pos, Args &&...args){}; }; template <typename T> @@ -191,7 +191,7 @@ class unordered_set { template <typename... Args> void emplace(Args &&...args){}; template <typename... Args> - iterator emplace_hint(const_iterator pos, Args &&...args); + iterator emplace_hint(const_iterator pos, Args &&...args){}; }; template <typename Key, typename T> @@ -206,7 +206,7 @@ class unordered_map { template <typename... Args> void emplace(Args &&...args){}; template <typename... Args> - iterator emplace_hint(const_iterator pos, Args &&...args); + iterator emplace_hint(const_iterator pos, Args &&...args){}; }; template <typename T> @@ -221,7 +221,7 @@ class unordered_multiset { template <typename... Args> void emplace(Args &&...args){}; template <typename... Args> - iterator emplace_hint(const_iterator pos, Args &&...args); + iterator emplace_hint(const_iterator pos, Args &&...args){}; }; template <typename Key, typename T> @@ -236,7 +236,7 @@ class unordered_multimap { template <typename... Args> void emplace(Args &&...args){}; template <typename... Args> - iterator emplace_hint(const_iterator pos, Args &&...args); + iterator emplace_hint(const_iterator pos, Args &&...args){}; }; template <typename T> diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp index 7f737148a7cd1..4abb9c8555970 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-equals-default-copy.cpp @@ -1,6 +1,6 @@ // RUN: %check_clang_tidy %s modernize-use-equals-default %t -- \ // RUN: -config="{CheckOptions: {modernize-use-equals-default.IgnoreMacros: false}}" \ -// RUN: -- -fno-delayed-template-parsing -fexceptions -Wno-error=return-type +// RUN: -- -fno-delayed-template-parsing -fexceptions // Out of line definition. struct OL { diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp index bad8b7a8d7f08..89d1aa48c46a3 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-override.cpp @@ -203,13 +203,13 @@ struct InlineDefinitions : public Base { // CHECK-MESSAGES: :[[@LINE-2]]:16: warning: prefer using // CHECK-FIXES: {{^}} void j() const override - virtual MustUseResultObject k(); // Has an implicit attribute. + virtual MustUseResultObject k() {} // Has an implicit attribute. // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: prefer using - // CHECK-FIXES: {{^}} MustUseResultObject k() override; + // CHECK-FIXES: {{^}} MustUseResultObject k() override {} - virtual bool l() MUST_USE_RESULT UNUSED; + virtual bool l() MUST_USE_RESULT UNUSED {} // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: prefer using - // CHECK-FIXES: {{^}} bool l() override MUST_USE_RESULT UNUSED; + // CHECK-FIXES: {{^}} bool l() override MUST_USE_RESULT UNUSED {} virtual void r() & {} diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format.cpp index 2af2e8949a814..0a5a63eba2596 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format.cpp @@ -100,7 +100,7 @@ std::string StrFormat_field_width_and_precision() { return s1 + s2 + s3 + s4 + s5 + s6; } -void StrFormat_macros() { +std::string StrFormat_macros() { // The function call is replaced even though it comes from a macro. #define FORMAT absl::StrFormat auto s1 = FORMAT("Hello %d", 42); diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type.cpp index e1f36c52a7c01..d9efc006b22ef 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-trailing-return-type.cpp @@ -106,9 +106,9 @@ extern "C" int d2(int arg); inline int d3(int arg) noexcept(true); // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}}inline auto d3(int arg) noexcept(true) -> int;{{$}} -inline int d4(int arg) try { return 0; } catch(...) { return 0; } +inline int d4(int arg) try { } catch(...) { } // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use a trailing return type for this function [modernize-use-trailing-return-type] -// CHECK-FIXES: {{^}}inline auto d4(int arg) -> int try { return 0; } catch(...) { return 0; }{{$}} +// CHECK-FIXES: {{^}}inline auto d4(int arg) -> int try { } catch(...) { }{{$}} int d5(int arg) throw(); // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}}auto d5(int arg) throw() -> int;{{$}} @@ -167,9 +167,9 @@ namespace N { } // CHECK-MESSAGES: :[[@LINE-2]]:9: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}} auto e1() -> int;{{$}} -int N::e1() { return 0; } +int N::e1() {} // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use a trailing return type for this function [modernize-use-trailing-return-type] -// CHECK-FIXES: {{^}}auto N::e1() -> int { return 0; }{{$}} +// CHECK-FIXES: {{^}}auto N::e1() -> int {}{{$}} // // Functions with unsupported return types @@ -260,14 +260,14 @@ struct B { B& operator=(const B&); // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}} auto operator=(const B&) -> B&;{{$}} - + double base1(int, bool b); // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}} auto base1(int, bool b) -> double;{{$}} - virtual double base2(int, bool b) { return 0; } + virtual double base2(int, bool b) {} // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: use a trailing return type for this function [modernize-use-trailing-return-type] -// CHECK-FIXES: {{^}} virtual auto base2(int, bool b) -> double { return 0; }{{$}} +// CHECK-FIXES: {{^}} virtual auto base2(int, bool b) -> double {}{{$}} virtual float base3() const = 0; // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: use a trailing return type for this function [modernize-use-trailing-return-type] @@ -298,9 +298,9 @@ struct B { // CHECK-FIXES: {{^}} virtual auto base9() const noexcept -> const char * { return ""; }{{$}} }; -double B::base1(int, bool b) { return 0; } +double B::base1(int, bool b) {} // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: use a trailing return type for this function [modernize-use-trailing-return-type] -// CHECK-FIXES: {{^}}auto B::base1(int, bool b) -> double { return 0; }{{$}} +// CHECK-FIXES: {{^}}auto B::base1(int, bool b) -> double {}{{$}} struct D : B { virtual double f1(int, bool b) final; @@ -311,9 +311,9 @@ struct D : B { // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: use a trailing return type for this function [modernize-use-trailing-return-type] // CHECK-FIXES: {{^}} virtual auto base2(int, bool b) -> double override;{{$}} - virtual float base3() const override final { return 0; } + virtual float base3() const override final { } // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: use a trailing return type for this function [modernize-use-trailing-return-type] -// CHECK-FIXES: {{^}} virtual auto base3() const -> float override final { return 0; }{{$}} +// CHECK-FIXES: {{^}} virtual auto base3() const -> float override final { }{{$}} const char * base9() const noexcept override { return ""; } // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: use a trailing return type for this function [modernize-use-trailing-return-type] @@ -586,13 +586,13 @@ void c(int arg) { return; } struct D2 : B { D2(); virtual ~D2(); - + virtual auto f1(int, bool b) -> double final; virtual auto base2(int, bool b) -> double override; - virtual auto base3() const -> float override final { return 0; } + virtual auto base3() const -> float override final { } operator double(); }; auto l1 = [](int arg) {}; -auto l2 = [](int arg) -> double { return 0; }; +auto l2 = [](int arg) -> double {}; diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header-fixed.h b/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header-fixed.h index 1dcdd7a5ea4b4..a40b2b2ece52e 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header-fixed.h +++ b/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header-fixed.h @@ -12,4 +12,4 @@ int f1(int n, ABC v1); // line 11 -void f2( int n, const ABC& v2); // line 15 +int f2( int n, const ABC& v2); // line 15 diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header.h b/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header.h index d6f6e65ace79d..94916755ddafe 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header.h +++ b/clang-tools-extra/test/clang-tidy/checkers/performance/Inputs/unnecessary-value-param/header.h @@ -12,4 +12,4 @@ int f1(int n, ABC v1); // line 11 -void f2( int n, ABC v2); // line 15 +int f2( int n, ABC v2); // line 15 diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/inefficient-string-concatenation.cpp b/clang-tools-extra/test/clang-tidy/checkers/performance/inefficient-string-concatenation.cpp index a1edf5fae2f9e..1dbd56b322202 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/performance/inefficient-string-concatenation.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/performance/inefficient-string-concatenation.cpp @@ -6,15 +6,15 @@ class basic_string { public: basic_string() {} ~basic_string() {} - basic_string<T> *operator+=(const basic_string<T> &); - friend basic_string<T> operator+(const basic_string<T> &, const basic_string<T> &); + 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; } void f(std::string) {} -std::string g(std::string); +std::string g(std::string) {} int main() { std::string mystr1, mystr2; diff --git a/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-header.cpp b/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-header.cpp index 8461248982447..2b45bb719dbc5 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-header.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/performance/unnecessary-value-param-header.cpp @@ -14,7 +14,7 @@ int f1(int n, ABC v1, ABC v2) { // CHECK-FIXES: int f1(int n, const ABC& v1, const ABC& v2) { return v1.get(n) + v2.get(n); } -void f2(int n, ABC v2) { - // CHECK-MESSAGES: [[@LINE-1]]:20: warning: the parameter 'v2' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param] - // CHECK-FIXES: void f2(int n, const ABC& v2) { +int f2(int n, ABC v2) { + // CHECK-MESSAGES: [[@LINE-1]]:19: warning: the parameter 'v2' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param] + // CHECK-FIXES: int f2(int n, const ABC& v2) { } diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style1/header.h b/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style1/header.h index bbedc9b1df2dc..abbf7dfa48395 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style1/header.h +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style1/header.h @@ -4,4 +4,4 @@ void style_first_good(); void styleFirstBad(); -int thisIsMainLikeIgnored(int argc, const char *argv[]) { return 0; } +int thisIsMainLikeIgnored(int argc, const char *argv[]) {} diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style2/header.h b/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style2/header.h index 3b3b1e9508e8f..9d3e846a080b9 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style2/header.h +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/identifier-naming/global-style2/header.h @@ -4,4 +4,4 @@ void STYLE_SECOND_GOOD(); void styleSecondBad(); -int thisIsMainLikeNotIgnored(int argc, const char *argv[]) { return 0; } +int thisIsMainLikeNotIgnored(int argc, const char *argv[]) {} diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type-macros.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type-macros.cpp index 0a154c5d23d47..5131011118f30 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type-macros.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type-macros.cpp @@ -6,16 +6,16 @@ // Regression tests involving macros #define CONCAT(a, b) a##b -CONCAT(cons, t) int p22(){ return 0; } +CONCAT(cons, t) int p22(){} // CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qu // We warn, but we can't give a fix #define CONSTINT const int -CONSTINT p23() { return 0; } +CONSTINT p23() {} // CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qu #define CONST const -CONST int p24() { return 0; } +CONST int p24() {} // CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qu #define CREATE_FUNCTION() \ diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp index d913ab4dee9ba..76a3555663b18 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/const-return-type.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy -std=c++14-or-later %s readability-const-return-type %t -- -- -Wno-error=return-type +// RUN: %check_clang_tidy -std=c++14-or-later %s readability-const-return-type %t // p# = positive test // n# = negative test diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/convert-member-functions-to-static.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/convert-member-functions-to-static.cpp index a6b95bdb57e4d..5ec1f221b2207 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/convert-member-functions-to-static.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/convert-member-functions-to-static.cpp @@ -32,7 +32,6 @@ class A { // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: method 'call_static_member' can be made static // CHECK-FIXES: {{^}} static int call_static_member() { already_static(); - return 0; } int read_static() { diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp index 1771836539d86..be5ba54513c67 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp @@ -547,7 +547,6 @@ struct_type GlobalTypedefTestFunction(struct_type a_argument1) { // CHECK-FIXES: {{^}}struct_type_t GlobalTypedefTestFunction(struct_type_t a_argument1) { struct_type typedef_test_1; // CHECK-FIXES: {{^}} struct_type_t typedef_test_1; - return {}; } using my_struct_type = THIS___Structure; @@ -778,8 +777,8 @@ STATIC_MACRO void someFunc(ValueType a_v1, const ValueType& a_v2) {} // CHECK-FIXES: {{^}}STATIC_MACRO void someFunc(value_type_t a_v1, const value_type_t& a_v2) {} STATIC_MACRO void someFunc(const ValueType** p_a_v1, ValueType (*p_a_v2)()) {} // CHECK-FIXES: {{^}}STATIC_MACRO void someFunc(const value_type_t** p_a_v1, value_type_t (*p_a_v2)()) {} -STATIC_MACRO ValueType someFunc() { return {}; } -// CHECK-FIXES: {{^}}STATIC_MACRO value_type_t someFunc() { return {}; } +STATIC_MACRO ValueType someFunc() {} +// CHECK-FIXES: {{^}}STATIC_MACRO value_type_t someFunc() {} STATIC_MACRO void someFunc(MyFunPtr, const MyFunPtr****) {} // CHECK-FIXES: {{^}}STATIC_MACRO void someFunc(my_fun_ptr_t, const my_fun_ptr_t****) {} #undef STATIC_MACRO diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp index 75f666e3e07e5..c4b7a77b92f0a 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.cpp @@ -465,7 +465,7 @@ struct S { // CHECK-FIXES: S(bool a, bool b, bool c) : a(static_cast<int>(a)), b(b), c(static_cast<int>(c)) {} }; -void f(S& s) { +bool f(S& s) { functionTaking<bool>(s.a); // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int' -> 'bool' // CHECK-FIXES: functionTaking<bool>(s.a != 0); diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp index c22e9c564e3ee..8c6fb123ac023 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/named-parameter.cpp @@ -37,8 +37,8 @@ void operator delete[](void *x) throw(); void operator delete[](void * /*x*/) throw(); struct X { - X operator++(int) { throw 0; } - X operator--(int) { throw 0; } + X operator++(int) {} + X operator--(int) {} X(X&) = delete; X &operator=(X&) = default; @@ -86,23 +86,22 @@ void FDef2(int n, int) {} void FNoDef(int); class Z {}; -Z the_z; -Z &operator++(Z&) { return the_z; } +Z &operator++(Z&) {} // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function -// CHECK-FIXES: Z &operator++(Z& /*unused*/) { return the_z; } +// CHECK-FIXES: Z &operator++(Z& /*unused*/) {} -Z &operator++(Z&, int) { return the_z; } +Z &operator++(Z&, int) {} // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function -// CHECK-FIXES: Z &operator++(Z& /*unused*/, int) { return the_z; } +// CHECK-FIXES: Z &operator++(Z& /*unused*/, int) {} -Z &operator--(Z&) { return the_z; } +Z &operator--(Z&) {} // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function -// CHECK-FIXES: Z &operator--(Z& /*unused*/) { return the_z; } +// CHECK-FIXES: Z &operator--(Z& /*unused*/) {} -Z &operator--(Z&, int) { return the_z; } +Z &operator--(Z&, int) {} // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function -// CHECK-FIXES: Z &operator--(Z& /*unused*/, int) { return the_z; } +// CHECK-FIXES: Z &operator--(Z& /*unused*/, int) {} namespace testing { namespace internal { diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.c b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.c index dbcc4cf6d1022..c2e8bf68b4ad7 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.c +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.c @@ -20,7 +20,7 @@ static int f(void); static int f(void); // f // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'f' declaration // CHECK-FIXES: {{^}}// f{{$}} -static int f(void) { return 0; } +static int f(void) {} inline void g(void) {} diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.cpp index 595eccf8854ba..be505f55b86b0 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/redundant-declaration.cpp @@ -38,7 +38,7 @@ static int f(); static int f(); // f // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'f' declaration // CHECK-FIXES: {{^}}// f{{$}} -static int f() { return 0; } +static int f() {} // Original check crashed for the code below. namespace std { diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp index a0d51dec7f32d..202fe9be6d00c 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/static-accessed-through-instance.cpp @@ -264,7 +264,7 @@ struct Qptr { } }; -void func(Qptr qp) { +int func(Qptr qp) { qp->y = 10; qp->K = 10; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through instance [readability-static-accessed-through-instance] diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp index 27db92be21f20..edd3591517af3 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/suspicious-call-argument.cpp @@ -382,7 +382,7 @@ enum opcode { Foo, Bar }; static value *SimplifyRightShift( opcode Opcode, value *Op0, value *Op1, bool isExact, - const type1 &Q, unsigned MaxRecurse) { return nullptr; } + const type1 &Q, unsigned MaxRecurse) {} static value *SimplifyLShrInst(value *Op0, value *Op1, bool isExact, const type1 &Q, unsigned MaxRecurse) { if (value *V = SimplifyRightShift(Foo, Op0, Op1, isExact, Q, MaxRecurse)) diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/duplicate-fixes-of-alias-checkers.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/duplicate-fixes-of-alias-checkers.cpp index ff216298cfd60..f67c20635064a 100644 --- a/clang-tools-extra/test/clang-tidy/infrastructure/duplicate-fixes-of-alias-checkers.cpp +++ b/clang-tools-extra/test/clang-tidy/infrastructure/duplicate-fixes-of-alias-checkers.cpp @@ -31,7 +31,7 @@ class Foo { // CHECK-FIXES: _num2{}; }; -void should_use_emplace(std::vector<Foo> &v) { +int should_use_emplace(std::vector<Foo> &v) { v.push_back(Foo()); // CHECK-FIXES: v.emplace_back(); // CHECK-MESSAGES: warning: use emplace_back instead of push_back [hicpp-use-emplace,modernize-use-emplace] diff --git a/clang/test/CodeGen/armv7k-abi.c b/clang/test/CodeGen/armv7k-abi.c index 872e6423a4a99..fd18dafa7d03f 100644 --- a/clang/test/CodeGen/armv7k-abi.c +++ b/clang/test/CodeGen/armv7k-abi.c @@ -16,7 +16,7 @@ typedef struct { void simple_hfa(HFA h) {} // CHECK: define{{.*}} %struct.HFA @return_simple_hfa -HFA return_simple_hfa() { return (HFA){0}; } +HFA return_simple_hfa() {} typedef struct { double arr[4]; @@ -43,7 +43,7 @@ typedef struct { void big_struct_indirect(BigStruct b) {} // CHECK: define{{.*}} void @return_big_struct_indirect(ptr dead_on_unwind noalias writable sret -BigStruct return_big_struct_indirect() { return (BigStruct){0}; } +BigStruct return_big_struct_indirect() {} // Structs smaller than 16 bytes should be passed directly, and coerced to // either [N x i32] or [N x i64] depending on alignment requirements. @@ -58,7 +58,7 @@ typedef struct { void small_struct_direct(SmallStruct s) {} // CHECK: define{{.*}} [4 x i32] @return_small_struct_direct() -SmallStruct return_small_struct_direct() { return (SmallStruct){0}; } +SmallStruct return_small_struct_direct() {} typedef struct { float x; @@ -75,14 +75,14 @@ typedef struct { } PaddedSmallStruct; // CHECK: define{{.*}} i32 @return_padded_small_struct() -PaddedSmallStruct return_padded_small_struct() { return (PaddedSmallStruct){0}; } +PaddedSmallStruct return_padded_small_struct() {} typedef struct { char arr[7]; } OddlySizedStruct; // CHECK: define{{.*}} [2 x i32] @return_oddly_sized_struct() -OddlySizedStruct return_oddly_sized_struct() { return (OddlySizedStruct){0}; } +OddlySizedStruct return_oddly_sized_struct() {} // CHECK: define{{.*}} <4 x float> @test_va_arg_vec(ptr noundef %l) diff --git a/clang/test/CodeGenOpenCL/atomics-cas-remarks-gfx90a.cl b/clang/test/CodeGenOpenCL/atomics-cas-remarks-gfx90a.cl index 59bf87b554af3..72027eda4571d 100644 --- a/clang/test/CodeGenOpenCL/atomics-cas-remarks-gfx90a.cl +++ b/clang/test/CodeGenOpenCL/atomics-cas-remarks-gfx90a.cl @@ -36,7 +36,7 @@ typedef enum memory_scope { // GFX90A-CAS: atomicrmw fadd ptr addrspace(1) {{.*}} syncscope("agent-one-as") monotonic // GFX90A-CAS: atomicrmw fadd ptr addrspace(1) {{.*}} syncscope("one-as") monotonic // GFX90A-CAS: atomicrmw fadd ptr addrspace(1) {{.*}} syncscope("wavefront-one-as") monotonic -void atomic_cas(__global atomic_float *d, float a) { +float atomic_cas(__global atomic_float *d, float a) { float ret1 = __opencl_atomic_fetch_add(d, a, memory_order_relaxed, memory_scope_work_group); float ret2 = __opencl_atomic_fetch_add(d, a, memory_order_relaxed, memory_scope_device); float ret3 = __opencl_atomic_fetch_add(d, a, memory_order_relaxed, memory_scope_all_svm_devices); diff --git a/compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c b/compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c index e95f4c8c4fd43..e6d1731f30e37 100644 --- a/compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c +++ b/compiler-rt/test/hwasan/TestCases/libc_thread_freeres.c @@ -11,7 +11,6 @@ void *ThreadFn(void *) { __hwasan_enable_allocator_tagging(); // This will trigger memory deallocation in __strerror_thread_freeres, // at a point when HwasanThread is already gone. - return NULL; } int main() { diff --git a/compiler-rt/test/ubsan/TestCases/Misc/Posix/diag-stacktrace.cpp b/compiler-rt/test/ubsan/TestCases/Misc/Posix/diag-stacktrace.cpp index 296171848255f..8b7cb6ade35ac 100644 --- a/compiler-rt/test/ubsan/TestCases/Misc/Posix/diag-stacktrace.cpp +++ b/compiler-rt/test/ubsan/TestCases/Misc/Posix/diag-stacktrace.cpp @@ -2,10 +2,10 @@ // UNSUPPORTED: target=thumb{{.*}} // UNSUPPORTED: android -// RUN: %clangxx -Wno-error=return-type -fsanitize=return %gmlt -O2 -fno-omit-frame-pointer -fasynchronous-unwind-tables %s -o %t +// RUN: %clangxx -fsanitize=return %gmlt -O2 -fno-omit-frame-pointer -fasynchronous-unwind-tables %s -o %t // RUN: %env_ubsan_opts=print_stacktrace=1:fast_unwind_on_fatal=0 not %run %t 2>&1 | FileCheck %s // RUN: %env_ubsan_opts=print_stacktrace=1:fast_unwind_on_fatal=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx -Wno-error=return-type -fsanitize=return %gmlt -O2 -fno-omit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %s -o %t +// RUN: %clangxx -fsanitize=return %gmlt -O2 -fno-omit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables %s -o %t // RUN: %env_ubsan_opts=print_stacktrace=1:fast_unwind_on_fatal=0 not %run %t 2>&1 | FileCheck %s // RUN: %env_ubsan_opts=print_stacktrace=1:fast_unwind_on_fatal=1 not %run %t 2>&1 | FileCheck %s diff --git a/compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp b/compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp index 6c1bc5525cd17..2ea76daf1fc16 100644 --- a/compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp +++ b/compiler-rt/test/ubsan/TestCases/Misc/missing_return.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -Wno-error=return-type -fsanitize=return %gmlt %s -O3 -o %t +// RUN: %clangxx -fsanitize=return %gmlt %s -O3 -o %t // RUN: not %run %t 2>&1 | FileCheck %s // RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-STACKTRACE // Error message does not exact what expected _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits