Author: alexfh Date: Thu Mar 15 01:27:42 2018 New Revision: 327610 URL: http://llvm.org/viewvc/llvm-project?rev=327610&view=rev Log: [clang-tidy] rename_check.py misc-unused-raii bugprone-unused-raii --check_class_name=UnusedRAIICheck
Added: clang-tools-extra/trunk/clang-tidy/bugprone/UnusedRaiiCheck.cpp - copied, changed from r327609, clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp clang-tools-extra/trunk/clang-tidy/bugprone/UnusedRaiiCheck.h - copied, changed from r327609, clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-unused-raii.rst - copied, changed from r327609, clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-raii.rst clang-tools-extra/trunk/test/clang-tidy/bugprone-unused-raii.cpp - copied, changed from r327609, clang-tools-extra/trunk/test/clang-tidy/misc-unused-raii.cpp Removed: clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-raii.rst clang-tools-extra/trunk/test/clang-tidy/misc-unused-raii.cpp Modified: clang-tools-extra/trunk/clang-tidy/bugprone/BugproneTidyModule.cpp clang-tools-extra/trunk/clang-tidy/bugprone/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/bugprone/BugproneTidyModule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/BugproneTidyModule.cpp?rev=327610&r1=327609&r2=327610&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/BugproneTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/bugprone/BugproneTidyModule.cpp Thu Mar 15 01:27:42 2018 @@ -42,6 +42,7 @@ #include "ThrowKeywordMissingCheck.h" #include "UndefinedMemoryManipulationCheck.h" #include "UndelegatedConstructorCheck.h" +#include "UnusedRaiiCheck.h" #include "UseAfterMoveCheck.h" #include "VirtualNearMissCheck.h" @@ -116,6 +117,8 @@ public: "bugprone-undefined-memory-manipulation"); CheckFactories.registerCheck<UndelegatedConstructorCheck>( "bugprone-undelegated-constructor"); + CheckFactories.registerCheck<UnusedRaiiCheck>( + "bugprone-unused-raii"); CheckFactories.registerCheck<UseAfterMoveCheck>( "bugprone-use-after-move"); CheckFactories.registerCheck<VirtualNearMissCheck>( Modified: clang-tools-extra/trunk/clang-tidy/bugprone/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/CMakeLists.txt?rev=327610&r1=327609&r2=327610&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/bugprone/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/bugprone/CMakeLists.txt Thu Mar 15 01:27:42 2018 @@ -34,6 +34,7 @@ add_clang_library(clangTidyBugproneModul ThrowKeywordMissingCheck.cpp UndefinedMemoryManipulationCheck.cpp UndelegatedConstructorCheck.cpp + UnusedRaiiCheck.cpp UseAfterMoveCheck.cpp VirtualNearMissCheck.cpp Copied: clang-tools-extra/trunk/clang-tidy/bugprone/UnusedRaiiCheck.cpp (from r327609, clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp) URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/UnusedRaiiCheck.cpp?p2=clang-tools-extra/trunk/clang-tidy/bugprone/UnusedRaiiCheck.cpp&p1=clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp&r1=327609&r2=327610&rev=327610&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/bugprone/UnusedRaiiCheck.cpp Thu Mar 15 01:27:42 2018 @@ -1,4 +1,4 @@ -//===--- UnusedRAIICheck.cpp - clang-tidy ---------------------------------===// +//===--- UnusedRaiiCheck.cpp - clang-tidy ---------------------------------===// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "UnusedRAIICheck.h" +#include "UnusedRaiiCheck.h" #include "clang/AST/ASTContext.h" #include "clang/Lex/Lexer.h" @@ -15,7 +15,7 @@ using namespace clang::ast_matchers; namespace clang { namespace tidy { -namespace misc { +namespace bugprone { namespace { AST_MATCHER(CXXRecordDecl, hasNonTrivialDestructor) { @@ -24,7 +24,7 @@ AST_MATCHER(CXXRecordDecl, hasNonTrivial } } // namespace -void UnusedRAIICheck::registerMatchers(MatchFinder *Finder) { +void UnusedRaiiCheck::registerMatchers(MatchFinder *Finder) { // Only register the matchers for C++; the functionality currently does not // provide any benefit to other languages, despite being benign. if (!getLangOpts().CPlusPlus) @@ -47,7 +47,7 @@ void UnusedRAIICheck::registerMatchers(M this); } -void UnusedRAIICheck::check(const MatchFinder::MatchResult &Result) { +void UnusedRaiiCheck::check(const MatchFinder::MatchResult &Result) { const auto *E = Result.Nodes.getNodeAs<Expr>("expr"); // We ignore code expanded from macros to reduce the number of false @@ -89,6 +89,6 @@ void UnusedRAIICheck::check(const MatchF Replacement); } -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang Copied: clang-tools-extra/trunk/clang-tidy/bugprone/UnusedRaiiCheck.h (from r327609, clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.h) URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/UnusedRaiiCheck.h?p2=clang-tools-extra/trunk/clang-tidy/bugprone/UnusedRaiiCheck.h&p1=clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.h&r1=327609&r2=327610&rev=327610&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.h (original) +++ clang-tools-extra/trunk/clang-tidy/bugprone/UnusedRaiiCheck.h Thu Mar 15 01:27:42 2018 @@ -1,4 +1,4 @@ -//===--- UnusedRAIICheck.h - clang-tidy -------------------------*- C++ -*-===// +//===--- UnusedRaiiCheck.h - clang-tidy -------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,29 +7,29 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSEDRAIICHECK_H -#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSEDRAIICHECK_H +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_UNUSEDRAIICHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_UNUSEDRAIICHECK_H #include "../ClangTidy.h" namespace clang { namespace tidy { -namespace misc { +namespace bugprone { /// Finds temporaries that look like RAII objects. /// /// For the user-facing documentation see: -/// http://clang.llvm.org/extra/clang-tidy/checks/misc-unused-raii.html -class UnusedRAIICheck : public ClangTidyCheck { +/// http://clang.llvm.org/extra/clang-tidy/checks/bugprone-unused-raii.html +class UnusedRaiiCheck : public ClangTidyCheck { public: - UnusedRAIICheck(StringRef Name, ClangTidyContext *Context) + UnusedRaiiCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context) {} void registerMatchers(ast_matchers::MatchFinder *Finder) override; void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; -} // namespace misc +} // namespace bugprone } // namespace tidy } // namespace clang -#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSEDRAIICHECK_H +#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_UNUSEDRAIICHECK_H Modified: clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt?rev=327610&r1=327609&r2=327610&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt Thu Mar 15 01:27:42 2018 @@ -13,7 +13,6 @@ add_clang_library(clangTidyMiscModule UniqueptrResetReleaseCheck.cpp UnusedAliasDeclsCheck.cpp UnusedParametersCheck.cpp - UnusedRAIICheck.cpp UnusedUsingDeclsCheck.cpp LINK_LIBS Modified: clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp?rev=327610&r1=327609&r2=327610&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp Thu Mar 15 01:27:42 2018 @@ -21,7 +21,6 @@ #include "UniqueptrResetReleaseCheck.h" #include "UnusedAliasDeclsCheck.h" #include "UnusedParametersCheck.h" -#include "UnusedRAIICheck.h" #include "UnusedUsingDeclsCheck.h" namespace clang { @@ -51,7 +50,6 @@ public: "misc-unused-alias-decls"); CheckFactories.registerCheck<UnusedParametersCheck>( "misc-unused-parameters"); - CheckFactories.registerCheck<UnusedRAIICheck>("misc-unused-raii"); CheckFactories.registerCheck<UnusedUsingDeclsCheck>( "misc-unused-using-decls"); } Removed: clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp?rev=327609&view=auto ============================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.cpp (removed) @@ -1,94 +0,0 @@ -//===--- UnusedRAIICheck.cpp - clang-tidy ---------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "UnusedRAIICheck.h" -#include "clang/AST/ASTContext.h" -#include "clang/Lex/Lexer.h" - -using namespace clang::ast_matchers; - -namespace clang { -namespace tidy { -namespace misc { - -namespace { -AST_MATCHER(CXXRecordDecl, hasNonTrivialDestructor) { - // TODO: If the dtor is there but empty we don't want to warn either. - return Node.hasDefinition() && Node.hasNonTrivialDestructor(); -} -} // namespace - -void UnusedRAIICheck::registerMatchers(MatchFinder *Finder) { - // Only register the matchers for C++; the functionality currently does not - // provide any benefit to other languages, despite being benign. - if (!getLangOpts().CPlusPlus) - return; - - // Look for temporaries that are constructed in-place and immediately - // destroyed. Look for temporaries created by a functional cast but not for - // those returned from a call. - auto BindTemp = - cxxBindTemporaryExpr(unless(has(ignoringParenImpCasts(callExpr())))) - .bind("temp"); - Finder->addMatcher( - exprWithCleanups(unless(isInTemplateInstantiation()), - hasParent(compoundStmt().bind("compound")), - hasType(cxxRecordDecl(hasNonTrivialDestructor())), - anyOf(has(ignoringParenImpCasts(BindTemp)), - has(ignoringParenImpCasts(cxxFunctionalCastExpr( - has(ignoringParenImpCasts(BindTemp))))))) - .bind("expr"), - this); -} - -void UnusedRAIICheck::check(const MatchFinder::MatchResult &Result) { - const auto *E = Result.Nodes.getNodeAs<Expr>("expr"); - - // We ignore code expanded from macros to reduce the number of false - // positives. - if (E->getLocStart().isMacroID()) - return; - - // Don't emit a warning for the last statement in the surrounding compund - // statement. - const auto *CS = Result.Nodes.getNodeAs<CompoundStmt>("compound"); - if (E == CS->body_back()) - return; - - // Emit a warning. - auto D = diag(E->getLocStart(), "object destroyed immediately after " - "creation; did you mean to name the object?"); - const char *Replacement = " give_me_a_name"; - - // If this is a default ctor we have to remove the parens or we'll introduce a - // most vexing parse. - const auto *BTE = Result.Nodes.getNodeAs<CXXBindTemporaryExpr>("temp"); - if (const auto *TOE = dyn_cast<CXXTemporaryObjectExpr>(BTE->getSubExpr())) - if (TOE->getNumArgs() == 0) { - D << FixItHint::CreateReplacement( - CharSourceRange::getTokenRange(TOE->getParenOrBraceRange()), - Replacement); - return; - } - - // Otherwise just suggest adding a name. To find the place to insert the name - // find the first TypeLoc in the children of E, which always points to the - // written type. - auto Matches = - match(expr(hasDescendant(typeLoc().bind("t"))), *E, *Result.Context); - const auto *TL = selectFirst<TypeLoc>("t", Matches); - D << FixItHint::CreateInsertion( - Lexer::getLocForEndOfToken(TL->getLocEnd(), 0, *Result.SourceManager, - getLangOpts()), - Replacement); -} - -} // namespace misc -} // namespace tidy -} // namespace clang Removed: clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.h?rev=327609&view=auto ============================================================================== --- clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.h (original) +++ clang-tools-extra/trunk/clang-tidy/misc/UnusedRAIICheck.h (removed) @@ -1,35 +0,0 @@ -//===--- UnusedRAIICheck.h - clang-tidy -------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSEDRAIICHECK_H -#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSEDRAIICHECK_H - -#include "../ClangTidy.h" - -namespace clang { -namespace tidy { -namespace misc { - -/// Finds temporaries that look like RAII objects. -/// -/// For the user-facing documentation see: -/// http://clang.llvm.org/extra/clang-tidy/checks/misc-unused-raii.html -class UnusedRAIICheck : public ClangTidyCheck { -public: - UnusedRAIICheck(StringRef Name, ClangTidyContext *Context) - : ClangTidyCheck(Name, Context) {} - void registerMatchers(ast_matchers::MatchFinder *Finder) override; - void check(const ast_matchers::MatchFinder::MatchResult &Result) override; -}; - -} // namespace misc -} // namespace tidy -} // namespace clang - -#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_UNUSEDRAIICHECK_H Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=327610&r1=327609&r2=327610&view=diff ============================================================================== --- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original) +++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Thu Mar 15 01:27:42 2018 @@ -114,6 +114,11 @@ Improvements to clang-tidy Warns or suggests alternatives if SIMD intrinsics are used which can be replaced by ``std::experimental::simd`` operations. +- New `zircon-temporary-objects + <http://clang.llvm.org/extra/clang-tidy/checks/zircon-temporary-objects.html>`_ check + + Warns on construction of specific temporary objects in the Zircon kernel. + - New alias `hicpp-avoid-goto <http://clang.llvm.org/extra/clang-tidy/checks/hicpp-avoid-goto.html>`_ to `cppcoreguidelines-avoid-goto <http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-avoid-goto.html>`_ @@ -170,10 +175,8 @@ Improvements to clang-tidy - The 'misc-undelegated-constructor' check was renamed to `bugprone-undelegated-constructor <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-undelegated-constructor.html>`_ -- New `zircon-temporary-objects - <http://clang.llvm.org/extra/clang-tidy/checks/zircon-temporary-objects.html>`_ check - - Warns on construction of specific temporary objects in the Zircon kernel. +- The 'misc-unused-raii' check was renamed to `bugprone-unused-raii + <http://clang.llvm.org/extra/clang-tidy/checks/bugprone-unused-raii.html>`_ Improvements to include-fixer ----------------------------- Copied: clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-unused-raii.rst (from r327609, clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-raii.rst) URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-unused-raii.rst?p2=clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-unused-raii.rst&p1=clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-raii.rst&r1=327609&r2=327610&rev=327610&view=diff ============================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-raii.rst (original) +++ clang-tools-extra/trunk/docs/clang-tidy/checks/bugprone-unused-raii.rst Thu Mar 15 01:27:42 2018 @@ -1,7 +1,7 @@ -.. title:: clang-tidy - misc-unused-raii +.. title:: clang-tidy - bugprone-unused-raii -misc-unused-raii -================ +bugprone-unused-raii +==================== Finds temporaries that look like RAII objects. Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst?rev=327610&r1=327609&r2=327610&view=diff ============================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst (original) +++ clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Thu Mar 15 01:27:42 2018 @@ -50,6 +50,7 @@ Clang-Tidy Checks bugprone-throw-keyword-missing bugprone-undefined-memory-manipulation bugprone-undelegated-constructor + bugprone-unused-raii bugprone-use-after-move bugprone-virtual-near-miss cert-dcl03-c (redirects to misc-static-assert) <cert-dcl03-c> @@ -153,7 +154,6 @@ Clang-Tidy Checks misc-uniqueptr-reset-release misc-unused-alias-decls misc-unused-parameters - misc-unused-raii misc-unused-using-decls modernize-avoid-bind modernize-deprecated-headers Removed: clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-raii.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-raii.rst?rev=327609&view=auto ============================================================================== --- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-raii.rst (original) +++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unused-raii.rst (removed) @@ -1,30 +0,0 @@ -.. title:: clang-tidy - misc-unused-raii - -misc-unused-raii -================ - -Finds temporaries that look like RAII objects. - -The canonical example for this is a scoped lock. - -.. code-block:: c++ - - { - scoped_lock(&global_mutex); - critical_section(); - } - -The destructor of the scoped_lock is called before the ``critical_section`` is -entered, leaving it unprotected. - -We apply a number of heuristics to reduce the false positive count of this -check: - -- Ignore code expanded from macros. Testing frameworks make heavy use of this. - -- Ignore types with trivial destructors. They are very unlikely to be RAII - objects and there's no difference when they are deleted. - -- Ignore objects at the end of a compound statement (doesn't change behavior). - -- Ignore objects returned from a call. Copied: clang-tools-extra/trunk/test/clang-tidy/bugprone-unused-raii.cpp (from r327609, clang-tools-extra/trunk/test/clang-tidy/misc-unused-raii.cpp) URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/bugprone-unused-raii.cpp?p2=clang-tools-extra/trunk/test/clang-tidy/bugprone-unused-raii.cpp&p1=clang-tools-extra/trunk/test/clang-tidy/misc-unused-raii.cpp&r1=327609&r2=327610&rev=327610&view=diff ============================================================================== --- clang-tools-extra/trunk/test/clang-tidy/misc-unused-raii.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/bugprone-unused-raii.cpp Thu Mar 15 01:27:42 2018 @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s misc-unused-raii %t +// RUN: %check_clang_tidy %s bugprone-unused-raii %t struct Foo { Foo(); Removed: clang-tools-extra/trunk/test/clang-tidy/misc-unused-raii.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-unused-raii.cpp?rev=327609&view=auto ============================================================================== --- clang-tools-extra/trunk/test/clang-tidy/misc-unused-raii.cpp (original) +++ clang-tools-extra/trunk/test/clang-tidy/misc-unused-raii.cpp (removed) @@ -1,68 +0,0 @@ -// RUN: %check_clang_tidy %s misc-unused-raii %t - -struct Foo { - Foo(); - Foo(int); - Foo(int, int); - ~Foo(); -}; - -struct Bar { - Bar(); -}; - -struct FooBar { - FooBar(); - Foo f; -}; - -template <typename T> -void qux() { - T(42); -} - -template <typename T> -struct TFoo { - TFoo(T); - ~TFoo(); -}; - -Foo f(); - -struct Ctor { - Ctor(int); - Ctor() { - Ctor(0); // TODO: warn here. - } -}; - -void test() { - Foo(42); -// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: object destroyed immediately after creation; did you mean to name the object? -// CHECK-FIXES: Foo give_me_a_name(42); - Foo(23, 42); -// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: object destroyed immediately after creation; did you mean to name the object? -// CHECK-FIXES: Foo give_me_a_name(23, 42); - Foo(); -// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: object destroyed immediately after creation; did you mean to name the object? -// CHECK-FIXES: Foo give_me_a_name; - TFoo<int>(23); -// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: object destroyed immediately after creation; did you mean to name the object? -// CHECK-FIXES: TFoo<int> give_me_a_name(23); - - FooBar(); -// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: object destroyed immediately after creation; did you mean to name the object? -// CHECK-FIXES: FooBar give_me_a_name; - - Bar(); - f(); - qux<Foo>(); - -#define M Foo(); - M - - { - Foo(); - } - Foo(); -} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits