[clang-tools-extra] r374540 - [ClangTidy] Separate tests for infrastructure and checkers
Dmitri Gribenko via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 11 05:05:46 PDT 2019
Removed: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-arc.m
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-arc.m?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-arc.m (original)
+++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-arc.m (removed)
@@ -1,16 +0,0 @@
-// RUN: clang-tidy %s -checks=-*,performance-unnecessary-value-param -- \
-// RUN: -xobjective-c -fobjc-abi-version=2 -fobjc-arc | count 0
-
-#if !__has_feature(objc_arc)
-#error Objective-C ARC not enabled as expected
-#endif
-
-// Passing an Objective-C ARC-managed object to a C function should
-// not raise performance-unnecessary-value-param.
-void foo(id object) { }
-
-// Same for explcitly non-ARC-managed Objective-C objects.
-void bar(__unsafe_unretained id object) { }
-
-// Same for Objective-c classes.
-void baz(Class c) { }
Removed: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-arc.mm
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-arc.mm?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-arc.mm (original)
+++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-arc.mm (removed)
@@ -1,16 +0,0 @@
-// RUN: clang-tidy %s -checks=-*,performance-unnecessary-value-param -- \
-// RUN: -xobjective-c++ -fobjc-abi-version=2 -fobjc-arc | count 0
-
-#if !__has_feature(objc_arc)
-#error Objective-C ARC not enabled as expected
-#endif
-
-// Passing an Objective-C ARC-managed object to a C function should
-// not raise performance-unnecessary-value-param.
-void foo(id object) { }
-
-// Same for explcitly non-ARC-managed Objective-C objects.
-void bar(__unsafe_unretained id object) { }
-
-// Same for Objective-c classes.
-void baz(Class c) { }
Removed: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-delayed.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-delayed.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-delayed.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-delayed.cpp (removed)
@@ -1,181 +0,0 @@
-// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- -- -fdelayed-template-parsing
-
-struct ExpensiveToCopyType {
- const ExpensiveToCopyType & constReference() const {
- return *this;
- }
- void nonConstMethod();
- virtual ~ExpensiveToCopyType();
-};
-
-void mutate(ExpensiveToCopyType &);
-void mutate(ExpensiveToCopyType *);
-void useAsConstReference(const ExpensiveToCopyType &);
-void useByValue(ExpensiveToCopyType);
-
-// This class simulates std::pair<>. It is trivially copy constructible
-// and trivially destructible, but not trivially copy assignable.
-class SomewhatTrivial {
- public:
- SomewhatTrivial();
- SomewhatTrivial(const SomewhatTrivial&) = default;
- ~SomewhatTrivial() = default;
- SomewhatTrivial& operator=(const SomewhatTrivial&);
-};
-
-void positiveExpensiveConstValue(const ExpensiveToCopyType Obj);
-// CHECK-FIXES: void positiveExpensiveConstValue(const ExpensiveToCopyType& Obj);
-void positiveExpensiveConstValue(const ExpensiveToCopyType Obj) {
- // CHECK-MESSAGES: [[@LINE-1]]:60: warning: the const qualified parameter 'Obj' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
- // CHECK-FIXES: void positiveExpensiveConstValue(const ExpensiveToCopyType& Obj) {
-}
-
-void positiveExpensiveValue(ExpensiveToCopyType Obj);
-// CHECK-FIXES: void positiveExpensiveValue(const ExpensiveToCopyType& Obj);
-void positiveExpensiveValue(ExpensiveToCopyType Obj) {
- // CHECK-MESSAGES: [[@LINE-1]]:49: warning: the parameter 'Obj' 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 positiveExpensiveValue(const ExpensiveToCopyType& Obj) {
- Obj.constReference();
- useAsConstReference(Obj);
- auto Copy = Obj;
- useByValue(Obj);
-}
-
-void positiveWithComment(const ExpensiveToCopyType /* important */ S);
-// CHECK-FIXES: void positiveWithComment(const ExpensiveToCopyType& /* important */ S);
-void positiveWithComment(const ExpensiveToCopyType /* important */ S) {
- // CHECK-MESSAGES: [[@LINE-1]]:68: warning: the const qualified
- // CHECK-FIXES: void positiveWithComment(const ExpensiveToCopyType& /* important */ S) {
-}
-
-void positiveUnnamedParam(const ExpensiveToCopyType) {
- // CHECK-MESSAGES: [[@LINE-1]]:52: warning: the const qualified parameter #1
- // CHECK-FIXES: void positiveUnnamedParam(const ExpensiveToCopyType&) {
-}
-
-void positiveAndNegative(const ExpensiveToCopyType ConstCopy, const ExpensiveToCopyType& ConstRef, ExpensiveToCopyType Copy);
-// CHECK-FIXES: void positiveAndNegative(const ExpensiveToCopyType& ConstCopy, const ExpensiveToCopyType& ConstRef, const ExpensiveToCopyType& Copy);
-void positiveAndNegative(const ExpensiveToCopyType ConstCopy, const ExpensiveToCopyType& ConstRef, ExpensiveToCopyType Copy) {
- // CHECK-MESSAGES: [[@LINE-1]]:52: warning: the const qualified parameter 'ConstCopy'
- // CHECK-MESSAGES: [[@LINE-2]]:120: warning: the parameter 'Copy'
- // CHECK-FIXES: void positiveAndNegative(const ExpensiveToCopyType& ConstCopy, const ExpensiveToCopyType& ConstRef, const ExpensiveToCopyType& Copy) {
-}
-
-struct PositiveConstValueConstructor {
- PositiveConstValueConstructor(const ExpensiveToCopyType ConstCopy) {}
- // CHECK-MESSAGES: [[@LINE-1]]:59: warning: the const qualified parameter 'ConstCopy'
- // CHECK-FIXES: PositiveConstValueConstructor(const ExpensiveToCopyType& ConstCopy) {}
-};
-
-template <typename T> void templateWithNonTemplatizedParameter(const ExpensiveToCopyType S, T V) {
- // CHECK-MESSAGES: [[@LINE-1]]:90: warning: the const qualified parameter 'S'
- // CHECK-FIXES: template <typename T> void templateWithNonTemplatizedParameter(const ExpensiveToCopyType& S, T V) {
-}
-
-void instantiated() {
- templateWithNonTemplatizedParameter(ExpensiveToCopyType(), ExpensiveToCopyType());
- templateWithNonTemplatizedParameter(ExpensiveToCopyType(), 5);
-}
-
-template <typename T> void negativeTemplateType(const T V) {
-}
-
-void negativeArray(const ExpensiveToCopyType[]) {
-}
-
-void negativePointer(ExpensiveToCopyType* Obj) {
-}
-
-void negativeConstPointer(const ExpensiveToCopyType* Obj) {
-}
-
-void negativeConstReference(const ExpensiveToCopyType& Obj) {
-}
-
-void negativeReference(ExpensiveToCopyType& Obj) {
-}
-
-void negativeUniversalReference(ExpensiveToCopyType&& Obj) {
-}
-
-void negativeSomewhatTrivialConstValue(const SomewhatTrivial Somewhat) {
-}
-
-void negativeSomewhatTrivialValue(SomewhatTrivial Somewhat) {
-}
-
-void negativeConstBuiltIn(const int I) {
-}
-
-void negativeValueBuiltIn(int I) {
-}
-
-void negativeValueIsMutatedByReference(ExpensiveToCopyType Obj) {
- mutate(Obj);
-}
-
-void negativeValueIsMutatatedByPointer(ExpensiveToCopyType Obj) {
- mutate(&Obj);
-}
-
-void negativeValueIsReassigned(ExpensiveToCopyType Obj) {
- Obj = ExpensiveToCopyType();
-}
-
-void negativeValueNonConstMethodIsCalled(ExpensiveToCopyType Obj) {
- Obj.nonConstMethod();
-}
-
-struct PositiveValueUnusedConstructor {
- PositiveValueUnusedConstructor(ExpensiveToCopyType Copy) {}
- // CHECK-MESSAGES: [[@LINE-1]]:54: warning: the parameter 'Copy'
- // CHECK-FIXES: PositiveValueUnusedConstructor(const ExpensiveToCopyType& Copy) {}
-};
-
-struct PositiveValueCopiedConstructor {
- PositiveValueCopiedConstructor(ExpensiveToCopyType Copy) : Field(Copy) {}
- // CHECK-MESSAGES: [[@LINE-1]]:54: warning: the parameter 'Copy'
- // CHECK-FIXES: PositiveValueCopiedConstructor(const ExpensiveToCopyType& Copy) : Field(Copy) {}
- ExpensiveToCopyType Field;
-};
-
-template <typename T>
-struct Container {
- typedef const T & const_reference;
-};
-
-void NegativeTypedefParam(const Container<ExpensiveToCopyType>::const_reference Param) {
-}
-
-#define UNNECESSARY_VALUE_PARAM_IN_MACRO_BODY() \
- void inMacro(const ExpensiveToCopyType T) { \
- } \
-// Ensure fix is not applied.
-// CHECK-FIXES: void inMacro(const ExpensiveToCopyType T) {
-
-UNNECESSARY_VALUE_PARAM_IN_MACRO_BODY()
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: the const qualified parameter 'T'
-
-#define UNNECESSARY_VALUE_PARAM_IN_MACRO_ARGUMENT(ARGUMENT) \
- ARGUMENT
-
-UNNECESSARY_VALUE_PARAM_IN_MACRO_ARGUMENT(void inMacroArgument(const ExpensiveToCopyType InMacroArg) {})
-// CHECK-MESSAGES: [[@LINE-1]]:90: warning: the const qualified parameter 'InMacroArg'
-// CHECK-FIXES: void inMacroArgument(const ExpensiveToCopyType InMacroArg) {}
-
-struct VirtualMethod {
- virtual ~VirtualMethod() {}
- virtual void handle(ExpensiveToCopyType T) const = 0;
-};
-
-struct NegativeOverriddenMethod : public VirtualMethod {
- void handle(ExpensiveToCopyType Overridden) const {
- // CHECK-FIXES: handle(ExpensiveToCopyType Overridden) const {
- }
-};
-
-struct NegativeDeletedMethod {
- ~NegativeDeletedMethod() {}
- NegativeDeletedMethod& operator=(NegativeDeletedMethod N) = delete;
- // CHECK-FIXES: NegativeDeletedMethod& operator=(NegativeDeletedMethod N) = delete;
-};
Removed: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-header.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-header.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-header.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-header.cpp (removed)
@@ -1,21 +0,0 @@
-// RUN: rm -rf %t
-// RUN: mkdir %t
-// RUN: cp %S/Inputs/performance-unnecessary-value-param/header.h %t/header.h
-// RUN: %check_clang_tidy -std=c++11 %s performance-unnecessary-value-param %t/temp -- -- -I %t
-// RUN: diff %t/header.h %S/Inputs/performance-unnecessary-value-param/header-fixed.h
-// FIXME: Make the test work in all language modes.
-
-#include "header.h"
-
-
-
-int f1(int n, ABC v1, ABC v2) {
- // CHECK-MESSAGES: [[@LINE-1]]:19: warning: the parameter 'v1' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
- // CHECK-MESSAGES: [[@LINE-2]]:27: 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 f1(int n, const ABC& v1, const ABC& v2) {
- return v1.get(n) + v2.get(n);
-}
-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) {
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-incomplete-type.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-incomplete-type.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-incomplete-type.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param-incomplete-type.cpp (removed)
@@ -1,9 +0,0 @@
-// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- -fix-errors
-
-// Ensure that incomplete types result in an error from the frontend and not a
-// clang-tidy diagnostic about IncompleteType being expensive to copy.
-struct IncompleteType;
-void NegativeForIncompleteType(IncompleteType I) {
- // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 'IncompleteType' [clang-diagnostic-error]
-}
-
Removed: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp (removed)
@@ -1,383 +0,0 @@
-// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t
-
-// CHECK-FIXES: #include <utility>
-
-struct ExpensiveToCopyType {
- const ExpensiveToCopyType & constReference() const {
- return *this;
- }
- void nonConstMethod();
- virtual ~ExpensiveToCopyType();
-};
-
-void mutate(ExpensiveToCopyType &);
-void mutate(ExpensiveToCopyType *);
-void useAsConstReference(const ExpensiveToCopyType &);
-void useByValue(ExpensiveToCopyType);
-
-template <class T> class Vector {
- public:
- using iterator = T*;
- using const_iterator = const T*;
-
- Vector(const Vector&);
- Vector& operator=(const Vector&);
-
- iterator begin();
- iterator end();
- const_iterator begin() const;
- const_iterator end() const;
-};
-
-// This class simulates std::pair<>. It is trivially copy constructible
-// and trivially destructible, but not trivially copy assignable.
-class SomewhatTrivial {
- public:
- SomewhatTrivial();
- SomewhatTrivial(const SomewhatTrivial&) = default;
- ~SomewhatTrivial() = default;
- SomewhatTrivial& operator=(const SomewhatTrivial&);
-};
-
-struct MoveOnlyType {
- MoveOnlyType(const MoveOnlyType &) = delete;
- MoveOnlyType(MoveOnlyType &&) = default;
- ~MoveOnlyType();
- void constMethod() const;
-};
-
-struct ExpensiveMovableType {
- ExpensiveMovableType();
- ExpensiveMovableType(ExpensiveMovableType &&);
- ExpensiveMovableType(const ExpensiveMovableType &) = default;
- ExpensiveMovableType &operator=(const ExpensiveMovableType &) = default;
- ExpensiveMovableType &operator=(ExpensiveMovableType &&);
- ~ExpensiveMovableType();
-};
-
-void positiveExpensiveConstValue(const ExpensiveToCopyType Obj);
-// CHECK-FIXES: void positiveExpensiveConstValue(const ExpensiveToCopyType& Obj);
-void positiveExpensiveConstValue(const ExpensiveToCopyType Obj) {
- // CHECK-MESSAGES: [[@LINE-1]]:60: warning: the const qualified parameter 'Obj' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
- // CHECK-FIXES: void positiveExpensiveConstValue(const ExpensiveToCopyType& Obj) {
-}
-
-void positiveExpensiveValue(ExpensiveToCopyType Obj);
-// CHECK-FIXES: void positiveExpensiveValue(const ExpensiveToCopyType& Obj);
-void positiveExpensiveValue(ExpensiveToCopyType Obj) {
- // CHECK-MESSAGES: [[@LINE-1]]:49: warning: the parameter 'Obj' 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 positiveExpensiveValue(const ExpensiveToCopyType& Obj) {
- Obj.constReference();
- useAsConstReference(Obj);
- auto Copy = Obj;
- useByValue(Obj);
-}
-
-void positiveVector(Vector<ExpensiveToCopyType> V) {
- // CHECK-MESSAGES: [[@LINE-1]]:49: warning: the parameter 'V' 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 positiveVector(const Vector<ExpensiveToCopyType>& V) {
- for (const auto& Obj : V) {
- useByValue(Obj);
- }
-}
-
-void positiveWithComment(const ExpensiveToCopyType /* important */ S);
-// CHECK-FIXES: void positiveWithComment(const ExpensiveToCopyType& /* important */ S);
-void positiveWithComment(const ExpensiveToCopyType /* important */ S) {
- // CHECK-MESSAGES: [[@LINE-1]]:68: warning: the const qualified
- // CHECK-FIXES: void positiveWithComment(const ExpensiveToCopyType& /* important */ S) {
-}
-
-void positiveUnnamedParam(const ExpensiveToCopyType) {
- // CHECK-MESSAGES: [[@LINE-1]]:52: warning: the const qualified parameter #1
- // CHECK-FIXES: void positiveUnnamedParam(const ExpensiveToCopyType&) {
-}
-
-void positiveAndNegative(const ExpensiveToCopyType ConstCopy, const ExpensiveToCopyType& ConstRef, ExpensiveToCopyType Copy);
-// CHECK-FIXES: void positiveAndNegative(const ExpensiveToCopyType& ConstCopy, const ExpensiveToCopyType& ConstRef, const ExpensiveToCopyType& Copy);
-void positiveAndNegative(const ExpensiveToCopyType ConstCopy, const ExpensiveToCopyType& ConstRef, ExpensiveToCopyType Copy) {
- // CHECK-MESSAGES: [[@LINE-1]]:52: warning: the const qualified parameter 'ConstCopy'
- // CHECK-MESSAGES: [[@LINE-2]]:120: warning: the parameter 'Copy'
- // CHECK-FIXES: void positiveAndNegative(const ExpensiveToCopyType& ConstCopy, const ExpensiveToCopyType& ConstRef, const ExpensiveToCopyType& Copy) {
-}
-
-struct PositiveConstValueConstructor {
- PositiveConstValueConstructor(const ExpensiveToCopyType ConstCopy) {}
- // CHECK-MESSAGES: [[@LINE-1]]:59: warning: the const qualified parameter 'ConstCopy'
- // CHECK-FIXES: PositiveConstValueConstructor(const ExpensiveToCopyType& ConstCopy) {}
-};
-
-template <typename T> void templateWithNonTemplatizedParameter(const ExpensiveToCopyType S, T V) {
- // CHECK-MESSAGES: [[@LINE-1]]:90: warning: the const qualified parameter 'S'
- // CHECK-FIXES: template <typename T> void templateWithNonTemplatizedParameter(const ExpensiveToCopyType& S, T V) {
-}
-
-void instantiated() {
- templateWithNonTemplatizedParameter(ExpensiveToCopyType(), ExpensiveToCopyType());
- templateWithNonTemplatizedParameter(ExpensiveToCopyType(), 5);
-}
-
-template <typename T> void negativeTemplateType(const T V) {
-}
-
-void negativeArray(const ExpensiveToCopyType[]) {
-}
-
-void negativePointer(ExpensiveToCopyType* Obj) {
-}
-
-void negativeConstPointer(const ExpensiveToCopyType* Obj) {
-}
-
-void negativeConstReference(const ExpensiveToCopyType& Obj) {
-}
-
-void negativeReference(ExpensiveToCopyType& Obj) {
-}
-
-void negativeUniversalReference(ExpensiveToCopyType&& Obj) {
-}
-
-void negativeSomewhatTrivialConstValue(const SomewhatTrivial Somewhat) {
-}
-
-void negativeSomewhatTrivialValue(SomewhatTrivial Somewhat) {
-}
-
-void negativeConstBuiltIn(const int I) {
-}
-
-void negativeValueBuiltIn(int I) {
-}
-
-void negativeValueIsMutatedByReference(ExpensiveToCopyType Obj) {
- mutate(Obj);
-}
-
-void negativeValueIsMutatatedByPointer(ExpensiveToCopyType Obj) {
- mutate(&Obj);
-}
-
-void negativeValueIsReassigned(ExpensiveToCopyType Obj) {
- Obj = ExpensiveToCopyType();
-}
-
-void negativeValueNonConstMethodIsCalled(ExpensiveToCopyType Obj) {
- Obj.nonConstMethod();
-}
-
-struct PositiveValueUnusedConstructor {
- PositiveValueUnusedConstructor(ExpensiveToCopyType Copy) {}
- // CHECK-MESSAGES: [[@LINE-1]]:54: warning: the parameter 'Copy'
- // CHECK-FIXES: PositiveValueUnusedConstructor(const ExpensiveToCopyType& Copy) {}
-};
-
-struct PositiveValueCopiedConstructor {
- PositiveValueCopiedConstructor(ExpensiveToCopyType Copy) : Field(Copy) {}
- // CHECK-MESSAGES: [[@LINE-1]]:54: warning: the parameter 'Copy'
- // CHECK-FIXES: PositiveValueCopiedConstructor(const ExpensiveToCopyType& Copy) : Field(Copy) {}
- ExpensiveToCopyType Field;
-};
-
-struct PositiveValueMovableConstructor {
- PositiveValueMovableConstructor(ExpensiveMovableType Copy) : Field(Copy) {}
- // CHECK-MESSAGES: [[@LINE-1]]:70: warning: parameter 'Copy'
- // CHECK-FIXES: PositiveValueMovableConstructor(ExpensiveMovableType Copy) : Field(std::move(Copy)) {}
- ExpensiveMovableType Field;
-};
-
-struct NegativeValueMovedConstructor {
- NegativeValueMovedConstructor(ExpensiveMovableType Copy) : Field(static_cast<ExpensiveMovableType &&>(Copy)) {}
- ExpensiveMovableType Field;
-};
-
-template <typename T>
-struct Container {
- typedef const T & const_reference;
-};
-
-void NegativeTypedefParam(const Container<ExpensiveToCopyType>::const_reference Param) {
-}
-
-#define UNNECESSARY_VALUE_PARAM_IN_MACRO_BODY() \
- void inMacro(const ExpensiveToCopyType T) { \
- } \
-// Ensure fix is not applied.
-// CHECK-FIXES: void inMacro(const ExpensiveToCopyType T) {
-
-UNNECESSARY_VALUE_PARAM_IN_MACRO_BODY()
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: the const qualified parameter 'T'
-
-#define UNNECESSARY_VALUE_PARAM_IN_MACRO_ARGUMENT(ARGUMENT) \
- ARGUMENT
-
-UNNECESSARY_VALUE_PARAM_IN_MACRO_ARGUMENT(void inMacroArgument(const ExpensiveToCopyType InMacroArg) {})
-// CHECK-MESSAGES: [[@LINE-1]]:90: warning: the const qualified parameter 'InMacroArg'
-// CHECK-FIXES: void inMacroArgument(const ExpensiveToCopyType InMacroArg) {}
-
-struct VirtualMethod {
- virtual ~VirtualMethod() {}
- virtual void handle(ExpensiveToCopyType T) const = 0;
-};
-
-struct NegativeOverriddenMethod : public VirtualMethod {
- void handle(ExpensiveToCopyType Overridden) const {
- // CHECK-FIXES: handle(ExpensiveToCopyType Overridden) const {
- }
-};
-
-struct VirtualMethodWarningOnly {
- virtual void methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
- // CHECK-MESSAGES: [[@LINE-1]]:66: warning: the parameter 'T' is copied
- // CHECK-FIXES: virtual void methodWithExpensiveValueParam(ExpensiveToCopyType T) {}
- virtual ~VirtualMethodWarningOnly() {}
-};
-
-struct PositiveNonVirualMethod {
- void method(const ExpensiveToCopyType T) {}
- // CHECK-MESSAGES: [[@LINE-1]]:41: warning: the const qualified parameter 'T' is copied
- // CHECK-FIXES: void method(const ExpensiveToCopyType& T) {}
-};
-
-struct NegativeDeletedMethod {
- ~NegativeDeletedMethod() {}
- NegativeDeletedMethod& operator=(NegativeDeletedMethod N) = delete;
- // CHECK-FIXES: NegativeDeletedMethod& operator=(NegativeDeletedMethod N) = delete;
-};
-
-void NegativeMoveOnlyTypePassedByValue(MoveOnlyType M) {
- M.constMethod();
-}
-
-void PositiveMoveOnCopyConstruction(ExpensiveMovableType E) {
- auto F = E;
- // CHECK-MESSAGES: [[@LINE-1]]:12: warning: parameter 'E' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
- // CHECK-FIXES: auto F = std::move(E);
-}
-
-void PositiveConstRefNotMoveSinceReferencedMultipleTimes(ExpensiveMovableType E) {
- // CHECK-MESSAGES: [[@LINE-1]]:79: warning: the parameter 'E' is copied
- // CHECK-FIXES: void PositiveConstRefNotMoveSinceReferencedMultipleTimes(const ExpensiveMovableType& E) {
- auto F = E;
- auto G = E;
-}
-
-void PositiveMoveOnCopyAssignment(ExpensiveMovableType E) {
- ExpensiveMovableType F;
- F = E;
- // CHECK-MESSAGES: [[@LINE-1]]:7: warning: parameter 'E' is passed by value
- // CHECK-FIXES: F = std::move(E);
-}
-
-struct NotCopyAssigned {
- NotCopyAssigned &operator=(const ExpensiveMovableType &);
-};
-
-void PositiveNoMoveForNonCopyAssigmentOperator(ExpensiveMovableType E) {
- // CHECK-MESSAGES: [[@LINE-1]]:69: warning: the parameter 'E' is copied
- // CHECK-FIXES: void PositiveNoMoveForNonCopyAssigmentOperator(const ExpensiveMovableType& E) {
- NotCopyAssigned N;
- N = E;
-}
-
-// The argument could be moved but is not since copy statement is inside a loop.
-void PositiveNoMoveInsideLoop(ExpensiveMovableType E) {
- // CHECK-MESSAGES: [[@LINE-1]]:52: warning: the parameter 'E' is copied
- // CHECK-FIXES: void PositiveNoMoveInsideLoop(const ExpensiveMovableType& E) {
- for (;;) {
- auto F = E;
- }
-}
-
-void PositiveConstRefNotMoveConstructible(ExpensiveToCopyType T) {
- // CHECK-MESSAGES: [[@LINE-1]]:63: warning: the parameter 'T' is copied
- // CHECK-FIXES: void PositiveConstRefNotMoveConstructible(const ExpensiveToCopyType& T) {
- auto U = T;
-}
-
-void PositiveConstRefNotMoveAssignable(ExpensiveToCopyType A) {
- // CHECK-MESSAGES: [[@LINE-1]]:60: warning: the parameter 'A' is copied
- // CHECK-FIXES: void PositiveConstRefNotMoveAssignable(const ExpensiveToCopyType& A) {
- ExpensiveToCopyType B;
- B = A;
-}
-
-// Case where parameter in declaration is already const-qualified but not in
-// implementation. Make sure a second 'const' is not added to the declaration.
-void PositiveConstDeclaration(const ExpensiveToCopyType A);
-// CHECK-FIXES: void PositiveConstDeclaration(const ExpensiveToCopyType& A);
-void PositiveConstDeclaration(ExpensiveToCopyType A) {
- // CHECK-MESSAGES: [[@LINE-1]]:51: warning: the parameter 'A' is copied
- // CHECK-FIXES: void PositiveConstDeclaration(const ExpensiveToCopyType& A) {
-}
-
-void PositiveNonConstDeclaration(ExpensiveToCopyType A);
-// CHECK-FIXES: void PositiveNonConstDeclaration(const ExpensiveToCopyType& A);
-void PositiveNonConstDeclaration(const ExpensiveToCopyType A) {
- // CHECK-MESSAGES: [[@LINE-1]]:60: warning: the const qualified parameter 'A'
- // CHECK-FIXES: void PositiveNonConstDeclaration(const ExpensiveToCopyType& A) {
-}
-
-void PositiveOnlyMessageAsReferencedInCompilationUnit(ExpensiveToCopyType A) {
- // CHECK-MESSAGES: [[@LINE-1]]:75: warning: the parameter 'A' is copied
- // CHECK-FIXES: void PositiveOnlyMessageAsReferencedInCompilationUnit(ExpensiveToCopyType A) {
-}
-
-void ReferenceFunctionOutsideOfCallExpr() {
- void (*ptr)(ExpensiveToCopyType) = &PositiveOnlyMessageAsReferencedInCompilationUnit;
-}
-
-void PositiveMessageAndFixAsFunctionIsCalled(ExpensiveToCopyType A) {
- // CHECK-MESSAGES: [[@LINE-1]]:66: warning: the parameter 'A' is copied
- // CHECK-FIXES: void PositiveMessageAndFixAsFunctionIsCalled(const ExpensiveToCopyType& A) {
-}
-
-void ReferenceFunctionByCallingIt() {
- PositiveMessageAndFixAsFunctionIsCalled(ExpensiveToCopyType());
-}
-
-// Virtual method overrides of dependent types cannot be recognized unless they
-// are marked as override or final. Test that check is not triggered on methods
-// marked with override or final.
-template <typename T>
-struct NegativeDependentTypeInterface {
- virtual void Method(ExpensiveToCopyType E) = 0;
-};
-
-template <typename T>
-struct NegativeOverrideImpl : public NegativeDependentTypeInterface<T> {
- void Method(ExpensiveToCopyType E) override {}
-};
-
-template <typename T>
-struct NegativeFinalImpl : public NegativeDependentTypeInterface<T> {
- void Method(ExpensiveToCopyType E) final {}
-};
-
-struct PositiveConstructor {
- PositiveConstructor(ExpensiveToCopyType E) : E(E) {}
- // CHECK-MESSAGES: [[@LINE-1]]:43: warning: the parameter 'E' is copied
- // CHECK-FIXES: PositiveConstructor(const ExpensiveToCopyType& E) : E(E) {}
-
- ExpensiveToCopyType E;
-};
-
-struct NegativeUsingConstructor : public PositiveConstructor {
- using PositiveConstructor::PositiveConstructor;
-};
-
-void fun() {
- ExpensiveToCopyType E;
- NegativeUsingConstructor S(E);
-}
-
-template<typename T>
-void templateFunction(T) {
-}
-
-template<>
-void templateFunction<ExpensiveToCopyType>(ExpensiveToCopyType E) {
- // CHECK-MESSAGES: [[@LINE-1]]:64: warning: the parameter 'E' is copied
- // CHECK-FIXES: void templateFunction<ExpensiveToCopyType>(ExpensiveToCopyType E) {
- E.constReference();
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/portability-simd-intrinsics-ppc.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/portability-simd-intrinsics-ppc.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/portability-simd-intrinsics-ppc.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/portability-simd-intrinsics-ppc.cpp (removed)
@@ -1,14 +0,0 @@
-// RUN: %check_clang_tidy -std=c++11,c++14,c++17 %s portability-simd-intrinsics %t -- \
-// RUN: -config='{CheckOptions: [ \
-// RUN: {key: portability-simd-intrinsics.Suggest, value: 1} \
-// RUN: ]}' -- -target ppc64le -maltivec
-// FIXME: Fix the checker to work in C++2a mode.
-
-vector int vec_add(vector int, vector int);
-
-void PPC() {
- vector int i0, i1;
-
- vec_add(i0, i1);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'vec_add' can be replaced by operator+ on std::experimental::simd objects [portability-simd-intrinsics]
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/portability-simd-intrinsics-x86.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/portability-simd-intrinsics-x86.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/portability-simd-intrinsics-x86.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/portability-simd-intrinsics-x86.cpp (removed)
@@ -1,26 +0,0 @@
-// RUN: %check_clang_tidy -std=c++11,c++14,c++17 %s portability-simd-intrinsics %t -- \
-// RUN: -config='{CheckOptions: [ \
-// RUN: {key: portability-simd-intrinsics.Suggest, value: 1} \
-// RUN: ]}' -- -target x86_64
-// FIXME: Fix the checker to work in C++2a mode.
-
-typedef long long __m128i __attribute__((vector_size(16)));
-typedef double __m256 __attribute__((vector_size(32)));
-
-__m128i _mm_add_epi32(__m128i, __m128i);
-__m256 _mm256_load_pd(double const *);
-void _mm256_store_pd(double *, __m256);
-
-int _mm_add_fake(int, int);
-
-void X86() {
- __m128i i0, i1;
- __m256 d0;
-
- _mm_add_epi32(i0, i1);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: '_mm_add_epi32' can be replaced by operator+ on std::experimental::simd objects [portability-simd-intrinsics]
- d0 = _mm256_load_pd(0);
- _mm256_store_pd(0, d0);
-
- _mm_add_fake(0, 1);
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/pr37091.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/pr37091.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/pr37091.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/pr37091.cpp (removed)
@@ -1,10 +0,0 @@
-// REQUIRES: shell
-// RUN: rm -rf %t
-// RUN: mkdir -p %t
-
-// This is a reproducer for PR37091.
-//
-// Verify that no temporary files are left behind by the clang-tidy invocation.
-
-// RUN: env TMPDIR=%t TEMP=%t TMP=%t clang-tidy %s -- --target=mips64
-// RUN: rmdir %t
Removed: clang-tools-extra/trunk/test/clang-tidy/read_file_config.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/read_file_config.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/read_file_config.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/read_file_config.cpp (removed)
@@ -1,13 +0,0 @@
-// REQUIRES: static-analyzer
-// RUN: mkdir -p %T/read-file-config/
-// RUN: cp %s %T/read-file-config/test.cpp
-// RUN: echo 'Checks: "-*,modernize-use-nullptr"' > %T/read-file-config/.clang-tidy
-// RUN: echo '[{"command": "cc -c -o test.o test.cpp", "directory": "%/T/read-file-config", "file": "%/T/read-file-config/test.cpp"}]' > %T/read-file-config/compile_commands.json
-// RUN: clang-tidy %T/read-file-config/test.cpp | not grep "warning: .*\[clang-analyzer-deadcode.DeadStores\]$"
-// RUN: clang-tidy -checks="-*,clang-analyzer-*" %T/read-file-config/test.cpp | grep "warning: .*\[clang-analyzer-deadcode.DeadStores\]$"
-
-void f() {
- int x;
- x = 1;
- x = 2;
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-avoid-const-params-in-decls.cpp (removed)
@@ -1,133 +0,0 @@
-// RUN: %check_clang_tidy %s readability-avoid-const-params-in-decls %t
-
-using alias_type = bool;
-using alias_const_type = const bool;
-
-
-void F1(const int i);
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 'i' is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
-// CHECK-FIXES: void F1(int i);
-
-void F2(const int *const i);
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 'i' is const-qualified
-// CHECK-FIXES: void F2(const int *i);
-
-void F3(int const i);
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 'i' is const-qualified
-// CHECK-FIXES: void F3(int i);
-
-void F4(alias_type const i);
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 'i' is const-qualified
-// CHECK-FIXES: void F4(alias_type i);
-
-void F5(const int);
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 1 is const-qualified
-// CHECK-FIXES: void F5(int);
-
-void F6(const int *const);
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 1 is const-qualified
-// CHECK-FIXES: void F6(const int *);
-
-void F7(int, const int);
-// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: parameter 2 is const-qualified
-// CHECK-FIXES: void F7(int, int);
-
-void F8(const int, const int);
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 1 is const-qualified
-// CHECK-MESSAGES: :[[@LINE-2]]:20: warning: parameter 2 is const-qualified
-// CHECK-FIXES: void F8(int, int);
-
-void F9(const int long_name);
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 'long_name'
-// CHECK-FIXES: void F9(int long_name);
-
-void F10(const int *const *const long_name);
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: parameter 'long_name'
-// CHECK-FIXES: void F10(const int *const *long_name);
-
-void F11(const unsigned int /*v*/);
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: parameter 1
-// CHECK-FIXES: void F11(unsigned int /*v*/);
-
-void F12(const bool b = true);
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: parameter 'b'
-// CHECK-FIXES: void F12(bool b = true);
-
-template<class T>
-int F13(const bool b = true);
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 'b'
-// CHECK-FIXES: int F13(bool b = true);
-int f13 = F13<int>();
-
-struct Foo {
- Foo(const int i);
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: parameter 'i'
- // CHECK-FIXES: Foo(int i);
-
- void operator()(const int i);
- // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: parameter 'i'
- // CHECK-FIXES: void operator()(int i);
-};
-
-template <class T>
-struct FooT {
- FooT(const int i);
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: parameter 'i'
- // CHECK-FIXES: FooT(int i);
-
- void operator()(const int i);
- // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: parameter 'i'
- // CHECK-FIXES: void operator()(int i);
-};
-FooT<int> f(1);
-
-// Do not match on definitions
-void NF1(const int i) {}
-void NF2(const int *const i) {}
-void NF3(int const i) {}
-void NF4(alias_type const i) {}
-void NF5(const int) {}
-void NF6(const int *const) {}
-void NF7(int, const int) {}
-void NF8(const int, const int) {}
-template <class T>
-int NF9(const int, const int) { return 0; }
-int nf9 = NF9<int>(1, 2);
-
-// Do not match on inline member functions
-struct Bar {
- Bar(const int i) {}
-
- void operator()(const int i) {}
-};
-
-// Do not match on inline member functions of a templated class
-template <class T>
-struct BarT {
- BarT(const int i) {}
-
- void operator()(const int i) {}
-};
-BarT<int> b(1);
-
-// Do not match on other stuff
-void NF(const alias_type& i);
-void NF(const int &i);
-void NF(const int *i);
-void NF(alias_const_type i);
-void NF(const alias_type&);
-void NF(const int&);
-void NF(const int*);
-void NF(const int* const*);
-void NF(alias_const_type);
-
-// Regression test for when the 'const' token is not in the code.
-#define CONCAT(a, b) a##b
-void ConstNotVisible(CONCAT(cons, t) int i);
-// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: parameter 'i'
-// We warn, but we can't give a fix
-// CHECK-FIXES: void ConstNotVisible(CONCAT(cons, t) int i);
-
-// Regression test. We should not warn (or crash) on lambda expressions
-auto lambda_with_name = [](const int n) {};
-auto lambda_without_name = [](const int) {};
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-avoid-underscore-in-googletest-name.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-avoid-underscore-in-googletest-name.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-avoid-underscore-in-googletest-name.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-avoid-underscore-in-googletest-name.cpp (removed)
@@ -1,108 +0,0 @@
-// RUN: %check_clang_tidy %s google-readability-avoid-underscore-in-googletest-name %t
-
-#define TEST(test_case_name, test_name) void test_case_name##test_name()
-#define TEST_F(test_case_name, test_name) void test_case_name##test_name()
-#define TEST_P(test_case_name, test_name) void test_case_name##test_name()
-#define TYPED_TEST(test_case_name, test_name) void test_case_name##test_name()
-#define TYPED_TEST_P(test_case_name, test_name) void test_case_name##test_name()
-#define FRIEND_TEST(test_case_name, test_name) void test_case_name##test_name()
-
-TEST(TestCaseName, Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-TEST(TestCaseName, DISABLED_Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TEST(TestCaseName, Illegal_Test_Name) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TEST(Illegal_TestCaseName, TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: avoid using "_" in test case name "Illegal_TestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TEST(Illegal_Test_CaseName, TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: avoid using "_" in test case name "Illegal_Test_CaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TEST(Illegal_TestCaseName, Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: avoid using "_" in test case name "Illegal_TestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-// CHECK-MESSAGES: :[[@LINE-2]]:28: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-TEST_F(TestCaseFixtureName, Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TEST_F(TestCaseFixtureName, DISABLED_Illegal_Test_Name) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TEST_F(TestCaseFixtureName, Illegal_Test_Name) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:29: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-TEST_F(Illegal_TestCaseFixtureName, TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_TestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TEST_F(Illegal_TestCaseFixtureName, Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_TestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-// CHECK-MESSAGES: :[[@LINE-2]]:37: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-TEST_F(Illegal_Test_CaseFixtureName, TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_Test_CaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-TEST_P(ParameterizedTestCaseFixtureName, Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TEST_P(ParameterizedTestCaseFixtureName, DISABLED_Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TEST_P(ParameterizedTestCaseFixtureName, Illegal_Test_Name) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:42: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-TEST_P(Illegal_ParameterizedTestCaseFixtureName, TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_ParameterizedTestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TEST_P(Illegal_ParameterizedTestCaseFixtureName, Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_ParameterizedTestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-// CHECK-MESSAGES: :[[@LINE-2]]:50: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-TEST_P(Illegal_Parameterized_TestCaseFixtureName, TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: avoid using "_" in test case name "Illegal_Parameterized_TestCaseFixtureName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-TYPED_TEST(TypedTestCaseName, Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TYPED_TEST(TypedTestCaseName, DISABLED_Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TYPED_TEST(TypedTestCaseName, Illegal_Test_Name) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:31: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-TYPED_TEST(Illegal_TypedTestCaseName, TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: avoid using "_" in test case name "Illegal_TypedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TYPED_TEST(Illegal_TypedTestCaseName, Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: avoid using "_" in test case name "Illegal_TypedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-// CHECK-MESSAGES: :[[@LINE-2]]:39: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-TYPED_TEST(Illegal_Typed_TestCaseName, TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: avoid using "_" in test case name "Illegal_Typed_TestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-TYPED_TEST_P(TypeParameterizedTestCaseName, Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TYPED_TEST_P(TypeParameterizedTestCaseName, DISABLED_Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TYPED_TEST_P(TypeParameterizedTestCaseName, Illegal_Test_Name) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:45: warning: avoid using "_" in test name "Illegal_Test_Name" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-TYPED_TEST_P(Illegal_TypeParameterizedTestCaseName, TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: avoid using "_" in test case name "Illegal_TypeParameterizedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-TYPED_TEST_P(Illegal_TypeParameterizedTestCaseName, Illegal_TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: avoid using "_" in test case name "Illegal_TypeParameterizedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-// CHECK-MESSAGES: :[[@LINE-2]]:53: warning: avoid using "_" in test name "Illegal_TestName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-TYPED_TEST_P(Illegal_Type_ParameterizedTestCaseName, TestName) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: avoid using "_" in test case name "Illegal_Type_ParameterizedTestCaseName" according to Googletest FAQ [google-readability-avoid-underscore-in-googletest-name]
-
-// Underscores are allowed to disable a test with the DISABLED_ prefix.
-// https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore
-TEST(TestCaseName, TestName) {}
-TEST(TestCaseName, DISABLED_TestName) {}
-
-TEST_F(TestCaseFixtureName, TestName) {}
-TEST_F(TestCaseFixtureName, DISABLED_TestName) {}
-
-TEST_P(ParameterizedTestCaseFixtureName, TestName) {}
-TEST_P(ParameterizedTestCaseFixtureName, DISABLED_TestName) {}
-
-TYPED_TEST(TypedTestName, TestName) {}
-TYPED_TEST(TypedTestName, DISABLED_TestName) {}
-
-TYPED_TEST_P(TypeParameterizedTestName, TestName) {}
-TYPED_TEST_P(TypeParameterizedTestName, DISABLED_TestName) {}
-
-FRIEND_TEST(FriendTest, Is_NotChecked) {}
-FRIEND_TEST(Friend_Test, IsNotChecked) {}
-FRIEND_TEST(Friend_Test, Is_NotChecked) {}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-assert-failure.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-assert-failure.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-assert-failure.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-assert-failure.cpp (removed)
@@ -1,12 +0,0 @@
-// RUN: not clang-tidy -checks='-*,readability-braces-around-statements' %s --
-
-// Note: this test expects no assert failure happened in clang-tidy.
-
-int test_failure() {
- if (std::rand()) {
- }
-}
-
-void test_failure2() {
- for (a b c;;
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-few-lines.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-few-lines.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-few-lines.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-few-lines.cpp (removed)
@@ -1,30 +0,0 @@
-// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 4}]}" --
-
-void do_something(const char *) {}
-
-bool cond(const char *) {
- return false;
-}
-
-void test() {
- if (cond("if1") /*comment*/) do_something("same-line");
-
- if (cond("if2"))
- do_something("single-line");
-
- if (cond("if3") /*comment*/)
- // some comment
- do_something("three"
- "lines");
-
- if (cond("if4") /*comment*/)
- // some comment
- do_something("many"
- "many"
- "many"
- "many"
- "lines");
- // CHECK-MESSAGES: :[[@LINE-7]]:31: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("if4") /*comment*/) {
- // CHECK-FIXES: }
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-format.cpp (removed)
@@ -1,33 +0,0 @@
-// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -format-style="{IndentWidth: 3}" --
-
-void do_something(const char *) {}
-
-bool cond(const char *) {
- return false;
-}
-
-void test() {
- if (cond("if0") /*comment*/) do_something("same-line");
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: statement should be inside braces
- // CHECK-FIXES: {{^}} if (cond("if0") /*comment*/) {{{$}}
- // CHECK-FIXES-NEXT: {{^}} do_something("same-line");{{$}}
- // CHECK-FIXES-NEXT: {{^}} }{{$}}
-
- if (1) while (2) if (3) for (;;) do ; while(false) /**/;/**/
- // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: statement should be inside braces
- // CHECK-MESSAGES: :[[@LINE-2]]:19: warning: statement should be inside braces
- // CHECK-MESSAGES: :[[@LINE-3]]:26: warning: statement should be inside braces
- // CHECK-MESSAGES: :[[@LINE-4]]:35: warning: statement should be inside braces
- // CHECK-MESSAGES: :[[@LINE-5]]:38: warning: statement should be inside braces
- // CHECK-FIXES: {{^}} if (1) {{{$}}
- // CHECK-FIXES-NEXT: {{^}} while (2) {
- // CHECK-FIXES-NEXT: {{^}} if (3) {
- // CHECK-FIXES-NEXT: {{^}} for (;;) {
- // CHECK-FIXES-NEXT: {{^}} do {
- // CHECK-FIXES-NEXT: {{^}} ;
- // CHECK-FIXES-NEXT: {{^}} } while (false) /**/; /**/
- // CHECK-FIXES-NEXT: {{^}} }
- // CHECK-FIXES-NEXT: {{^}} }
- // CHECK-FIXES-NEXT: {{^}} }
- // CHECK-FIXES-NEXT: {{^}} }
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-same-line.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-same-line.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-same-line.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-same-line.cpp (removed)
@@ -1,36 +0,0 @@
-// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 1}]}" --
-
-void do_something(const char *) {}
-
-bool cond(const char *) {
- return false;
-}
-
-void test() {
- if (cond("if1") /*comment*/) do_something("same-line");
-
- if (cond("if2"))
- do_something("single-line");
- // CHECK-MESSAGES: :[[@LINE-2]]:19: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("if2")) {
- // CHECK-FIXES: }
-
- if (cond("if3") /*comment*/)
- // some comment
- do_something("three"
- "lines");
- // CHECK-MESSAGES: :[[@LINE-4]]:31: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("if3") /*comment*/) {
- // CHECK-FIXES: }
-
- if (cond("if4") /*comment*/)
- // some comment
- do_something("many"
- "many"
- "many"
- "many"
- "lines");
- // CHECK-MESSAGES: :[[@LINE-7]]:31: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("if4") /*comment*/) {
- // CHECK-FIXES: }
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-single-line.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-single-line.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-single-line.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements-single-line.cpp (removed)
@@ -1,33 +0,0 @@
-// RUN: %check_clang_tidy %s readability-braces-around-statements %t -- -config="{CheckOptions: [{key: readability-braces-around-statements.ShortStatementLines, value: 2}]}" --
-
-void do_something(const char *) {}
-
-bool cond(const char *) {
- return false;
-}
-
-void test() {
- if (cond("if1") /*comment*/) do_something("same-line");
-
- if (cond("if2"))
- do_something("single-line");
-
- if (cond("if3") /*comment*/)
- // some comment
- do_something("three"
- "lines");
- // CHECK-MESSAGES: :[[@LINE-4]]:31: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("if3") /*comment*/) {
- // CHECK-FIXES: }
-
- if (cond("if4") /*comment*/)
- // some comment
- do_something("many"
- "many"
- "many"
- "many"
- "lines");
- // CHECK-MESSAGES: :[[@LINE-7]]:31: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("if4") /*comment*/) {
- // CHECK-FIXES: }
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-braces-around-statements.cpp (removed)
@@ -1,206 +0,0 @@
-// RUN: %check_clang_tidy %s readability-braces-around-statements %t
-
-void do_something(const char *) {}
-
-bool cond(const char *) {
- return false;
-}
-
-#define EMPTY_MACRO
-#define EMPTY_MACRO_FUN()
-
-void test() {
- if (cond("if0") /*comment*/) do_something("same-line");
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("if0") /*comment*/) { do_something("same-line");
- // CHECK-FIXES: }
-
- if (cond("if0.1"))
- do_something("single-line");
- // CHECK-MESSAGES: :[[@LINE-2]]:21: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("if0.1")) {
- // CHECK-FIXES: }
-
- if (cond("if1") /*comment*/)
- // some comment
- do_something("if1");
- // CHECK-MESSAGES: :[[@LINE-3]]:31: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("if1") /*comment*/) {
- // CHECK-FIXES: }
- if (cond("if2")) {
- do_something("if2");
- }
- if (cond("if3"))
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:19: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("if3")) {
- // CHECK-FIXES: }
-
- if (cond("if-else1"))
- do_something("if-else1");
- // CHECK-MESSAGES: :[[@LINE-2]]:24: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("if-else1")) {
- // CHECK-FIXES: } else {
- else
- do_something("if-else1 else");
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: statement should be inside braces
- // CHECK-FIXES: }
- if (cond("if-else2")) {
- do_something("if-else2");
- } else {
- do_something("if-else2 else");
- }
-
- if (cond("if-else if-else1"))
- do_something("if");
- // CHECK-MESSAGES: :[[@LINE-2]]:32: warning: statement should be inside braces
- // CHECK-FIXES: } else if (cond("else if1")) {
- else if (cond("else if1"))
- do_something("else if");
- // CHECK-MESSAGES: :[[@LINE-2]]:29: warning: statement should be inside braces
- else
- do_something("else");
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: statement should be inside braces
- // CHECK-FIXES: }
- if (cond("if-else if-else2")) {
- do_something("if");
- } else if (cond("else if2")) {
- do_something("else if");
- } else {
- do_something("else");
- }
-
- for (;;)
- do_something("for");
- // CHECK-MESSAGES: :[[@LINE-2]]:11: warning: statement should be inside braces
- // CHECK-FIXES: for (;;) {
- // CHECK-FIXES: }
- for (;;) {
- do_something("for");
- }
- for (;;)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:11: warning: statement should be inside braces
- // CHECK-FIXES: for (;;) {
- // CHECK-FIXES: }
-
- int arr[4] = {1, 2, 3, 4};
- for (int a : arr)
- do_something("for-range");
- // CHECK-MESSAGES: :[[@LINE-2]]:20: warning: statement should be inside braces
- // CHECK-FIXES: for (int a : arr) {
- // CHECK-FIXES: }
- for (int a : arr) {
- do_something("for-range");
- }
- for (int a : arr)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:20: warning: statement should be inside braces
- // CHECK-FIXES: for (int a : arr) {
- // CHECK-FIXES: }
-
- while (cond("while1"))
- do_something("while");
- // CHECK-MESSAGES: :[[@LINE-2]]:25: warning: statement should be inside braces
- // CHECK-FIXES: while (cond("while1")) {
- // CHECK-FIXES: }
- while (cond("while2")) {
- do_something("while");
- }
- while (false)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:16: warning: statement should be inside braces
- // CHECK-FIXES: while (false) {
- // CHECK-FIXES: }
-
- do
- do_something("do1");
- while (cond("do1"));
- // CHECK-MESSAGES: :[[@LINE-3]]:5: warning: statement should be inside braces
- // CHECK-FIXES: do {
- // CHECK-FIXES: } while (cond("do1"));
- do {
- do_something("do2");
- } while (cond("do2"));
-
- do
- ;
- while (false);
- // CHECK-MESSAGES: :[[@LINE-3]]:5: warning: statement should be inside braces
- // CHECK-FIXES: do {
- // CHECK-FIXES: } while (false);
-
- if (cond("ifif1"))
- // comment
- if (cond("ifif2"))
- // comment
- /*comment*/ ; // comment
- // CHECK-MESSAGES: :[[@LINE-5]]:21: warning: statement should be inside braces
- // CHECK-MESSAGES: :[[@LINE-4]]:23: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("ifif1")) {
- // CHECK-FIXES: if (cond("ifif2")) {
- // CHECK-FIXES: }
- // CHECK-FIXES-NEXT: }
-
- if (cond("ifif3"))
- // comment
- if (cond("ifif4")) {
- // comment
- /*comment*/; // comment
- }
- // CHECK-MESSAGES: :[[@LINE-6]]:21: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("ifif3")) {
- // CHECK-FIXES: }
-
- if (cond("ifif5"))
- ; /* multi-line
- comment */
- // CHECK-MESSAGES: :[[@LINE-3]]:21: warning: statement should be inside braces
- // CHECK-FIXES: if (cond("ifif5")) {
- // CHECK-FIXES: }/* multi-line
-
- if (1) while (2) if (3) for (;;) do ; while(false) /**/;/**/
- // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: statement should be inside braces
- // CHECK-MESSAGES: :[[@LINE-2]]:19: warning: statement should be inside braces
- // CHECK-MESSAGES: :[[@LINE-3]]:26: warning: statement should be inside braces
- // CHECK-MESSAGES: :[[@LINE-4]]:35: warning: statement should be inside braces
- // CHECK-MESSAGES: :[[@LINE-5]]:38: warning: statement should be inside braces
- // CHECK-FIXES: if (1) { while (2) { if (3) { for (;;) { do { ; } while(false) /**/;/**/
- // CHECK-FIXES-NEXT: }
- // CHECK-FIXES-NEXT: }
- // CHECK-FIXES-NEXT: }
- // CHECK-FIXES-NEXT: }
-}
-
-void f(const char *p) {
- if (!p)
- f("\
-");
-} // end of f
-// CHECK-MESSAGES: :[[@LINE-4]]:10: warning: statement should be inside braces
-// CHECK-FIXES: {{^}} if (!p) {{{$}}
-// CHECK-FIXES-NEXT: {{^}} f("\{{$}}
-// CHECK-FIXES-NEXT: {{^}}");{{$}}
-// CHECK-FIXES-NEXT: {{^}}}{{$}}
-// CHECK-FIXES-NEXT: {{^}}} // end of f{{$}}
-
-#define M(x) x
-
-int test_macros(bool b) {
- if (b) {
- return 1;
- } else
- M(return 2);
- // CHECK-MESSAGES: :[[@LINE-2]]:9: warning: statement should be inside braces
- // CHECK-FIXES: } else {
- // CHECK-FIXES-NEXT: M(return 2);
- // CHECK-FIXES-NEXT: }
- M(
- for (;;)
- ;
- );
- // CHECK-MESSAGES: :[[@LINE-3]]:13: warning: statement should be inside braces
- // CHECK-FIXES: {{^}} for (;;) {{{$}}
- // CHECK-FIXES-NEXT: {{^ ;$}}
- // CHECK-FIXES-NEXT: {{^}$}}
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-const-return-type.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-const-return-type.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-const-return-type.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-const-return-type.cpp (removed)
@@ -1,234 +0,0 @@
-// RUN: %check_clang_tidy %s readability-const-return-type %t
-
-// p# = positive test
-// n# = negative test
-
-namespace std {
-template< class T >
-struct add_cv { typedef const volatile T type; };
-
-template< class T> struct add_const { typedef const T type; };
-
-template< class T> struct add_volatile { typedef volatile T type; };
-}
-
-const int p1() {
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness
-// CHECK-FIXES: int p1() {
- return 1;
-}
-
-const int p15();
-// CHECK-FIXES: int p15();
-
-template <typename T>
-const int p31(T v) { return 2; }
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qu
-// CHECK-FIXES: int p31(T v) { return 2; }
-
-// We detect const-ness even without instantiating T.
-template <typename T>
-const T p32(T t) { return t; }
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const T' is 'const'-qual
-// CHECK-FIXES: T p32(T t) { return t; }
-
-// However, if the return type is itself a template instantiation, Clang does
-// not consider it const-qualified without knowing `T`.
-template <typename T>
-typename std::add_const<T>::type n15(T v) { return v; }
-
-template <typename A>
-class Klazz {
-public:
- Klazz(A) {}
-};
-
-class Clazz {
- public:
- Clazz *const p2() {
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: return type 'Clazz *const' is 'co
- // CHECK-FIXES: Clazz *p2() {
- return this;
- }
-
- Clazz *const p3();
- // CHECK-FIXES: Clazz *p3();
-
- const int p4() const {
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: return type 'const int' is 'const
- // CHECK-FIXES: int p4() const {
- return 4;
- }
-
- const Klazz<const int>* const p5() const;
- // CHECK-FIXES: const Klazz<const int>* p5() const;
-
- const Clazz operator++(int x) { // p12
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: return type 'const Clazz' is 'const
- // CHECK-FIXES: Clazz operator++(int x) {
- }
-
- struct Strukt {
- int i;
- };
-
- const Strukt p6() {}
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: return type 'const Clazz::Strukt' i
- // CHECK-FIXES: Strukt p6() {}
-
- // No warning is emitted here, because this is only the declaration. The
- // warning will be associated with the definition, below.
- const Strukt* const p7();
- // CHECK-FIXES: const Strukt* p7();
-
- // const-qualifier is the first `const` token, but not the first token.
- static const int p8() {}
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: return type 'const int' is 'const'-
- // CHECK-FIXES: static int p8() {}
-
- static const Strukt p9() {}
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: return type 'const Clazz::Strukt' i
- // CHECK-FIXES: static Strukt p9() {}
-
- int n0() const { return 0; }
- const Klazz<const int>& n11(const Klazz<const int>) const;
-};
-
-Clazz *const Clazz::p3() {
- // CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'Clazz *const' is 'cons
- // CHECK-FIXES: Clazz *Clazz::p3() {
- return this;
-}
-
-const Klazz<const int>* const Clazz::p5() const {}
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const Klazz<const int> *
-// CHECK-FIXES: const Klazz<const int>* Clazz::p5() const {}
-
-const Clazz::Strukt* const Clazz::p7() {}
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const Clazz::Strukt *con
-// CHECK-FIXES: const Clazz::Strukt* Clazz::p7() {}
-
-Clazz *const p10();
-// CHECK-FIXES: Clazz *p10();
-
-Clazz *const p10() {
- // CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'Clazz *const' is 'cons
- // CHECK-FIXES: Clazz *p10() {
- return new Clazz();
-}
-
-const Clazz bar;
-const Clazz *const p11() {
- // CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const Clazz *const' is
- // CHECK-FIXES: const Clazz *p11() {
- return &bar;
-}
-
-const Klazz<const int> p12() {}
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const Klazz<const int>'
-// CHECK-FIXES: Klazz<const int> p12() {}
-
-const Klazz<const int>* const p13() {}
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const Klazz<const int> *
-// CHECK-FIXES: const Klazz<const int>* p13() {}
-
-// re-declaration of p15.
-const int p15();
-// CHECK-FIXES: int p15();
-
-const int p15() {
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning:
-// CHECK-FIXES: int p15() {
- return 0;
-}
-
-// Exercise the lexer.
-
-const /* comment */ /* another comment*/ int p16() { return 0; }
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning:
-// CHECK-FIXES: /* comment */ /* another comment*/ int p16() { return 0; }
-
-/* comment */ const
-// CHECK-MESSAGES: [[@LINE-1]]:15: warning:
-// CHECK-FIXES: /* comment */
-// more
-/* another comment*/ int p17() { return 0; }
-
-// Test cases where the `const` token lexically is hidden behind some form of
-// indirection.
-
-#define CONSTINT const int
-CONSTINT p18() {}
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qu
-
-#define CONST const
-CONST int p19() {}
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qu
-
-using ty = const int;
-ty p21() {}
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'ty' (aka 'const int') is
-
-typedef const int ty2;
-ty2 p22() {}
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'ty2' (aka 'const int') i
-
-// Declaration uses a macro, while definition doesn't. In this case, we won't
-// fix the declaration, and will instead issue a warning.
-CONST int p23();
-// CHECK-NOTE: [[@LINE-1]]:1: note: could not transform this declaration
-
-const int p23();
-// CHECK-FIXES: int p23();
-
-const int p23() { return 3; }
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qu
-// CHECK-FIXES: int p23() { return 3; }
-
-int const p24() { return 3; }
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qu
-// CHECK-FIXES: int p24() { return 3; }
-
-int const * const p25(const int* p) { return p; }
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int *const' is 'co
-// CHECK-FIXES: int const * p25(const int* p) { return p; }
-
-// We cannot (yet) fix instances that use trailing return types, but we can
-// warn.
-auto p26() -> const int { return 3; }
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qu
-auto p27() -> int const { return 3; }
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const int' is 'const'-qu
-
-std::add_const<int>::type p28() { return 3; }
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'std::add_const<int>::typ
-
-// p29, p30 are based on
-// llvm/projects/test-suite/SingleSource/Benchmarks/Misc-C++-EH/spirit.cpp:
-template <class T>
-Klazz<T const> const p29(T const &t) { return {}; }
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const Klazz<const T>' is
-// CHECK-FIXES: Klazz<T const> p29(T const &t) { return {}; }
-
-Klazz<char const *> const p30(char const *s) { return s; }
-// CHECK-MESSAGES: [[@LINE-1]]:1: warning: return type 'const Klazz<const char *
-// CHECK-FIXES: Klazz<char const *> p30(char const *s) { return s; }
-
-const int n1 = 1;
-const Clazz n2 = Clazz();
-const Clazz* n3 = new Clazz();
-Clazz *const n4 = new Clazz();
-const Clazz *const n5 = new Clazz();
-constexpr int n6 = 6;
-constexpr int n7() { return 8; }
-const int eight = 8;
-constexpr const int* n8() { return &eight; }
-Klazz<const int> n9();
-const Klazz<const int>* n10();
-const Klazz<const int>& Clazz::n11(const Klazz<const int>) const {}
-
-// Declaration only.
-const int n14();
-
-int **const * n_multiple_ptr();
-int *const & n_pointer_ref();
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-container-size-empty.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-container-size-empty.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-container-size-empty.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-container-size-empty.cpp (removed)
@@ -1,444 +0,0 @@
-// RUN: %check_clang_tidy %s readability-container-size-empty %t
-
-namespace std {
-template <typename T> struct vector {
- vector();
- bool operator==(const vector<T>& other) const;
- bool operator!=(const vector<T>& other) const;
- unsigned long size() const;
- bool empty() const;
-};
-
-template <typename T> struct basic_string {
- basic_string();
- bool operator==(const basic_string<T>& other) const;
- bool operator!=(const basic_string<T>& other) const;
- bool operator==(const char *) const;
- bool operator!=(const char *) const;
- basic_string<T> operator+(const basic_string<T>& other) const;
- unsigned long size() const;
- bool empty() const;
-};
-
-typedef basic_string<char> string;
-typedef basic_string<wchar_t> wstring;
-
-inline namespace __v2 {
-template <typename T> struct set {
- set();
- bool operator==(const set<T>& other) const;
- bool operator!=(const set<T>& other) const;
- unsigned long size() const;
- bool empty() const;
-};
-}
-
-}
-
-template <typename T>
-class TemplatedContainer {
-public:
- bool operator==(const TemplatedContainer<T>& other) const;
- bool operator!=(const TemplatedContainer<T>& other) const;
- int size() const;
- bool empty() const;
-};
-
-template <typename T>
-class PrivateEmpty {
-public:
- bool operator==(const PrivateEmpty<T>& other) const;
- bool operator!=(const PrivateEmpty<T>& other) const;
- int size() const;
-private:
- bool empty() const;
-};
-
-struct BoolSize {
- bool size() const;
- bool empty() const;
-};
-
-struct EnumSize {
- enum E { one };
- enum E size() const;
- bool empty() const;
-};
-
-class Container {
-public:
- bool operator==(const Container& other) const;
- int size() const;
- bool empty() const;
-};
-
-class Derived : public Container {
-};
-
-class Container2 {
-public:
- int size() const;
- bool empty() const { return size() == 0; }
-};
-
-class Container3 {
-public:
- int size() const;
- bool empty() const;
-};
-
-bool Container3::empty() const { return this->size() == 0; }
-
-class Container4 {
-public:
- bool operator==(const Container4& rhs) const;
- int size() const;
- bool empty() const { return *this == Container4(); }
-};
-
-std::string s_func() {
- return std::string();
-}
-
-int main() {
- std::set<int> intSet;
- std::string str;
- std::string str2;
- std::wstring wstr;
- (void)(str.size() + 0);
- (void)(str.size() - 0);
- (void)(0 + str.size());
- (void)(0 - str.size());
- if (intSet.size() == 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
- // CHECK-FIXES: {{^ }}if (intSet.empty()){{$}}
- // CHECK-MESSAGES: :32:8: note: method 'set'::empty() defined here
- if (intSet == std::set<int>())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used to check for emptiness
- // CHECK-FIXES: {{^ }}if (intSet.empty()){{$}}
- // CHECK-MESSAGES: :32:8: note: method 'set'::empty() defined here
- if (s_func() == "")
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (s_func().empty()){{$}}
- if (str.size() == 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (str.empty()){{$}}
- if ((str + str2).size() == 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if ((str + str2).empty()){{$}}
- if (str == "")
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (str.empty()){{$}}
- if (str + str2 == "")
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if ((str + str2).empty()){{$}}
- if (wstr.size() == 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (wstr.empty()){{$}}
- if (wstr == "")
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (wstr.empty()){{$}}
- std::vector<int> vect;
- if (vect.size() == 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (vect.empty()){{$}}
- if (vect == std::vector<int>())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (vect.empty()){{$}}
- if (vect.size() != 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!vect.empty()){{$}}
- if (vect != std::vector<int>())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!vect.empty()){{$}}
- if (0 == vect.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:12: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (vect.empty()){{$}}
- if (0 != vect.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:12: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!vect.empty()){{$}}
- if (std::vector<int>() == vect)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (vect.empty()){{$}}
- if (std::vector<int>() != vect)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!vect.empty()){{$}}
- if (vect.size() > 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!vect.empty()){{$}}
- if (0 < vect.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:11: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!vect.empty()){{$}}
- if (vect.size() < 1)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (vect.empty()){{$}}
- if (1 > vect.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:11: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (vect.empty()){{$}}
- if (vect.size() >= 1)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!vect.empty()){{$}}
- if (1 <= vect.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:12: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!vect.empty()){{$}}
- if (vect.size() > 1) // no warning
- ;
- if (1 < vect.size()) // no warning
- ;
- if (vect.size() <= 1) // no warning
- ;
- if (1 >= vect.size()) // no warning
- ;
- if (!vect.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:8: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (vect.empty()){{$}}
- if (vect.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!vect.empty()){{$}}
-
- if (vect.empty())
- ;
-
- const std::vector<int> vect2;
- if (vect2.size() != 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!vect2.empty()){{$}}
-
- std::vector<int> *vect3 = new std::vector<int>();
- if (vect3->size() == 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (vect3->empty()){{$}}
- if ((*vect3).size() == 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if ((*vect3).empty()){{$}}
- if ((*vect3) == std::vector<int>())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (vect3->empty()){{$}}
- if (*vect3 == std::vector<int>())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (vect3->empty()){{$}}
-
- delete vect3;
-
- const std::vector<int> &vect4 = vect2;
- if (vect4.size() == 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (vect4.empty()){{$}}
- if (vect4 == std::vector<int>())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (vect4.empty()){{$}}
-
- TemplatedContainer<void> templated_container;
- if (templated_container.size() == 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (templated_container.empty()){{$}}
- if (templated_container == TemplatedContainer<void>())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (templated_container.empty()){{$}}
- if (templated_container.size() != 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!templated_container.empty()){{$}}
- if (templated_container != TemplatedContainer<void>())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!templated_container.empty()){{$}}
- if (0 == templated_container.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:12: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (templated_container.empty()){{$}}
- if (TemplatedContainer<void>() == templated_container)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (templated_container.empty()){{$}}
- if (0 != templated_container.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:12: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!templated_container.empty()){{$}}
- if (TemplatedContainer<void>() != templated_container)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!templated_container.empty()){{$}}
- if (templated_container.size() > 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!templated_container.empty()){{$}}
- if (0 < templated_container.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:11: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!templated_container.empty()){{$}}
- if (templated_container.size() < 1)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (templated_container.empty()){{$}}
- if (1 > templated_container.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:11: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (templated_container.empty()){{$}}
- if (templated_container.size() >= 1)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!templated_container.empty()){{$}}
- if (1 <= templated_container.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:12: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!templated_container.empty()){{$}}
- if (templated_container.size() > 1) // no warning
- ;
- if (1 < templated_container.size()) // no warning
- ;
- if (templated_container.size() <= 1) // no warning
- ;
- if (1 >= templated_container.size()) // no warning
- ;
- if (!templated_container.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:8: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (templated_container.empty()){{$}}
- if (templated_container.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (!templated_container.empty()){{$}}
-
- if (templated_container.empty())
- ;
-
- // No warnings expected.
- PrivateEmpty<void> private_empty;
- if (private_empty.size() == 0)
- ;
- if (private_empty == PrivateEmpty<void>())
- ;
- if (private_empty.size() != 0)
- ;
- if (private_empty != PrivateEmpty<void>())
- ;
- if (0 == private_empty.size())
- ;
- if (PrivateEmpty<void>() == private_empty)
- ;
- if (0 != private_empty.size())
- ;
- if (PrivateEmpty<void>() != private_empty)
- ;
- if (private_empty.size() > 0)
- ;
- if (0 < private_empty.size())
- ;
- if (private_empty.size() < 1)
- ;
- if (1 > private_empty.size())
- ;
- if (private_empty.size() >= 1)
- ;
- if (1 <= private_empty.size())
- ;
- if (private_empty.size() > 1)
- ;
- if (1 < private_empty.size())
- ;
- if (private_empty.size() <= 1)
- ;
- if (1 >= private_empty.size())
- ;
- if (!private_empty.size())
- ;
- if (private_empty.size())
- ;
-
- // Types with weird size() return type.
- BoolSize bs;
- if (bs.size() == 0)
- ;
- EnumSize es;
- if (es.size() == 0)
- ;
-
- Derived derived;
- if (derived.size() == 0)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (derived.empty()){{$}}
- if (derived == Derived())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-FIXES: {{^ }}if (derived.empty()){{$}}
-}
-
-#define CHECKSIZE(x) if (x.size()) {}
-// CHECK-FIXES: #define CHECKSIZE(x) if (x.size()) {}
-
-template <typename T> void f() {
- std::vector<T> v;
- if (v.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
- // CHECK-MESSAGES: :9:8: note: method 'vector'::empty() defined here
- // CHECK-FIXES: {{^ }}if (!v.empty()){{$}}
- if (v == std::vector<T>())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used to check for emptiness instead of comparing to an empty object [readability-container-size-empty]
- // CHECK-FIXES: {{^ }}if (v.empty()){{$}}
- // CHECK-FIXES-NEXT: ;
- CHECKSIZE(v);
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: the 'empty' method should be used
- // CHECK-MESSAGES: :9:8: note: method 'vector'::empty() defined here
- // CHECK-FIXES: CHECKSIZE(v);
-
- TemplatedContainer<T> templated_container;
- if (templated_container.size())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-MESSAGES: :44:8: note: method 'TemplatedContainer'::empty() defined here
- // CHECK-FIXES: {{^ }}if (!templated_container.empty()){{$}}
- if (templated_container != TemplatedContainer<T>())
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: the 'empty' method should be used
- // CHECK-MESSAGES: :44:8: note: method 'TemplatedContainer'::empty() defined here
- // CHECK-FIXES: {{^ }}if (!templated_container.empty()){{$}}
- // CHECK-FIXES-NEXT: ;
- CHECKSIZE(templated_container);
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: the 'empty' method should be used
- // CHECK-MESSAGES: :44:8: note: method 'TemplatedContainer'::empty() defined here
- // CHECK-FIXES: CHECKSIZE(templated_container);
-}
-
-void g() {
- f<int>();
- f<double>();
- f<char *>();
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-convert-member-functions-to-static.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-convert-member-functions-to-static.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-convert-member-functions-to-static.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-convert-member-functions-to-static.cpp (removed)
@@ -1,218 +0,0 @@
-// RUN: %check_clang_tidy %s readability-convert-member-functions-to-static %t
-
-class DoNotMakeEmptyStatic {
- void emptyMethod() {}
- void empty_method_out_of_line();
-};
-
-void DoNotMakeEmptyStatic::empty_method_out_of_line() {}
-
-class A {
- int field;
- const int const_field;
- static int static_field;
-
- void no_use() {
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: method 'no_use' can be made static
- // CHECK-FIXES: {{^}} static void no_use() {
- int i = 1;
- }
-
- int read_field() {
- return field;
- }
-
- void write_field() {
- field = 1;
- }
-
- int call_non_const_member() { return read_field(); }
-
- int call_static_member() {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: method 'call_static_member' can be made static
- // CHECK-FIXES: {{^}} static int call_static_member() {
- already_static();
- }
-
- int read_static() {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: method 'read_static' can be made static
- // CHECK-FIXES: {{^}} static int read_static() {
- return static_field;
- }
- void write_static() {
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: method 'write_static' can be made static
- // CHECK-FIXES: {{^}} static void write_static() {
- static_field = 1;
- }
-
- static int already_static() { return static_field; }
-
- int already_const() const { return field; }
-
- int already_const_convert_to_static() const {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: method 'already_const_convert_to_static' can be made static
- // CHECK-FIXES: {{^}} static int already_const_convert_to_static() {
- return static_field;
- }
-
- static int out_of_line_already_static();
-
- void out_of_line_call_static();
- // CHECK-FIXES: {{^}} static void out_of_line_call_static();
- int out_of_line_const_to_static() const;
- // CHECK-FIXES: {{^}} static int out_of_line_const_to_static() ;
-};
-
-int A::out_of_line_already_static() { return 0; }
-
-void A::out_of_line_call_static() {
- // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: method 'out_of_line_call_static' can be made static
- // CHECK-FIXES: {{^}}void A::out_of_line_call_static() {
- already_static();
-}
-
-int A::out_of_line_const_to_static() const {
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: method 'out_of_line_const_to_static' can be made static
- // CHECK-FIXES: {{^}}int A::out_of_line_const_to_static() {
- return 0;
-}
-
-struct KeepVirtual {
- virtual int f() { return 0; }
- virtual int h() const { return 0; }
-};
-
-struct KeepVirtualDerived : public KeepVirtual {
- int f() { return 0; }
- int h() const override { return 0; }
-};
-
-// Don't add 'static' to special member functions and operators.
-struct KeepSpecial {
- KeepSpecial() { int L = 0; }
- ~KeepSpecial() { int L = 0; }
- int operator+() { return 0; }
- operator int() { return 0; }
-};
-
-void KeepLambdas() {
- using FT = int (*)();
- auto F = static_cast<FT>([]() { return 0; });
- auto F2 = []() { return 0; };
-}
-
-template <class Base>
-struct KeepWithTemplateBase : public Base {
- int i;
- // We cannot make these methods static because they might need to override
- // a function from Base.
- int static_f() { return 0; }
-};
-
-template <class T>
-struct KeepTemplateClass {
- int i;
- // We cannot make these methods static because a specialization
- // might use *this differently.
- int static_f() { return 0; }
-};
-
-struct KeepTemplateMethod {
- int i;
- // We cannot make these methods static because a specialization
- // might use *this differently.
- template <class T>
- static int static_f() { return 0; }
-};
-
-void instantiate() {
- struct S {};
- KeepWithTemplateBase<S> I1;
- I1.static_f();
-
- KeepTemplateClass<int> I2;
- I2.static_f();
-
- KeepTemplateMethod I3;
- I3.static_f<int>();
-}
-
-struct Trailing {
- auto g() const -> int {
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: method 'g' can be made static
- // CHECK-FIXES: {{^}} static auto g() -> int {
- return 0;
- }
-
- void vol() volatile {
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: method 'vol' can be made static
- return;
- }
-
- void ref() const & {
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: method 'ref' can be made static
- return;
- }
- void refref() const && {
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: method 'refref' can be made static
- return;
- }
-
- void restr() __restrict {
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: method 'restr' can be made static
- return;
- }
-};
-
-struct UnevaluatedContext {
- void f() { sizeof(this); }
-
- void noex() noexcept(noexcept(this));
-};
-
-struct LambdaCapturesThis {
- int Field;
-
- int explicitCapture() {
- return [this]() { return Field; }();
- }
-
- int implicitCapture() {
- return [&]() { return Field; }();
- }
-};
-
-struct NoFixitInMacro {
-#define CONST const
- int no_use_macro_const() CONST {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: method 'no_use_macro_const' can be made static
- return 0;
- }
-
-#define ADD_CONST(F) F const
- int ADD_CONST(no_use_macro2()) {
- return 0;
- }
-
-#define FUN no_use_macro()
- int i;
- int FUN {
- return i;
- }
-
-#define T(FunctionName, Keyword) \
- Keyword int FunctionName() { return 0; }
-#define EMPTY
- T(A, EMPTY)
- T(B, static)
-
-#define T2(FunctionName) \
- int FunctionName() { return 0; }
- T2(A2)
-
-#define VOLATILE volatile
- void volatileMacro() VOLATILE {
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: method 'volatileMacro' can be made static
- return;
- }
-};
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-delete-null-pointer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-delete-null-pointer.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-delete-null-pointer.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-delete-null-pointer.cpp (removed)
@@ -1,95 +0,0 @@
-// RUN: %check_clang_tidy %s readability-delete-null-pointer %t
-
-#define NULL 0
-
-void f() {
- int *ps = 0;
- if (ps /**/) // #0
- delete ps;
- // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
-
- // CHECK-FIXES: int *ps = 0;
- // CHECK-FIXES-NEXT: {{^ }}// #0
- // CHECK-FIXES-NEXT: delete ps;
-
- int *p = 0;
-
- // #1
- if (p) { // #2
- delete p;
- } // #3
- // CHECK-MESSAGES: :[[@LINE-3]]:3: warning: 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
-
- // CHECK-FIXES: {{^ }}// #1
- // CHECK-FIXES-NEXT: {{^ }}// #2
- // CHECK-FIXES-NEXT: delete p;
- // CHECK-FIXES-NEXT: {{^ }}// #3
-
- int *p2 = new int[3];
- // #4
- if (p2) // #5
- delete[] p2;
- // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: 'if' statement is unnecessary;
-
- // CHECK-FIXES: // #4
- // CHECK-FIXES-NEXT: {{^ }}// #5
- // CHECK-FIXES-NEXT: delete[] p2;
-
- int *p3 = 0;
- if (NULL != p3) {
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary;
- delete p3;
- }
- // CHECK-FIXES-NOT: if (NULL != p3) {
- // CHECK-FIXES: delete p3;
-
- int *p4 = nullptr;
- if (p4 != nullptr) {
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary;
- delete p4;
- }
- // CHECK-FIXES-NOT: if (p4 != nullptr) {
- // CHECK-FIXES: delete p4;
-
- char *c;
- if (c != 0) {
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary;
- delete c;
- }
- // CHECK-FIXES-NOT: if (c != 0) {
- // CHECK-FIXES: delete c;
-
- char *c2;
- if (c2) {
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'if' statement is unnecessary;
- // CHECK-FIXES: } else {
- // CHECK-FIXES: c2 = c;
- delete c2;
- } else {
- c2 = c;
- }
- struct A {
- void foo() {
- if (mp) // #6
- delete mp;
- // CHECK-MESSAGES: :[[@LINE-2]]:7: warning: 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
- // CHECK-FIXES: {{^ }}// #6
- // CHECK-FIXES-NEXT: delete mp;
- }
- int *mp;
- };
-}
-
-void g() {
- int *p5, *p6;
- if (p5)
- delete p6;
-
- if (p5 && p6)
- delete p5;
-
- if (p6) {
- int x = 5;
- delete p6;
- }
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-deleted-default.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-deleted-default.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-deleted-default.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-deleted-default.cpp (removed)
@@ -1,127 +0,0 @@
-// RUN: %check_clang_tidy %s readability-deleted-default %t -- -- -fno-ms-compatibility
-
-class NoDefault {
-public:
- NoDefault() = delete;
- NoDefault(NoDefault &&Other) = delete;
- NoDefault(const NoDefault &Other) = delete;
-};
-
-class MissingEverything {
-public:
- MissingEverything() = default;
- // CHECK-MESSAGES: warning: default constructor is explicitly defaulted but implicitly deleted, probably because a non-static data member or a base class is lacking a default constructor; definition can either be removed or explicitly deleted [readability-deleted-default]
- MissingEverything(MissingEverything &&Other) = default;
- // CHECK-MESSAGES: warning: move constructor is explicitly defaulted but implicitly deleted, probably because a non-static data member or a base class is neither copyable nor movable; definition can either be removed or explicitly deleted [readability-deleted-default]
- MissingEverything(const MissingEverything &Other) = default;
- // CHECK-MESSAGES: warning: copy constructor is explicitly defaulted but implicitly deleted, probably because a non-static data member or a base class is not copyable; definition can either be removed or explicitly deleted [readability-deleted-default]
- MissingEverything &operator=(MissingEverything &&Other) = default;
- // CHECK-MESSAGES: warning: move assignment operator is explicitly defaulted but implicitly deleted, probably because a base class or a non-static data member is not assignable, e.g. because the latter is marked 'const'; definition can either be removed or explicitly deleted [readability-deleted-default]
- MissingEverything &operator=(const MissingEverything &Other) = default;
- // CHECK-MESSAGES: warning: copy assignment operator is explicitly defaulted but implicitly deleted, probably because a base class or a non-static data member is not assignable, e.g. because the latter is marked 'const'; definition can either be removed or explicitly deleted [readability-deleted-default]
-
-private:
- NoDefault ND;
-};
-
-class NotAssignable {
-public:
- NotAssignable(NotAssignable &&Other) = default;
- NotAssignable(const NotAssignable &Other) = default;
- NotAssignable &operator=(NotAssignable &&Other) = default;
- // CHECK-MESSAGES: warning: move assignment operator is explicitly defaulted but implicitly deleted
- NotAssignable &operator=(const NotAssignable &Other) = default;
- // CHECK-MESSAGES: warning: copy assignment operator is explicitly defaulted but implicitly deleted
-
-private:
- const int I = 0;
-};
-
-class Movable {
-public:
- Movable() = default;
- Movable(Movable &&Other) = default;
- Movable(const Movable &Other) = delete;
- Movable &operator=(Movable &&Other) = default;
- Movable &operator=(const Movable &Other) = delete;
-};
-
-class NotCopyable {
-public:
- NotCopyable(NotCopyable &&Other) = default;
- NotCopyable(const NotCopyable &Other) = default;
- // CHECK-MESSAGES: warning: copy constructor is explicitly defaulted but implicitly deleted
- NotCopyable &operator=(NotCopyable &&Other) = default;
- NotCopyable &operator=(const NotCopyable &Other) = default;
- // CHECK-MESSAGES: warning: copy assignment operator is explicitly defaulted but implicitly deleted
-private:
- Movable M;
-};
-
-template <typename T> class Templated {
-public:
- // No warning here, it is a templated class.
- Templated() = default;
- Templated(Templated &&Other) = default;
- Templated(const Templated &Other) = default;
- Templated &operator=(Templated &&Other) = default;
- Templated &operator=(const Templated &Other) = default;
-
- class InnerTemplated {
- public:
- // This class is not in itself templated, but we still don't have warning.
- InnerTemplated() = default;
- InnerTemplated(InnerTemplated &&Other) = default;
- InnerTemplated(const InnerTemplated &Other) = default;
- InnerTemplated &operator=(InnerTemplated &&Other) = default;
- InnerTemplated &operator=(const InnerTemplated &Other) = default;
-
- private:
- T TVar;
- };
-
- class InnerNotTemplated {
- public:
- // This one could technically have warnings, but currently doesn't.
- InnerNotTemplated() = default;
- InnerNotTemplated(InnerNotTemplated &&Other) = default;
- InnerNotTemplated(const InnerNotTemplated &Other) = default;
- InnerNotTemplated &operator=(InnerNotTemplated &&Other) = default;
- InnerNotTemplated &operator=(const InnerNotTemplated &Other) = default;
-
- private:
- int I;
- };
-
-private:
- const T TVar{};
-};
-
-int FunctionWithInnerClass() {
- class InnerNotAssignable {
- public:
- InnerNotAssignable &operator=(InnerNotAssignable &&Other) = default;
- // CHECK-MESSAGES: warning: move assignment operator is explicitly defaulted but implicitly deleted
- private:
- const int I = 0;
- };
- return 1;
-};
-
-template <typename T>
-int TemplateFunctionWithInnerClass() {
- class InnerNotAssignable {
- public:
- InnerNotAssignable &operator=(InnerNotAssignable &&Other) = default;
- private:
- const T TVar{};
- };
- return 1;
-};
-
-void Foo() {
- Templated<const int> V1;
- Templated<int>::InnerTemplated V2;
- Templated<float>::InnerNotTemplated V3;
- TemplateFunctionWithInnerClass<int>();
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return-if-constexpr.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return-if-constexpr.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return-if-constexpr.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return-if-constexpr.cpp (removed)
@@ -1,22 +0,0 @@
-// RUN: %check_clang_tidy %s readability-else-after-return %t -- -- -std=c++17
-
-// Constexpr if is an exception to the rule, we cannot remove the else.
-void f() {
- if (sizeof(int) > 4)
- return;
- else
- return;
- // CHECK-MESSAGES: [[@LINE-2]]:3: warning: do not use 'else' after 'return'
-
- if constexpr (sizeof(int) > 4)
- return;
- else
- return;
-
- if constexpr (sizeof(int) > 4)
- return;
- else if constexpr (sizeof(long) > 4)
- return;
- else
- return;
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp (removed)
@@ -1,119 +0,0 @@
-// RUN: %check_clang_tidy %s readability-else-after-return %t -- -- -fexceptions
-
-namespace std {
-struct string {
- string(const char *);
- ~string();
-};
-} // namespace std
-
-struct my_exception {
- my_exception(const std::string &s);
-};
-
-void f(int a) {
- if (a > 0)
- return;
- else // comment-0
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not use 'else' after 'return'
- // CHECK-FIXES: {{^}} // comment-0
- return;
-
- if (a > 0) {
- return;
- } else { // comment-1
- // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not use 'else' after 'return'
- // CHECK-FIXES: {{^}} } // comment-1
- return;
- }
-
- if (a > 0) {
- f(0);
- if (a > 10)
- return;
- } else {
- return;
- }
-
- if (a > 0)
- f(0);
- else if (a > 10)
- return;
- else // comment-2
- // CHECK-FIXES-NOT: {{^}} // comment-2
- f(0);
-
- if (a > 0)
- if (a < 10)
- return;
- else // comment-3
- // CHECK-FIXES-NOT: {{^}} // comment-3
- f(0);
- else
- if (a > 10)
- return;
- else // comment-4
- // CHECK-FIXES-NOT: {{^}} // comment-4
- f(0);
-
- if (a > 0) {
- if (a < 10)
- return;
- else // comment-5
- // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not use 'else' after 'return'
- // CHECK-FIXES: {{^}} // comment-5
- f(0);
- } else {
- if (a > 10)
- return;
- else // comment-6
- // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not use 'else' after 'return'
- // CHECK-FIXES: {{^}} // comment-6
- f(0);
- }
-}
-
-void foo() {
- for (unsigned x = 0; x < 42; ++x) {
- if (x) {
- continue;
- } else { // comment-7
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: do not use 'else' after 'continue'
- // CHECK-FIXES: {{^}} } // comment-7
- x++;
- }
- if (x) {
- break;
- } else { // comment-8
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: do not use 'else' after 'break'
- // CHECK-FIXES: {{^}} } // comment-8
- x++;
- }
- if (x) {
- throw 42;
- } else { // comment-9
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: do not use 'else' after 'throw'
- // CHECK-FIXES: {{^}} } // comment-9
- x++;
- }
- if (x) {
- throw my_exception("foo");
- } else { // comment-10
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: do not use 'else' after 'throw'
- // CHECK-FIXES: {{^}} } // comment-10
- x++;
- }
- }
-}
-
-extern int *g();
-extern void h(int **x);
-
-int *decl_in_condition() {
- if (int *x = g()) {
- return x;
- } else {
- h(&x);
- return x;
- }
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-function-size-variables-c++17.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-function-size-variables-c%2B%2B17.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-function-size-variables-c++17.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-function-size-variables-c++17.cpp (removed)
@@ -1,21 +0,0 @@
-// RUN: %check_clang_tidy %s readability-function-size %t -- -config='{CheckOptions: [{key: readability-function-size.LineThreshold, value: 0}, {key: readability-function-size.StatementThreshold, value: 0}, {key: readability-function-size.BranchThreshold, value: 0}, {key: readability-function-size.ParameterThreshold, value: 5}, {key: readability-function-size.NestingThreshold, value: 2}, {key: readability-function-size.VariableThreshold, value: 1}]}' -- -std=c++17
-
-void structured_bindings() {
- int a[2] = {1, 2};
- auto [x, y] = a;
-}
-// CHECK-MESSAGES: :[[@LINE-4]]:6: warning: function 'structured_bindings' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 3 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 2 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-7]]:6: note: 3 variables (threshold 1)
-
-#define SWAP(x, y) ({auto& [x0, x1] = x; __typeof__(x) t = {x0, x1}; auto& [y0, y1] = y; auto& [t0, t1] = t; x0 = y0; x1 = y1; y0 = t0; y1 = t1; })
-void variables_13() {
- int a[2] = {1, 2};
- int b[2] = {3, 4};
- SWAP(a, b);
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:6: warning: function 'variables_13' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 4 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-7]]:6: note: 11 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-8]]:6: note: 2 variables (threshold 1)
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-function-size.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-function-size.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-function-size.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-function-size.cpp (removed)
@@ -1,309 +0,0 @@
-// RUN: %check_clang_tidy %s readability-function-size %t -- \
-// RUN: -config='{CheckOptions: [ \
-// RUN: {key: readability-function-size.LineThreshold, value: 0}, \
-// RUN: {key: readability-function-size.StatementThreshold, value: 0}, \
-// RUN: {key: readability-function-size.BranchThreshold, value: 0}, \
-// RUN: {key: readability-function-size.ParameterThreshold, value: 5}, \
-// RUN: {key: readability-function-size.NestingThreshold, value: 2}, \
-// RUN: {key: readability-function-size.VariableThreshold, value: 1} \
-// RUN: ]}'
-
-// Bad formatting is intentional, don't run clang-format over the whole file!
-
-void foo1() {
-}
-
-void foo2() {;}
-// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foo2' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-2]]:6: note: 1 statements (threshold 0)
-
-void foo3() {
-;
-
-}
-// CHECK-MESSAGES: :[[@LINE-4]]:6: warning: function 'foo3' exceeds recommended size/complexity
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 3 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 1 statements (threshold 0)
-
-void foo4(int i) { if (i) {} else; {}
-}
-// CHECK-MESSAGES: :[[@LINE-2]]:6: warning: function 'foo4' exceeds recommended size/complexity
-// CHECK-MESSAGES: :[[@LINE-3]]:6: note: 1 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-4]]:6: note: 3 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 1 branches (threshold 0)
-
-void foo5(int i) {for(;i;)while(i)
-do;while(i);
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:6: warning: function 'foo5' exceeds recommended size/complexity
-// CHECK-MESSAGES: :[[@LINE-4]]:6: note: 2 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 7 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 3 branches (threshold 0)
-
-template <typename T> T foo6(T i) {return i;
-}
-int x = foo6(0);
-// CHECK-MESSAGES: :[[@LINE-3]]:25: warning: function 'foo6' exceeds recommended size/complexity
-// CHECK-MESSAGES: :[[@LINE-4]]:25: note: 1 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-5]]:25: note: 1 statements (threshold 0)
-
-void foo7(int p1, int p2, int p3, int p4, int p5, int p6) {;}
-// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'foo7' exceeds recommended size/complexity
-// CHECK-MESSAGES: :[[@LINE-2]]:6: note: 1 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-3]]:6: note: 6 parameters (threshold 5)
-
-void bar1() { [](){;;;;;;;;;;;if(1){}}();
-
-
-}
-// CHECK-MESSAGES: :[[@LINE-4]]:6: warning: function 'bar1' exceeds recommended size/complexity
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 3 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 14 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-7]]:6: note: 1 branches (threshold 0)
-
-void bar2() { class A { void barx() {;;} }; }
-// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bar2' exceeds recommended size/complexity
-// CHECK-MESSAGES: :[[@LINE-2]]:6: note: 3 statements (threshold 0)
-//
-// CHECK-MESSAGES: :[[@LINE-4]]:30: warning: function 'barx' exceeds recommended size/complexity
-// CHECK-MESSAGES: :[[@LINE-5]]:30: note: 2 statements (threshold 0)
-
-#define macro() {int x; {int y; {int z;}}}
-
-void baz0() { // 1
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'baz0' exceeds recommended size/complexity
- // CHECK-MESSAGES: :[[@LINE-2]]:6: note: 28 lines including whitespace and comments (threshold 0)
- // CHECK-MESSAGES: :[[@LINE-3]]:6: note: 9 statements (threshold 0)
- int a;
- { // 2
- int b;
- { // 3
-// CHECK-MESSAGES: :[[@LINE-1]]:5: note: nesting level 3 starts here (threshold 2)
- int c;
- { // 4
- int d;
- }
- }
- }
- { // 2
- int e;
- }
- { // 2
- { // 3
-// CHECK-MESSAGES: :[[@LINE-1]]:5: note: nesting level 3 starts here (threshold 2)
- int j;
- }
- }
- macro()
- // CHECK-MESSAGES: :[[@LINE-1]]:3: note: nesting level 3 starts here (threshold 2)
- // CHECK-MESSAGES: :[[@LINE-28]]:25: note: expanded from macro 'macro'
- // CHECK-MESSAGES: :[[@LINE-27]]:6: note: 9 variables (threshold 1)
-}
-
-// check that nested if's are not reported. this was broken initially
-void nesting_if() { // 1
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'nesting_if' exceeds recommended size/complexity
- // CHECK-MESSAGES: :[[@LINE-2]]:6: note: 23 lines including whitespace and comments (threshold 0)
- // CHECK-MESSAGES: :[[@LINE-3]]:6: note: 18 statements (threshold 0)
- // CHECK-MESSAGES: :[[@LINE-4]]:6: note: 6 branches (threshold 0)
- if (true) { // 2
- int j;
- } else if (true) { // 2
- int j;
- if (true) { // 3
- // CHECK-MESSAGES: :[[@LINE-1]]:16: note: nesting level 3 starts here (threshold 2)
- int j;
- }
- } else if (true) { // 2
- int j;
- if (true) { // 3
- // CHECK-MESSAGES: :[[@LINE-1]]:16: note: nesting level 3 starts here (threshold 2)
- int j;
- }
- } else if (true) { // 2
- int j;
- }
- // CHECK-MESSAGES: :[[@LINE-22]]:6: note: 6 variables (threshold 1)
-}
-
-// however this should warn
-void bad_if_nesting() { // 1
-// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'bad_if_nesting' exceeds recommended size/complexity
-// CHECK-MESSAGES: :[[@LINE-2]]:6: note: 23 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-3]]:6: note: 12 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-4]]:6: note: 4 branches (threshold 0)
- if (true) { // 2
- int j;
- } else { // 2
- if (true) { // 3
- // CHECK-MESSAGES: :[[@LINE-1]]:15: note: nesting level 3 starts here (threshold 2)
- int j;
- } else { // 3
- // CHECK-MESSAGES: :[[@LINE-1]]:12: note: nesting level 3 starts here (threshold 2)
- if (true) { // 4
- int j;
- } else { // 4
- if (true) { // 5
- int j;
- }
- }
- }
- }
- // CHECK-MESSAGES: :[[@LINE-22]]:6: note: 4 variables (threshold 1)
-}
-
-void variables_0() {
- int i;
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:6: warning: function 'variables_0' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-4]]:6: note: 2 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 1 statements (threshold 0)
-void variables_1(int i) {
- int j;
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:6: warning: function 'variables_1' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-4]]:6: note: 2 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 1 statements (threshold 0)
-void variables_2(int i, int j) {
- ;
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:6: warning: function 'variables_2' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-4]]:6: note: 2 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 1 statements (threshold 0)
-void variables_3() {
- int i[2];
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:6: warning: function 'variables_3' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-4]]:6: note: 2 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 1 statements (threshold 0)
-void variables_4() {
- int i;
- int j;
-}
-// CHECK-MESSAGES: :[[@LINE-4]]:6: warning: function 'variables_4' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 3 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 2 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-7]]:6: note: 2 variables (threshold 1)
-void variables_5() {
- int i, j;
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:6: warning: function 'variables_5' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-4]]:6: note: 2 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 1 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 2 variables (threshold 1)
-void variables_6() {
- for (int i;;)
- for (int j;;)
- ;
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:6: warning: function 'variables_6' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 4 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-7]]:6: note: 5 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-8]]:6: note: 2 branches (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-9]]:6: note: 2 variables (threshold 1)
-void variables_7() {
- if (int a = 1)
- if (int b = 2)
- ;
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:6: warning: function 'variables_7' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 4 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-7]]:6: note: 7 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-8]]:6: note: 2 branches (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-9]]:6: note: 2 variables (threshold 1)
-void variables_8() {
- int a[2];
- for (auto i : a)
- for (auto j : a)
- ;
-}
-// CHECK-MESSAGES: :[[@LINE-6]]:6: warning: function 'variables_8' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-7]]:6: note: 5 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-8]]:6: note: 8 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-9]]:6: note: 2 branches (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-10]]:6: note: 3 variables (threshold 1)
-void variables_9() {
- int a, b;
- struct A {
- A(int c, int d) {
- int e, f;
- }
- };
-}
-// CHECK-MESSAGES: :[[@LINE-8]]:6: warning: function 'variables_9' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-9]]:6: note: 7 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-10]]:6: note: 3 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-11]]:6: note: 2 variables (threshold 1)
-// CHECK-MESSAGES: :[[@LINE-9]]:5: warning: function 'A' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-10]]:5: note: 2 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-11]]:5: note: 1 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-12]]:5: note: 2 variables (threshold 1)
-void variables_10() {
- int a, b;
- struct A {
- int c;
- int d;
- };
-}
-// CHECK-MESSAGES: :[[@LINE-7]]:6: warning: function 'variables_10' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-8]]:6: note: 6 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-9]]:6: note: 2 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-10]]:6: note: 2 variables (threshold 1)
-void variables_11() {
- struct S {
- void bar() {
- int a, b;
- }
- };
-}
-// CHECK-MESSAGES: :[[@LINE-7]]:6: warning: function 'variables_11' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-8]]:6: note: 6 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-7]]:10: warning: function 'bar' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-8]]:10: note: 2 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-9]]:10: note: 2 variables (threshold 1)
-void variables_12() {
- int v;
- auto test = [](int a, int b) -> void {};
- test({}, {});
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:6: warning: function 'variables_12' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 4 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-7]]:6: note: 3 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-8]]:6: note: 2 variables (threshold 1)
-void variables_13() {
- int v;
- auto test = []() -> void {
- int a;
- int b;
- };
- test();
-}
-// CHECK-MESSAGES: :[[@LINE-8]]:6: warning: function 'variables_13' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-9]]:6: note: 7 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-10]]:6: note: 5 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-11]]:6: note: 2 variables (threshold 1)
-void variables_14() {
- (void)({int a = 12; a; });
- (void)({int a = 12; a; });
-}
-// CHECK-MESSAGES: :[[@LINE-4]]:6: warning: function 'variables_14' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 3 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 6 statements (threshold 0)
-#define SWAP(x, y) ({__typeof__(x) temp = x; x = y; y = temp; })
-void variables_15() {
- int a = 10, b = 12;
- SWAP(a, b);
-}
-// CHECK-MESSAGES: :[[@LINE-4]]:6: warning: function 'variables_15' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 3 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 5 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-7]]:6: note: 2 variables (threshold 1)
-#define vardecl(type, name) type name;
-void variables_16() {
- vardecl(int, a);
- vardecl(int, b);
-}
-// CHECK-MESSAGES: :[[@LINE-4]]:6: warning: function 'variables_16' exceeds recommended size/complexity thresholds [readability-function-size]
-// CHECK-MESSAGES: :[[@LINE-5]]:6: note: 3 lines including whitespace and comments (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-6]]:6: note: 4 statements (threshold 0)
-// CHECK-MESSAGES: :[[@LINE-7]]:6: note: 2 variables (threshold 1)
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-bugfix.cpp (removed)
@@ -1,5 +0,0 @@
-// RUN: %check_clang_tidy -expect-clang-tidy-error %s readability-identifier-naming %t
-
-// This used to cause a null pointer dereference.
-auto [left] = right;
-// CHECK-MESSAGES: :[[@LINE-1]]:15: error: use of undeclared identifier 'right'
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m (removed)
@@ -1,12 +0,0 @@
-// RUN: %check_clang_tidy %s readability-identifier-naming %t \
-// RUN: -config='{CheckOptions: \
-// RUN: [{key: readability-identifier-naming.ObjcIvarPrefix, value: '_'}]}' \
-// RUN: --
-
- at interface Foo {
- int _bar;
- int barWithoutPrefix;
- // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for objc ivar 'barWithoutPrefix' [readability-identifier-naming]
- // CHECK-FIXES: int _barWithoutPrefix;
-}
- at end
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp (removed)
@@ -1,529 +0,0 @@
-// Remove UNSUPPORTED for powerpc64le when the problem introduced by
-// r288563 is resolved.
-// UNSUPPORTED: powerpc64le
-// RUN: %check_clang_tidy %s readability-identifier-naming %t -- \
-// RUN: -config='{CheckOptions: [ \
-// RUN: {key: readability-identifier-naming.AbstractClassCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.AbstractClassPrefix, value: 'A'}, \
-// RUN: {key: readability-identifier-naming.ClassCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.ClassPrefix, value: 'C'}, \
-// RUN: {key: readability-identifier-naming.ClassConstantCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.ClassConstantPrefix, value: 'k'}, \
-// RUN: {key: readability-identifier-naming.ClassMemberCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.ClassMethodCase, value: camelBack}, \
-// RUN: {key: readability-identifier-naming.ConstantCase, value: UPPER_CASE}, \
-// RUN: {key: readability-identifier-naming.ConstantSuffix, value: '_CST'}, \
-// RUN: {key: readability-identifier-naming.ConstexprFunctionCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.ConstexprMethodCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.ConstexprVariableCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.EnumCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.EnumPrefix, value: 'E'}, \
-// RUN: {key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE}, \
-// RUN: {key: readability-identifier-naming.FunctionCase, value: camelBack}, \
-// RUN: {key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE}, \
-// RUN: {key: readability-identifier-naming.GlobalFunctionCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.GlobalVariableCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.GlobalVariablePrefix, value: 'g_'}, \
-// RUN: {key: readability-identifier-naming.InlineNamespaceCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.LocalConstantCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.LocalConstantPrefix, value: 'k'}, \
-// RUN: {key: readability-identifier-naming.LocalVariableCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.MemberCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.MemberPrefix, value: 'm_'}, \
-// RUN: {key: readability-identifier-naming.ConstantMemberCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.PrivateMemberPrefix, value: '__'}, \
-// RUN: {key: readability-identifier-naming.ProtectedMemberPrefix, value: '_'}, \
-// RUN: {key: readability-identifier-naming.PublicMemberCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.MethodCase, value: camelBack}, \
-// RUN: {key: readability-identifier-naming.PrivateMethodPrefix, value: '__'}, \
-// RUN: {key: readability-identifier-naming.ProtectedMethodPrefix, value: '_'}, \
-// RUN: {key: readability-identifier-naming.NamespaceCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.ParameterCase, value: camelBack}, \
-// RUN: {key: readability-identifier-naming.ParameterPrefix, value: 'a_'}, \
-// RUN: {key: readability-identifier-naming.ConstantParameterCase, value: camelBack}, \
-// RUN: {key: readability-identifier-naming.ConstantParameterPrefix, value: 'i_'}, \
-// RUN: {key: readability-identifier-naming.ParameterPackCase, value: camelBack}, \
-// RUN: {key: readability-identifier-naming.PureFunctionCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.PureMethodCase, value: camelBack}, \
-// RUN: {key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE}, \
-// RUN: {key: readability-identifier-naming.StaticVariableCase, value: camelBack}, \
-// RUN: {key: readability-identifier-naming.StaticVariablePrefix, value: 's_'}, \
-// RUN: {key: readability-identifier-naming.StructCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.TemplateParameterCase, value: UPPER_CASE}, \
-// RUN: {key: readability-identifier-naming.TemplateTemplateParameterCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.TemplateUsingCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.TemplateUsingPrefix, value: 'u_'}, \
-// RUN: {key: readability-identifier-naming.TypeTemplateParameterCase, value: camelBack}, \
-// RUN: {key: readability-identifier-naming.TypeTemplateParameterSuffix, value: '_t'}, \
-// RUN: {key: readability-identifier-naming.TypedefCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.TypedefSuffix, value: '_t'}, \
-// RUN: {key: readability-identifier-naming.UnionCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.UnionPrefix, value: 'U'}, \
-// RUN: {key: readability-identifier-naming.UsingCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.ValueTemplateParameterCase, value: camelBack}, \
-// RUN: {key: readability-identifier-naming.VariableCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.VirtualMethodCase, value: Camel_Snake_Case}, \
-// RUN: {key: readability-identifier-naming.VirtualMethodPrefix, value: 'v_'}, \
-// RUN: {key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE}, \
-// RUN: {key: readability-identifier-naming.TypeAliasCase, value: camel_Snake_Back}, \
-// RUN: {key: readability-identifier-naming.TypeAliasSuffix, value: '_t'}, \
-// RUN: {key: readability-identifier-naming.IgnoreFailedSplit, value: 0}, \
-// RUN: {key: readability-identifier-naming.GlobalPointerCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.GlobalPointerSuffix, value: '_Ptr'}, \
-// RUN: {key: readability-identifier-naming.GlobalConstantPointerCase, value: UPPER_CASE}, \
-// RUN: {key: readability-identifier-naming.GlobalConstantPointerSuffix, value: '_Ptr'}, \
-// RUN: {key: readability-identifier-naming.PointerParameterCase, value: lower_case}, \
-// RUN: {key: readability-identifier-naming.PointerParameterPrefix, value: 'p_'}, \
-// RUN: {key: readability-identifier-naming.ConstantPointerParameterCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.ConstantPointerParameterPrefix, value: 'cp_'}, \
-// RUN: {key: readability-identifier-naming.LocalPointerCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.LocalPointerPrefix, value: 'l_'}, \
-// RUN: {key: readability-identifier-naming.LocalConstantPointerCase, value: CamelCase}, \
-// RUN: {key: readability-identifier-naming.LocalConstantPointerPrefix, value: 'lc_'}, \
-// RUN: ]}' -- -fno-delayed-template-parsing \
-// RUN: -I%S/Inputs/readability-identifier-naming \
-// RUN: -isystem %S/Inputs/readability-identifier-naming/system
-
-// clang-format off
-
-#include <system-header.h>
-#include "user-header.h"
-// NO warnings or fixes expected from declarations within header files without
-// the -header-filter= option
-
-namespace FOO_NS {
-// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for namespace 'FOO_NS' [readability-identifier-naming]
-// CHECK-FIXES: {{^}}namespace foo_ns {{{$}}
-inline namespace InlineNamespace {
-// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for inline namespace 'InlineNamespace'
-// CHECK-FIXES: {{^}}inline namespace inline_namespace {{{$}}
-
-SYSTEM_NS::structure g_s1;
-// NO warnings or fixes expected as SYSTEM_NS and structure are declared in a header file
-
-USER_NS::object g_s2;
-// NO warnings or fixes expected as USER_NS and object are declared in a header file
-
-SYSTEM_MACRO(var1);
-// NO warnings or fixes expected as var1 is from macro expansion
-
-USER_MACRO(var2);
-// NO warnings or fixes expected as var2 is declared in a macro expansion
-
-#define BLA int FOO_bar
-BLA;
-// NO warnings or fixes expected as FOO_bar is from macro expansion
-
-int global0;
-#define USE_NUMBERED_GLOBAL(number) auto use_global##number = global##number
-USE_NUMBERED_GLOBAL(0);
-// NO warnings or fixes expected as global0 is pieced together in a macro
-// expansion.
-
-int global1;
-#define USE_NUMBERED_BAL(prefix, number) \
- auto use_##prefix##bal##number = prefix##bal##number
-USE_NUMBERED_BAL(glo, 1);
-// NO warnings or fixes expected as global1 is pieced together in a macro
-// expansion.
-
-int global2;
-#define USE_RECONSTRUCTED(glo, bal) auto use_##glo##bal = glo##bal
-USE_RECONSTRUCTED(glo, bal2);
-// NO warnings or fixes expected as global2 is pieced together in a macro
-// expansion.
-
-int global;
-// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'global'
-// CHECK-FIXES: {{^}}int g_global;{{$}}
-#define USE_IN_MACRO(m) auto use_##m = m
-USE_IN_MACRO(global);
-
-int global3;
-// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'global3'
-// CHECK-FIXES: {{^}}int g_global3;{{$}}
-#define ADD_TO_SELF(m) (m) + (m)
-int g_twice_global3 = ADD_TO_SELF(global3);
-// CHECK-FIXES: {{^}}int g_twice_global3 = ADD_TO_SELF(g_global3);{{$}}
-
-enum my_enumeration {
-// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for enum 'my_enumeration'
-// CHECK-FIXES: {{^}}enum EMyEnumeration {{{$}}
- MyConstant = 1,
-// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for enum constant 'MyConstant'
-// CHECK-FIXES: {{^}} MY_CONSTANT = 1,{{$}}
- your_CONST = 1,
-// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for enum constant 'your_CONST'
-// CHECK-FIXES: {{^}} YOUR_CONST = 1,{{$}}
- THIS_ConstValue = 1,
-// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for enum constant 'THIS_ConstValue'
-// CHECK-FIXES: {{^}} THIS_CONST_VALUE = 1,{{$}}
-};
-
-constexpr int ConstExpr_variable = MyConstant;
-// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for constexpr variable 'ConstExpr_variable'
-// CHECK-FIXES: {{^}}constexpr int const_expr_variable = MY_CONSTANT;{{$}}
-
-class my_class {
-// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'my_class'
-// CHECK-FIXES: {{^}}class CMyClass {{{$}}
-public:
- my_class();
-// CHECK-FIXES: {{^}} CMyClass();{{$}}
-
- my_class(void*) : my_class() {}
-// CHECK-FIXES: {{^}} CMyClass(void*) : CMyClass() {}{{$}}
-
- ~
- my_class();
-// (space in destructor token test, we could check trigraph but they will be deprecated)
-// CHECK-FIXES: {{^}} ~{{$}}
-// CHECK-FIXES: {{^}} CMyClass();{{$}}
-
-private:
- const int MEMBER_one_1 = ConstExpr_variable;
-// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for constant member 'MEMBER_one_1'
-// CHECK-FIXES: {{^}} const int member_one_1 = const_expr_variable;{{$}}
- int member2 = 2;
-// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for private member 'member2'
-// CHECK-FIXES: {{^}} int __member2 = 2;{{$}}
- int _memberWithExtraUnderscores_ = 42;
-// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for private member '_memberWithExtraUnderscores_'
-// CHECK-FIXES: {{^}} int __memberWithExtraUnderscores = 42;{{$}}
-
-private:
- int private_member = 3;
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for private member 'private_member'
-// CHECK-FIXES: {{^}} int __private_member = 3;{{$}}
-
-protected:
- int ProtMember;
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for protected member 'ProtMember'
-// CHECK-FIXES: {{^}} int _ProtMember;{{$}}
-
-public:
- int PubMem;
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for public member 'PubMem'
-// CHECK-FIXES: {{^}} int pub_mem;{{$}}
-
- static const int classConstant;
-// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: invalid case style for class constant 'classConstant'
-// CHECK-FIXES: {{^}} static const int kClassConstant;{{$}}
- static int ClassMember_2;
-// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for class member 'ClassMember_2'
-// CHECK-FIXES: {{^}} static int ClassMember2;{{$}}
-};
-class my_class;
-// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'my_class'
-// CHECK-FIXES: {{^}}class CMyClass;{{$}}
-
-class my_forward_declared_class; // No warning should be triggered.
-
-const int my_class::classConstant = 4;
-// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: invalid case style for class constant 'classConstant'
-// CHECK-FIXES: {{^}}const int CMyClass::kClassConstant = 4;{{$}}
-
-int my_class::ClassMember_2 = 5;
-// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for class member 'ClassMember_2'
-// CHECK-FIXES: {{^}}int CMyClass::ClassMember2 = 5;{{$}}
-
-class my_derived_class : public virtual my_class {};
-// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'my_derived_class'
-// CHECK-FIXES: {{^}}class CMyDerivedClass : public virtual CMyClass {};{{$}}
-
-class CMyWellNamedClass {};
-// No warning expected as this class is well named.
-
-template <typename t_t>
-class CMyWellNamedClass2 : public my_class {
- // CHECK-FIXES: {{^}}class CMyWellNamedClass2 : public CMyClass {{{$}}
- t_t my_Bad_Member;
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for private member 'my_Bad_Member'
- // CHECK-FIXES: {{^}} t_t __my_Bad_Member;{{$}}
- int my_Other_Bad_Member = 42;
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for private member 'my_Other_Bad_Member'
- // CHECK-FIXES: {{^}} int __my_Other_Bad_Member = 42;{{$}}
-public:
- CMyWellNamedClass2() = default;
- CMyWellNamedClass2(CMyWellNamedClass2 const&) = default;
- CMyWellNamedClass2(CMyWellNamedClass2 &&) = default;
- CMyWellNamedClass2(t_t a_v, void *p_p) : my_class(p_p), my_Bad_Member(a_v) {}
- // CHECK-FIXES: {{^}} CMyWellNamedClass2(t_t a_v, void *p_p) : CMyClass(p_p), __my_Bad_Member(a_v) {}{{$}}
-
- CMyWellNamedClass2(t_t a_v) : my_class(), my_Bad_Member(a_v), my_Other_Bad_Member(11) {}
- // CHECK-FIXES: {{^}} CMyWellNamedClass2(t_t a_v) : CMyClass(), __my_Bad_Member(a_v), __my_Other_Bad_Member(11) {}{{$}}
-};
-void InstantiateClassMethods() {
- // Ensure we trigger the instantiation of each constructor
- CMyWellNamedClass2<int> x;
- CMyWellNamedClass2<int> x2 = x;
- CMyWellNamedClass2<int> x3 = static_cast<CMyWellNamedClass2<int>&&>(x2);
- CMyWellNamedClass2<int> x4(42);
- CMyWellNamedClass2<int> x5(42, nullptr);
-}
-
-class AOverridden {
-public:
- virtual ~AOverridden() = default;
- virtual void BadBaseMethod() = 0;
- // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for virtual method 'BadBaseMethod'
-};
-
-class COverriding : public AOverridden {
-public:
- // Overriding a badly-named base isn't a new violation.
- void BadBaseMethod() override {}
-};
-
-template <typename derived_t>
-class CRTPBase {
-public:
- void BadBaseMethod(int) {}
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for method 'BadBaseMethod'
-};
-
-class CRTPDerived : CRTPBase<CRTPDerived> {
-public:
- // Hiding a badly-named base isn't a new violation.
- double BadBaseMethod(double) { return 0; }
-};
-
-template<typename T>
-// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: invalid case style for type template parameter 'T'
-// CHECK-FIXES: {{^}}template<typename t_t>{{$}}
-class my_templated_class : CMyWellNamedClass {};
-// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'my_templated_class'
-// CHECK-FIXES: {{^}}class CMyTemplatedClass : CMyWellNamedClass {};{{$}}
-
-template<typename T>
-// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: invalid case style for type template parameter 'T'
-// CHECK-FIXES: {{^}}template<typename t_t>{{$}}
-class my_other_templated_class : my_templated_class< my_class>, private my_derived_class {};
-// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'my_other_templated_class'
-// CHECK-FIXES: {{^}}class CMyOtherTemplatedClass : CMyTemplatedClass< CMyClass>, private CMyDerivedClass {};{{$}}
-
-template<typename t_t>
-using mysuper_tpl_t = my_other_templated_class <:: FOO_NS ::my_class>;
-// CHECK-FIXES: {{^}}using mysuper_tpl_t = CMyOtherTemplatedClass <:: foo_ns ::CMyClass>;{{$}}
-
-const int global_Constant = 6;
-// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global constant 'global_Constant'
-// CHECK-FIXES: {{^}}const int GLOBAL_CONSTANT = 6;{{$}}
-int Global_variable = 7;
-// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: invalid case style for global variable 'Global_variable'
-// CHECK-FIXES: {{^}}int g_global_variable = 7;{{$}}
-
-void global_function(int PARAMETER_1, int const CONST_parameter) {
-// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global function 'global_function'
-// CHECK-MESSAGES: :[[@LINE-2]]:26: warning: invalid case style for parameter 'PARAMETER_1'
-// CHECK-MESSAGES: :[[@LINE-3]]:49: warning: invalid case style for constant parameter 'CONST_parameter'
-// CHECK-FIXES: {{^}}void GlobalFunction(int a_parameter1, int const i_constParameter) {{{$}}
- static const int THIS_static_ConsTant = 4;
-// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: invalid case style for static constant 'THIS_static_ConsTant'
-// CHECK-FIXES: {{^}} static const int THIS_STATIC_CONS_TANT = 4;{{$}}
- static int THIS_static_variable;
-// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for static variable 'THIS_static_variable'
-// CHECK-FIXES: {{^}} static int s_thisStaticVariable;{{$}}
- int const local_Constant = 3;
-// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for local constant 'local_Constant'
-// CHECK-FIXES: {{^}} int const kLocalConstant = 3;{{$}}
- int LOCAL_VARIABLE;
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for local variable 'LOCAL_VARIABLE'
-// CHECK-FIXES: {{^}} int local_variable;{{$}}
-
- int LOCAL_Array__[] = {0, 1, 2};
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for local variable 'LOCAL_Array__'
-// CHECK-FIXES: {{^}} int local_array[] = {0, 1, 2};{{$}}
-
- for (auto _ : LOCAL_Array__) {
- }
-}
-
-template<typename ... TYPE_parameters>
-// CHECK-MESSAGES: :[[@LINE-1]]:23: warning: invalid case style for type template parameter 'TYPE_parameters'
-// CHECK-FIXES: {{^}}template<typename ... typeParameters_t>{{$}}
-void Global_Fun(TYPE_parameters... PARAMETER_PACK) {
-// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global function 'Global_Fun'
-// CHECK-MESSAGES: :[[@LINE-2]]:36: warning: invalid case style for parameter pack 'PARAMETER_PACK'
-// CHECK-FIXES: {{^}}void GlobalFun(typeParameters_t... parameterPack) {{{$}}
- global_function(1, 2);
-// CHECK-FIXES: {{^}} GlobalFunction(1, 2);{{$}}
- FOO_bar = Global_variable;
-// CHECK-FIXES: {{^}} FOO_bar = g_global_variable;{{$}}
-// NO fix expected for FOO_bar declared in macro expansion
-}
-
-template<template<typename> class TPL_parameter, int COUNT_params, typename ... TYPE_parameters>
-// CHECK-MESSAGES: :[[@LINE-1]]:35: warning: invalid case style for template template parameter 'TPL_parameter'
-// CHECK-MESSAGES: :[[@LINE-2]]:54: warning: invalid case style for value template parameter 'COUNT_params'
-// CHECK-MESSAGES: :[[@LINE-3]]:81: warning: invalid case style for type template parameter 'TYPE_parameters'
-// CHECK-FIXES: {{^}}template<template<typename> class TplParameter, int countParams, typename ... typeParameters_t>{{$}}
-class test_CLASS {
-// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'test_CLASS'
-// CHECK-FIXES: {{^}}class CTestClass {{{$}}
-};
-
-class abstract_class {
-// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for abstract class 'abstract_class'
-// CHECK-FIXES: {{^}}class AAbstractClass {{{$}}
- virtual ~abstract_class() = 0;
-// CHECK-FIXES: {{^}} virtual ~AAbstractClass() = 0;{{$}}
- virtual void VIRTUAL_METHOD();
-// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for virtual method 'VIRTUAL_METHOD'
-// CHECK-FIXES: {{^}} virtual void v_Virtual_Method();{{$}}
- void non_Virtual_METHOD() {}
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for private method 'non_Virtual_METHOD'
-// CHECK-FIXES: {{^}} void __non_Virtual_METHOD() {}{{$}}
-
-public:
- static void CLASS_METHOD() {}
-// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for class method 'CLASS_METHOD'
-// CHECK-FIXES: {{^}} static void classMethod() {}{{$}}
-
- constexpr int CST_expr_Method() { return 2; }
-// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: invalid case style for constexpr method 'CST_expr_Method'
-// CHECK-FIXES: {{^}} constexpr int cst_expr_method() { return 2; }{{$}}
-
-private:
- void PRIVate_Method();
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for private method 'PRIVate_Method'
-// CHECK-FIXES: {{^}} void __PRIVate_Method();{{$}}
-protected:
- void protected_Method();
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for protected method 'protected_Method'
-// CHECK-FIXES: {{^}} void _protected_Method();{{$}}
-public:
- void public_Method();
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for method 'public_Method'
-// CHECK-FIXES: {{^}} void publicMethod();{{$}}
-};
-
-constexpr int CE_function() { return 3; }
-// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for constexpr function 'CE_function'
-// CHECK-FIXES: {{^}}constexpr int ce_function() { return 3; }{{$}}
-
-struct THIS___Structure {
-// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for struct 'THIS___Structure'
-// CHECK-FIXES: {{^}}struct this_structure {{{$}}
- THIS___Structure();
-// CHECK-FIXES: {{^}} this_structure();{{$}}
-
- union __MyUnion_is_wonderful__ {};
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for union '__MyUnion_is_wonderful__'
-// CHECK-FIXES: {{^}} union UMyUnionIsWonderful {};{{$}}
-};
-
-typedef THIS___Structure struct_type;
-// CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for typedef 'struct_type'
-// CHECK-FIXES: {{^}}typedef this_structure struct_type_t;{{$}}
-
-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;
-}
-
-using my_struct_type = THIS___Structure;
-// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 'my_struct_type'
-// CHECK-FIXES: {{^}}using my_Struct_Type_t = this_structure;{{$}}
-
-template<typename t_t>
-using SomeOtherTemplate = my_other_templated_class <:: FOO_NS ::my_class>;
-// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 'SomeOtherTemplate'
-// CHECK-FIXES: {{^}}using some_Other_Template_t = CMyOtherTemplatedClass <:: foo_ns ::CMyClass>;{{$}}
-
-static void static_Function() {
-// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for function 'static_Function'
-// CHECK-FIXES: {{^}}static void staticFunction() {{{$}}
-
- ::FOO_NS::InlineNamespace::abstract_class::CLASS_METHOD();
-// CHECK-FIXES: {{^}} ::foo_ns::inline_namespace::AAbstractClass::classMethod();{{$}}
- ::FOO_NS::InlineNamespace::static_Function();
-// CHECK-FIXES: {{^}} ::foo_ns::inline_namespace::staticFunction();{{$}}
-
- using ::FOO_NS::InlineNamespace::CE_function;
-// CHECK-FIXES: {{^}} using ::foo_ns::inline_namespace::ce_function;{{$}}
-
- unsigned MY_LOCAL_array[] = {1,2,3};
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for local variable 'MY_LOCAL_array'
-// CHECK-FIXES: {{^}} unsigned my_local_array[] = {1,2,3};{{$}}
-
- unsigned const MyConstLocal_array[] = {1,2,3};
-// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: invalid case style for local constant 'MyConstLocal_array'
-// CHECK-FIXES: {{^}} unsigned const kMyConstLocalArray[] = {1,2,3};{{$}}
-
- static unsigned MY_STATIC_array[] = {1,2,3};
-// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: invalid case style for static variable 'MY_STATIC_array'
-// CHECK-FIXES: {{^}} static unsigned s_myStaticArray[] = {1,2,3};{{$}}
-
- static unsigned const MyConstStatic_array[] = {1,2,3};
-// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: invalid case style for static constant 'MyConstStatic_array'
-// CHECK-FIXES: {{^}} static unsigned const MY_CONST_STATIC_ARRAY[] = {1,2,3};{{$}}
-
- char MY_LOCAL_string[] = "123";
-// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for local variable 'MY_LOCAL_string'
-// CHECK-FIXES: {{^}} char my_local_string[] = "123";{{$}}
-
- char const MyConstLocal_string[] = "123";
-// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for local constant 'MyConstLocal_string'
-// CHECK-FIXES: {{^}} char const kMyConstLocalString[] = "123";{{$}}
-
- static char MY_STATIC_string[] = "123";
-// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: invalid case style for static variable 'MY_STATIC_string'
-// CHECK-FIXES: {{^}} static char s_myStaticString[] = "123";{{$}}
-
- static char const MyConstStatic_string[] = "123";
-// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: invalid case style for static constant 'MyConstStatic_string'
-// CHECK-FIXES: {{^}} static char const MY_CONST_STATIC_STRING[] = "123";{{$}}
-}
-
-#define MY_TEST_Macro(X) X()
-// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for macro definition 'MY_TEST_Macro'
-// CHECK-FIXES: {{^}}#define MY_TEST_MACRO(X) X()
-
-void MY_TEST_Macro(function) {}
-// CHECK-FIXES: {{^}}void MY_TEST_MACRO(function) {}
-}
-}
-
-template <typename t_t> struct a {
- typename t_t::template b<> c;
-
- char const MY_ConstMember_string[4] = "123";
-// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for constant member 'MY_ConstMember_string'
-// CHECK-FIXES: {{^}} char const my_const_member_string[4] = "123";{{$}}
-
- static char const MyConstClass_string[];
-// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: invalid case style for class constant 'MyConstClass_string'
-// CHECK-FIXES: {{^}} static char const kMyConstClassString[];{{$}}
-};
-
-template<typename t_t>
-char const a<t_t>::MyConstClass_string[] = "123";
-// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for class constant 'MyConstClass_string'
-// CHECK-FIXES: {{^}}char const a<t_t>::kMyConstClassString[] = "123";{{$}}
-
-template <template <typename> class A> struct b { A<int> c; };
-
-unsigned MY_GLOBAL_array[] = {1,2,3};
-// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: invalid case style for global variable 'MY_GLOBAL_array'
-// CHECK-FIXES: {{^}}unsigned g_my_global_array[] = {1,2,3};{{$}}
-
-unsigned const MyConstGlobal_array[] = {1,2,3};
-// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: invalid case style for global constant 'MyConstGlobal_array'
-// CHECK-FIXES: {{^}}unsigned const MY_CONST_GLOBAL_ARRAY[] = {1,2,3};{{$}}
-
-int * MyGlobal_Ptr;// -> ok
-int * const MyConstantGlobalPointer = nullptr;
-// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for global constant pointer 'MyConstantGlobalPointer'
-// CHECK-FIXES: {{^}}int * const MY_CONSTANT_GLOBAL_POINTER_Ptr = nullptr;{{$}}
-
-void MyPoiterFunction(int * p_normal_pointer, int * const constant_ptr){
-// CHECK-MESSAGES: :[[@LINE-1]]:59: warning: invalid case style for constant pointer parameter 'constant_ptr'
-// CHECK-FIXES: {{^}}void MyPoiterFunction(int * p_normal_pointer, int * const cp_ConstantPtr){{{$}}
- int * l_PointerA;
- int * const pointer_b = nullptr;
-// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: invalid case style for local constant pointer 'pointer_b'
-// CHECK-FIXES: {{^}} int * const lc_PointerB = nullptr;{{$}}
-}
-
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion-allow-in-conditions.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion-allow-in-conditions.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion-allow-in-conditions.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion-allow-in-conditions.cpp (removed)
@@ -1,71 +0,0 @@
-// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t \
-// RUN: -config='{CheckOptions: \
-// RUN: [{key: readability-implicit-bool-conversion.AllowIntegerConditions, value: 1}, \
-// RUN: {key: readability-implicit-bool-conversion.AllowPointerConditions, value: 1}]}'
-
-template<typename T>
-void functionTaking(T);
-
-int functionReturningInt();
-int* functionReturningPointer();
-
-struct Struct {
- int member;
- unsigned bitfield : 1;
-};
-
-
-void regularImplicitConversionIntegerToBoolIsNotIgnored() {
- int integer = 0;
- functionTaking<bool>(integer);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int' -> bool [readability-implicit-bool-conversion]
- // CHECK-FIXES: functionTaking<bool>(integer != 0);
-}
-
-void implicitConversionIntegerToBoolInConditionalsIsAllowed() {
- Struct s = {};
- if (s.member) {}
- if (!s.member) {}
- if (s.bitfield) {}
- if (!s.bitfield) {}
- if (functionReturningInt()) {}
- if (!functionReturningInt()) {}
- if (functionReturningInt() && functionReturningPointer()) {}
- if (!functionReturningInt() && !functionReturningPointer()) {}
- for (; functionReturningInt(); ) {}
- for (; functionReturningPointer(); ) {}
- for (; functionReturningInt() && !functionReturningPointer() || (!functionReturningInt() && functionReturningPointer()); ) {}
- while (functionReturningInt()) {}
- while (functionReturningPointer()) {}
- while (functionReturningInt() && !functionReturningPointer() || (!functionReturningInt() && functionReturningPointer())) {}
- int value1 = functionReturningInt() ? 1 : 2;
- int value2 = !functionReturningInt() ? 1 : 2;
- int value3 = (functionReturningInt() && functionReturningPointer() || !functionReturningInt()) ? 1 : 2;
- int value4 = functionReturningInt() ?: value3;
- int *p1 = functionReturningPointer() ?: &value3;
-}
-
-void regularImplicitConversionPointerToBoolIsNotIgnored() {
- int* pointer = nullptr;
- functionTaking<bool>(pointer);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int *' -> bool
- // CHECK-FIXES: functionTaking<bool>(pointer != nullptr);
-
- int Struct::* memberPointer = &Struct::member;
- functionTaking<bool>(memberPointer);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int Struct::*' -> bool
- // CHECK-FIXES: functionTaking<bool>(memberPointer != nullptr);
-}
-
-void implicitConversionPointerToBoolInConditionalsIsAllowed() {
- if (functionReturningPointer()) {}
- if (not functionReturningPointer()) {}
- int value1 = functionReturningPointer() ? 1 : 2;
- int value2 = (not functionReturningPointer()) ? 1 : 2;
-
- int Struct::* memberPointer = &Struct::member;
- if (memberPointer) {}
- if (memberPointer) {}
- int value3 = memberPointer ? 1 : 2;
- int value4 = (not memberPointer) ? 1 : 2;
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion-cxx98.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion-cxx98.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion-cxx98.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion-cxx98.cpp (removed)
@@ -1,45 +0,0 @@
-// RUN: %check_clang_tidy -std=c++98 %s readability-implicit-bool-conversion %t
-
-// We need NULL macro, but some buildbots don't like including <cstddef> header
-// This is a portable way of getting it to work
-#undef NULL
-#define NULL 0L
-
-template<typename T>
-void functionTaking(T);
-
-struct Struct {
- int member;
-};
-
-void useOldNullMacroInReplacements() {
- int* pointer = NULL;
- functionTaking<bool>(pointer);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int *' -> bool [readability-implicit-bool-conversion]
- // CHECK-FIXES: functionTaking<bool>(pointer != 0);
-
- int Struct::* memberPointer = NULL;
- functionTaking<bool>(!memberPointer);
- // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: implicit conversion 'int Struct::*' -> bool
- // CHECK-FIXES: functionTaking<bool>(memberPointer == 0);
-}
-
-void fixFalseLiteralConvertingToNullPointer() {
- functionTaking<int*>(false);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion bool -> 'int *'
- // CHECK-FIXES: functionTaking<int*>(0);
-
- int* pointer = NULL;
- if (pointer == false) {}
- // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: implicit conversion bool -> 'int *'
- // CHECK-FIXES: if (pointer == 0) {}
-
- functionTaking<int Struct::*>(false);
- // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: implicit conversion bool -> 'int Struct::*'
- // CHECK-FIXES: functionTaking<int Struct::*>(0);
-
- int Struct::* memberPointer = NULL;
- if (memberPointer != false) {}
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion bool -> 'int Struct::*'
- // CHECK-FIXES: if (memberPointer != 0) {}
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-implicit-bool-conversion.cpp (removed)
@@ -1,473 +0,0 @@
-// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t
-
-// We need NULL macro, but some buildbots don't like including <cstddef> header
-// This is a portable way of getting it to work
-#undef NULL
-#define NULL 0L
-
-template<typename T>
-void functionTaking(T);
-
-struct Struct {
- int member;
-};
-
-
-////////// Implicit conversion from bool.
-
-void implicitConversionFromBoolSimpleCases() {
- bool boolean = true;
-
- functionTaking<bool>(boolean);
-
- functionTaking<int>(boolean);
- // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: implicit conversion bool -> 'int' [readability-implicit-bool-conversion]
- // CHECK-FIXES: functionTaking<int>(static_cast<int>(boolean));
-
- functionTaking<unsigned long>(boolean);
- // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: implicit conversion bool -> 'unsigned long'
- // CHECK-FIXES: functionTaking<unsigned long>(static_cast<unsigned long>(boolean));
-
- functionTaking<char>(boolean);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion bool -> 'char'
- // CHECK-FIXES: functionTaking<char>(static_cast<char>(boolean));
-
- functionTaking<float>(boolean);
- // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: implicit conversion bool -> 'float'
- // CHECK-FIXES: functionTaking<float>(static_cast<float>(boolean));
-
- functionTaking<double>(boolean);
- // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: implicit conversion bool -> 'double'
- // CHECK-FIXES: functionTaking<double>(static_cast<double>(boolean));
-}
-
-float implicitConversionFromBoolInReturnValue() {
- bool boolean = false;
- return boolean;
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: implicit conversion bool -> 'float'
- // CHECK-FIXES: return static_cast<float>(boolean);
-}
-
-void implicitConversionFromBoolInSingleBoolExpressions(bool b1, bool b2) {
- bool boolean = true;
- boolean = b1 ^ b2;
- boolean = b1 && b2;
- boolean |= !b1 || !b2;
- boolean &= b1;
- boolean = b1 == true;
- boolean = b2 != false;
-
- int integer = boolean - 3;
- // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: implicit conversion bool -> 'int'
- // CHECK-FIXES: int integer = static_cast<int>(boolean) - 3;
-
- float floating = boolean / 0.3f;
- // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: implicit conversion bool -> 'float'
- // CHECK-FIXES: float floating = static_cast<float>(boolean) / 0.3f;
-
- char character = boolean;
- // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: implicit conversion bool -> 'char'
- // CHECK-FIXES: char character = static_cast<char>(boolean);
-}
-
-void implicitConversionFromBoollInComplexBoolExpressions() {
- bool boolean = true;
- bool anotherBoolean = false;
-
- int integer = boolean && anotherBoolean;
- // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: implicit conversion bool -> 'int'
- // CHECK-FIXES: int integer = static_cast<int>(boolean && anotherBoolean);
-
- unsigned long unsignedLong = (! boolean) + 4ul;
- // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: implicit conversion bool -> 'unsigned long'
- // CHECK-FIXES: unsigned long unsignedLong = static_cast<unsigned long>(! boolean) + 4ul;
-
- float floating = (boolean || anotherBoolean) * 0.3f;
- // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: implicit conversion bool -> 'float'
- // CHECK-FIXES: float floating = static_cast<float>(boolean || anotherBoolean) * 0.3f;
-
- double doubleFloating = (boolean && (anotherBoolean || boolean)) * 0.3;
- // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: implicit conversion bool -> 'double'
- // CHECK-FIXES: double doubleFloating = static_cast<double>(boolean && (anotherBoolean || boolean)) * 0.3;
-}
-
-void implicitConversionFromBoolLiterals() {
- functionTaking<int>(true);
- // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: implicit conversion bool -> 'int'
- // CHECK-FIXES: functionTaking<int>(1);
-
- functionTaking<unsigned long>(false);
- // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: implicit conversion bool -> 'unsigned long'
- // CHECK-FIXES: functionTaking<unsigned long>(0u);
-
- functionTaking<signed char>(true);
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: implicit conversion bool -> 'signed char'
- // CHECK-FIXES: functionTaking<signed char>(1);
-
- functionTaking<float>(false);
- // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: implicit conversion bool -> 'float'
- // CHECK-FIXES: functionTaking<float>(0.0f);
-
- functionTaking<double>(true);
- // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: implicit conversion bool -> 'double'
- // CHECK-FIXES: functionTaking<double>(1.0);
-}
-
-void implicitConversionFromBoolInComparisons() {
- bool boolean = true;
- int integer = 0;
-
- functionTaking<bool>(boolean == integer);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion bool -> 'int'
- // CHECK-FIXES: functionTaking<bool>(static_cast<int>(boolean) == integer);
-
- functionTaking<bool>(integer != boolean);
- // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: implicit conversion bool -> 'int'
- // CHECK-FIXES: functionTaking<bool>(integer != static_cast<int>(boolean));
-}
-
-void ignoreBoolComparisons() {
- bool boolean = true;
- bool anotherBoolean = false;
-
- functionTaking<bool>(boolean == anotherBoolean);
- functionTaking<bool>(boolean != anotherBoolean);
-}
-
-void ignoreExplicitCastsFromBool() {
- bool boolean = true;
-
- int integer = static_cast<int>(boolean) + 3;
- float floating = static_cast<float>(boolean) * 0.3f;
- char character = static_cast<char>(boolean);
-}
-
-void ignoreImplicitConversionFromBoolInMacroExpansions() {
- bool boolean = true;
-
- #define CAST_FROM_BOOL_IN_MACRO_BODY boolean + 3
- int integerFromMacroBody = CAST_FROM_BOOL_IN_MACRO_BODY;
-
- #define CAST_FROM_BOOL_IN_MACRO_ARGUMENT(x) x + 3
- int integerFromMacroArgument = CAST_FROM_BOOL_IN_MACRO_ARGUMENT(boolean);
-}
-
-namespace ignoreImplicitConversionFromBoolInTemplateInstantiations {
-
-template<typename T>
-void templateFunction() {
- bool boolean = true;
- T uknownType = boolean + 3;
-}
-
-void useOfTemplateFunction() {
- templateFunction<int>();
-}
-
-} // namespace ignoreImplicitConversionFromBoolInTemplateInstantiations
-
-////////// Implicit conversions to bool.
-
-void implicitConversionToBoolSimpleCases() {
- int integer = 10;
- functionTaking<bool>(integer);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int' -> bool
- // CHECK-FIXES: functionTaking<bool>(integer != 0);
-
- unsigned long unsignedLong = 10;
- functionTaking<bool>(unsignedLong);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'unsigned long' -> bool
- // CHECK-FIXES: functionTaking<bool>(unsignedLong != 0u);
-
- float floating = 0.0f;
- functionTaking<bool>(floating);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'float' -> bool
- // CHECK-FIXES: functionTaking<bool>(floating != 0.0f);
-
- double doubleFloating = 1.0f;
- functionTaking<bool>(doubleFloating);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'double' -> bool
- // CHECK-FIXES: functionTaking<bool>(doubleFloating != 0.0);
-
- signed char character = 'a';
- functionTaking<bool>(character);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'signed char' -> bool
- // CHECK-FIXES: functionTaking<bool>(character != 0);
-
- int* pointer = nullptr;
- functionTaking<bool>(pointer);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int *' -> bool
- // CHECK-FIXES: functionTaking<bool>(pointer != nullptr);
-
- auto pointerToMember = &Struct::member;
- functionTaking<bool>(pointerToMember);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int Struct::*' -> bool
- // CHECK-FIXES: functionTaking<bool>(pointerToMember != nullptr);
-}
-
-void implicitConversionToBoolInSingleExpressions() {
- int integer = 10;
- bool boolComingFromInt = integer;
- // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: implicit conversion 'int' -> bool
- // CHECK-FIXES: bool boolComingFromInt = integer != 0;
-
- float floating = 10.0f;
- bool boolComingFromFloat = floating;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: implicit conversion 'float' -> bool
- // CHECK-FIXES: bool boolComingFromFloat = floating != 0.0f;
-
- signed char character = 'a';
- bool boolComingFromChar = character;
- // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: implicit conversion 'signed char' -> bool
- // CHECK-FIXES: bool boolComingFromChar = character != 0;
-
- int* pointer = nullptr;
- bool boolComingFromPointer = pointer;
- // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: implicit conversion 'int *' -> bool
- // CHECK-FIXES: bool boolComingFromPointer = pointer != nullptr;
-}
-
-void implicitConversionToBoolInComplexExpressions() {
- bool boolean = true;
-
- int integer = 10;
- int anotherInteger = 20;
- bool boolComingFromInteger = integer + anotherInteger;
- // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: implicit conversion 'int' -> bool
- // CHECK-FIXES: bool boolComingFromInteger = (integer + anotherInteger) != 0;
-
- float floating = 0.2f;
- bool boolComingFromFloating = floating - 0.3f || boolean;
- // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: implicit conversion 'float' -> bool
- // CHECK-FIXES: bool boolComingFromFloating = ((floating - 0.3f) != 0.0f) || boolean;
-
- double doubleFloating = 0.3;
- bool boolComingFromDoubleFloating = (doubleFloating - 0.4) && boolean;
- // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: implicit conversion 'double' -> bool
- // CHECK-FIXES: bool boolComingFromDoubleFloating = ((doubleFloating - 0.4) != 0.0) && boolean;
-}
-
-void implicitConversionInNegationExpressions() {
- int integer = 10;
- bool boolComingFromNegatedInt = !integer;
- // CHECK-MESSAGES: :[[@LINE-1]]:36: warning: implicit conversion 'int' -> bool
- // CHECK-FIXES: bool boolComingFromNegatedInt = integer == 0;
-
- float floating = 10.0f;
- bool boolComingFromNegatedFloat = ! floating;
- // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: implicit conversion 'float' -> bool
- // CHECK-FIXES: bool boolComingFromNegatedFloat = floating == 0.0f;
-
- signed char character = 'a';
- bool boolComingFromNegatedChar = (! character);
- // CHECK-MESSAGES: :[[@LINE-1]]:39: warning: implicit conversion 'signed char' -> bool
- // CHECK-FIXES: bool boolComingFromNegatedChar = (character == 0);
-
- int* pointer = nullptr;
- bool boolComingFromNegatedPointer = not pointer;
- // CHECK-MESSAGES: :[[@LINE-1]]:43: warning: implicit conversion 'int *' -> bool
- // CHECK-FIXES: bool boolComingFromNegatedPointer = pointer == nullptr;
-}
-
-void implicitConversionToBoolInControlStatements() {
- int integer = 10;
- if (integer) {}
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: implicit conversion 'int' -> bool
- // CHECK-FIXES: if (integer != 0) {}
-
- long int longInteger = 0.2f;
- for (;longInteger;) {}
- // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: implicit conversion 'long' -> bool
- // CHECK-FIXES: for (;longInteger != 0;) {}
-
- float floating = 0.3f;
- while (floating) {}
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: implicit conversion 'float' -> bool
- // CHECK-FIXES: while (floating != 0.0f) {}
-
- double doubleFloating = 0.4;
- do {} while (doubleFloating);
- // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: implicit conversion 'double' -> bool
- // CHECK-FIXES: do {} while (doubleFloating != 0.0);
-}
-
-bool implicitConversionToBoolInReturnValue() {
- float floating = 1.0f;
- return floating;
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: implicit conversion 'float' -> bool
- // CHECK-FIXES: return floating != 0.0f;
-}
-
-void implicitConversionToBoolFromLiterals() {
- functionTaking<bool>(0);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int' -> bool
- // CHECK-FIXES: functionTaking<bool>(false);
-
- functionTaking<bool>(1);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int' -> bool
- // CHECK-FIXES: functionTaking<bool>(true);
-
- functionTaking<bool>(2ul);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'unsigned long' -> bool
- // CHECK-FIXES: functionTaking<bool>(true);
-
-
- functionTaking<bool>(0.0f);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'float' -> bool
- // CHECK-FIXES: functionTaking<bool>(false);
-
- functionTaking<bool>(1.0f);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'float' -> bool
- // CHECK-FIXES: functionTaking<bool>(true);
-
- functionTaking<bool>(2.0);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'double' -> bool
- // CHECK-FIXES: functionTaking<bool>(true);
-
-
- functionTaking<bool>('\0');
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'char' -> bool
- // CHECK-FIXES: functionTaking<bool>(false);
-
- functionTaking<bool>('a');
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'char' -> bool
- // CHECK-FIXES: functionTaking<bool>(true);
-
-
- functionTaking<bool>("");
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'const char *' -> bool
- // CHECK-FIXES: functionTaking<bool>(true);
-
- functionTaking<bool>("abc");
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'const char *' -> bool
- // CHECK-FIXES: functionTaking<bool>(true);
-
- functionTaking<bool>(NULL);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'long' -> bool
- // CHECK-FIXES: functionTaking<bool>(false);
-}
-
-void implicitConversionToBoolFromUnaryMinusAndZeroLiterals() {
- functionTaking<bool>(-0);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int' -> bool
- // CHECK-FIXES: functionTaking<bool>((-0) != 0);
-
- functionTaking<bool>(-0.0f);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'float' -> bool
- // CHECK-FIXES: functionTaking<bool>((-0.0f) != 0.0f);
-
- functionTaking<bool>(-0.0);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'double' -> bool
- // CHECK-FIXES: functionTaking<bool>((-0.0) != 0.0);
-}
-
-void implicitConversionToBoolInWithOverloadedOperators() {
- struct UserStruct {
- int operator()(int x) { return x; }
- int operator+(int y) { return y; }
- };
-
- UserStruct s;
-
- functionTaking<bool>(s(0));
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int' -> bool
- // CHECK-FIXES: functionTaking<bool>(s(0) != 0);
-
- functionTaking<bool>(s + 2);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int' -> bool
- // CHECK-FIXES: functionTaking<bool>((s + 2) != 0);
-}
-
-int functionReturningInt();
-int* functionReturningPointer();
-
-void ignoreImplicitConversionToBoolWhenDeclaringVariableInControlStatements() {
- if (int integer = functionReturningInt()) {}
-
- while (int* pointer = functionReturningPointer()) {}
-}
-
-void ignoreExplicitCastsToBool() {
- int integer = 10;
- bool boolComingFromInt = static_cast<bool>(integer);
-
- float floating = 10.0f;
- bool boolComingFromFloat = static_cast<bool>(floating);
-
- char character = 'a';
- bool boolComingFromChar = static_cast<bool>(character);
-
- int* pointer = nullptr;
- bool booleanComingFromPointer = static_cast<bool>(pointer);
-}
-
-void ignoreImplicitConversionToBoolInMacroExpansions() {
- int integer = 3;
-
- #define CAST_TO_BOOL_IN_MACRO_BODY integer && false
- bool boolFromMacroBody = CAST_TO_BOOL_IN_MACRO_BODY;
-
- #define CAST_TO_BOOL_IN_MACRO_ARGUMENT(x) x || true
- bool boolFromMacroArgument = CAST_TO_BOOL_IN_MACRO_ARGUMENT(integer);
-}
-
-namespace ignoreImplicitConversionToBoolInTemplateInstantiations {
-
-template<typename T>
-void templateFunction() {
- T unknownType = 0;
- bool boolean = unknownType;
-}
-
-void useOfTemplateFunction() {
- templateFunction<int>();
-}
-
-} // namespace ignoreImplicitConversionToBoolInTemplateInstantiations
-
-namespace ignoreUserDefinedConversionOperator {
-
-struct StructWithUserConversion {
- operator bool();
-};
-
-void useOfUserConversion() {
- StructWithUserConversion structure;
- functionTaking<bool>(structure);
-}
-
-} // namespace ignoreUserDefinedConversionOperator
-
-namespace ignore_1bit_bitfields {
-
-struct S {
- int a;
- int b : 1;
- int c : 2;
-
- S(bool a, bool b, bool c) : a(a), b(b), c(c) {}
- // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: implicit conversion bool -> 'int'
- // CHECK-MESSAGES: :[[@LINE-2]]:45: warning: implicit conversion bool -> 'int'
- // CHECK-FIXES: S(bool a, bool b, bool c) : a(static_cast<int>(a)), b(b), c(static_cast<int>(c)) {}
-};
-
-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);
- functionTaking<bool>(s.b);
- // CHECK-FIXES: functionTaking<bool>(s.b);
- s.a = true;
- // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: implicit conversion bool -> 'int'
- // CHECK-FIXES: s.a = 1;
- s.b = true;
- // CHECK-FIXES: s.b = true;
- s.c = true;
- // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: implicit conversion bool -> 'int'
- // CHECK-FIXES: s.c = 1;
- functionTaking<bool>(s.c);
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'int' -> bool
- // CHECK-FIXES: functionTaking<bool>(s.c != 0);
-}
-
-} // namespace ignore_1bit_bitfields
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-inconsistent-declaration-parameter-name-macros.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-inconsistent-declaration-parameter-name-macros.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-inconsistent-declaration-parameter-name-macros.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-inconsistent-declaration-parameter-name-macros.cpp (removed)
@@ -1,46 +0,0 @@
-// RUN: %check_clang_tidy %s readability-inconsistent-declaration-parameter-name %t -- \
-// RUN: -config="{CheckOptions: [{key: readability-inconsistent-declaration-parameter-name.IgnoreMacros, value: 0}]}"
-
-#define MACRO() \
- void f(int x)
-
-struct S1 {
- MACRO();
- // CHECK-NOTES: :[[@LINE-1]]:3: warning: function 'S1::f' has a definition with different parameter names
- // CHECK-NOTES: :[[@LINE-5]]:8: note: expanded from macro 'MACRO'
- // CHECK-NOTES: :[[@LINE+4]]:10: note: the definition seen here
- // CHECK-NOTES: :[[@LINE-4]]:3: note: differing parameters are named here: ('x'), in definition: ('y')
- // CHECK-NOTES: :[[@LINE-8]]:8: note: expanded from macro 'MACRO'
-};
-void S1::f(int y) {}
-
-struct S2 {
- int g() const;
- void set_g(int g);
- // CHECK-NOTES: :[[@LINE-1]]:8: warning: function 'S2::set_g' has a definition with different parameter names
- // CHECK-NOTES: :[[@LINE+14]]:1: note: the definition seen here
- // CHECK-NOTES: :[[@LINE+9]]:12: note: expanded from macro 'DEFINITION'
- // This one is unfortunate, but the location this points to is in a scratch
- // space, so it's not helpful to the user.
- // CHECK-NOTES: {{^}}note: expanded from here{{$}}
- // CHECK-NOTES: :[[@LINE-7]]:8: note: differing parameters are named here: ('g'), in definition: ('w')
-};
-
-#define DEFINITION(name, parameter) \
- int S2::name() const { return 0; } \
- void S2::set_##name(int parameter) { \
- (void)parameter; \
- }
-
-DEFINITION(g, w)
-
-//////////////////////////////////////////////////////
-
-#define DECLARE_FUNCTION_WITH_PARAM_NAME(function_name, param_name) \
- void function_name(int param_name)
-
-// CHECK-NOTES: :[[@LINE+1]]:34: warning: function 'macroFunction' has 1 other declaration with different parameter names [readability-inconsistent-declaration-parameter-name]
-DECLARE_FUNCTION_WITH_PARAM_NAME(macroFunction, a);
-// CHECK-NOTES: :[[@LINE+2]]:34: note: the 1st inconsistent declaration seen here
-// CHECK-NOTES: :[[@LINE+1]]:34: note: differing parameters are named here: ('b'), in the other declaration: ('a')
-DECLARE_FUNCTION_WITH_PARAM_NAME(macroFunction, b);
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-inconsistent-declaration-parameter-name-strict.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-inconsistent-declaration-parameter-name-strict.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-inconsistent-declaration-parameter-name-strict.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-inconsistent-declaration-parameter-name-strict.cpp (removed)
@@ -1,10 +0,0 @@
-// RUN: %check_clang_tidy %s readability-inconsistent-declaration-parameter-name %t -- \
-// RUN: -config="{CheckOptions: [{key: readability-inconsistent-declaration-parameter-name.Strict, value: 1}]}"
-
-void inconsistentFunction(int a, int b, int c);
-// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'inconsistentFunction' has 1 other declaration with different parameter names
-void inconsistentFunction(int prefixA, int b, int cSuffix);
-// CHECK-MESSAGES: :[[@LINE-1]]:6: note: the 1st inconsistent declaration seen here
-// CHECK-MESSAGES: :[[@LINE-2]]:6: note: differing parameters are named here: ('prefixA', 'cSuffix'), in the other declaration: ('a', 'c')
-void inconsistentFunction(int a, int b, int c);
-void inconsistentFunction(int /*c*/, int /*c*/, int /*c*/);
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-inconsistent-declaration-parameter-name.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-inconsistent-declaration-parameter-name.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-inconsistent-declaration-parameter-name.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-inconsistent-declaration-parameter-name.cpp (removed)
@@ -1,193 +0,0 @@
-// RUN: %check_clang_tidy %s readability-inconsistent-declaration-parameter-name %t -- -- -fno-delayed-template-parsing
-
-void consistentFunction(int a, int b, int c);
-void consistentFunction(int a, int b, int c);
-void consistentFunction(int prefixA, int b, int cSuffix);
-void consistentFunction(int a, int b, int c);
-void consistentFunction(int a, int b, int /*c*/);
-void consistentFunction(int /*c*/, int /*c*/, int /*c*/);
-
-//////////////////////////////////////////////////////
-
-// CHECK-MESSAGES: :[[@LINE+1]]:6: warning: function 'inconsistentFunction' has 2 other declarations with different parameter names [readability-inconsistent-declaration-parameter-name]
-void inconsistentFunction(int a, int b, int c);
-// CHECK-MESSAGES: :[[@LINE+2]]:6: note: the 1st inconsistent declaration seen here
-// CHECK-MESSAGES: :[[@LINE+1]]:6: note: differing parameters are named here: ('d', 'e', 'f'), in the other declaration: ('a', 'b', 'c')
-void inconsistentFunction(int d, int e, int f);
-// CHECK-MESSAGES: :[[@LINE+2]]:6: note: the 2nd inconsistent declaration seen here
-// CHECK-MESSAGES: :[[@LINE+1]]:6: note: differing parameters are named here: ('x', 'y', 'z'), in the other declaration: ('a', 'b', 'c')
-void inconsistentFunction(int x, int y, int z);
-
-//////////////////////////////////////////////////////
-
-// CHECK-MESSAGES: :[[@LINE+4]]:6: warning: function 'inconsistentFunctionWithVisibleDefinition' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
-// CHECK-MESSAGES: :[[@LINE+9]]:6: note: the definition seen here
-// CHECK-MESSAGES: :[[@LINE+2]]:6: note: differing parameters are named here: ('a'), in definition: ('c')
-// CHECK-FIXES: void inconsistentFunctionWithVisibleDefinition(int c);
-void inconsistentFunctionWithVisibleDefinition(int a);
-// CHECK-MESSAGES: :[[@LINE+4]]:6: warning: function 'inconsistentFunctionWithVisibleDefinition' has a definition
-// CHECK-MESSAGES: :[[@LINE+4]]:6: note: the definition seen here
-// CHECK-MESSAGES: :[[@LINE+2]]:6: note: differing parameters are named here: ('b'), in definition: ('c')
-// CHECK-FIXES: void inconsistentFunctionWithVisibleDefinition(int c);
-void inconsistentFunctionWithVisibleDefinition(int b);
-void inconsistentFunctionWithVisibleDefinition(int c) { c; }
-
-// CHECK-MESSAGES: :[[@LINE+3]]:6: warning: function 'inconsidentFunctionWithUnreferencedParameterInDefinition' has a definition
-// CHECK-MESSAGES: :[[@LINE+3]]:6: note: the definition seen here
-// CHECK-MESSAGES: :[[@LINE+1]]:6: note: differing parameters are named here: ('a'), in definition: ('b')
-void inconsidentFunctionWithUnreferencedParameterInDefinition(int a);
-void inconsidentFunctionWithUnreferencedParameterInDefinition(int b) {}
-
-//////////////////////////////////////////////////////
-
-struct Struct {
-// CHECK-MESSAGES: :[[@LINE+4]]:8: warning: function 'Struct::inconsistentFunction' has a definition
-// CHECK-MESSAGES: :[[@LINE+6]]:14: note: the definition seen here
-// CHECK-MESSAGES: :[[@LINE+2]]:8: note: differing parameters are named here: ('a'), in definition: ('b')
-// CHECK-FIXES: void inconsistentFunction(int b);
- void inconsistentFunction(int a);
-};
-
-void Struct::inconsistentFunction(int b) { b = 0; }
-
-//////////////////////////////////////////////////////
-
-struct SpecialFunctions {
-// CHECK-MESSAGES: :[[@LINE+4]]:3: warning: function 'SpecialFunctions::SpecialFunctions' has a definition
-// CHECK-MESSAGES: :[[@LINE+12]]:19: note: the definition seen here
-// CHECK-MESSAGES: :[[@LINE+2]]:3: note: differing parameters are named here: ('a'), in definition: ('b')
-// CHECK-FIXES: SpecialFunctions(int b);
- SpecialFunctions(int a);
-
-// CHECK-MESSAGES: :[[@LINE+4]]:21: warning: function 'SpecialFunctions::operator=' has a definition
-// CHECK-MESSAGES: :[[@LINE+8]]:37: note: the definition seen here
-// CHECK-MESSAGES: :[[@LINE+2]]:21: note: differing parameters are named here: ('a'), in definition: ('b')
-// CHECK-FIXES: SpecialFunctions& operator=(const SpecialFunctions& b);
- SpecialFunctions& operator=(const SpecialFunctions& a);
-};
-
-SpecialFunctions::SpecialFunctions(int b) { b; }
-
-SpecialFunctions& SpecialFunctions::operator=(const SpecialFunctions& b) { b; return *this; }
-
-//////////////////////////////////////////////////////
-
-// CHECK-MESSAGES: :[[@LINE+5]]:6: warning: function 'templateFunctionWithSeparateDeclarationAndDefinition' has a definition
-// CHECK-MESSAGES: :[[@LINE+7]]:6: note: the definition seen here
-// CHECK-MESSAGES: :[[@LINE+3]]:6: note: differing parameters are named here: ('a'), in definition: ('b')
-// CHECK-FIXES: void templateFunctionWithSeparateDeclarationAndDefinition(T b);
-template<typename T>
-void templateFunctionWithSeparateDeclarationAndDefinition(T a);
-
-template<typename T>
-void templateFunctionWithSeparateDeclarationAndDefinition(T b) { b; }
-
-//////////////////////////////////////////////////////
-
-template<typename T>
-void templateFunctionWithSpecializations(T a) { a; }
-
-template<>
-// CHECK-MESSAGES: :[[@LINE+3]]:6: warning: function template specialization 'templateFunctionWithSpecializations<int>' has a primary template declaration with different parameter names [readability-inconsistent-declaration-parameter-name]
-// CHECK-MESSAGES: :[[@LINE-4]]:6: note: the primary template declaration seen here
-// CHECK-MESSAGES: :[[@LINE+1]]:6: note: differing parameters are named here: ('b'), in primary template declaration: ('a')
-void templateFunctionWithSpecializations(int b) { b; }
-
-template<>
-// CHECK-MESSAGES: :[[@LINE+3]]:6: warning: function template specialization 'templateFunctionWithSpecializations<float>' has a primary template
-// CHECK-MESSAGES: :[[@LINE-10]]:6: note: the primary template declaration seen here
-// CHECK-MESSAGES: :[[@LINE+1]]:6: note: differing parameters are named here: ('c'), in primary template declaration: ('a')
-void templateFunctionWithSpecializations(float c) { c; }
-
-//////////////////////////////////////////////////////
-
-template<typename T>
-void templateFunctionWithoutDefinitionButWithSpecialization(T a);
-
-template<>
-// CHECK-MESSAGES: :[[@LINE+3]]:6: warning: function template specialization 'templateFunctionWithoutDefinitionButWithSpecialization<int>' has a primary template
-// CHECK-MESSAGES: :[[@LINE-4]]:6: note: the primary template declaration seen here
-// CHECK-MESSAGES: :[[@LINE+1]]:6: note: differing parameters are named here: ('b'), in primary template declaration: ('a')
-void templateFunctionWithoutDefinitionButWithSpecialization(int b) { b; }
-
-//////////////////////////////////////////////////////
-
-template<typename T>
-void templateFunctionWithSeparateSpecializationDeclarationAndDefinition(T a);
-
-template<>
-// CHECK-MESSAGES: :[[@LINE+3]]:6: warning: function template specialization 'templateFunctionWithSeparateSpecializationDeclarationAndDefinition<int>' has a primary template
-// CHECK-MESSAGES: :[[@LINE-4]]:6: note: the primary template declaration seen here
-// CHECK-MESSAGES: :[[@LINE+1]]:6: note: differing parameters are named here: ('b'), in primary template declaration: ('a')
-void templateFunctionWithSeparateSpecializationDeclarationAndDefinition(int b);
-
-template<>
-// CHECK-MESSAGES: :[[@LINE+3]]:6: warning: function template specialization 'templateFunctionWithSeparateSpecializationDeclarationAndDefinition<int>' has a primary template
-// CHECK-MESSAGES: :[[@LINE-10]]:6: note: the primary template declaration seen here
-// CHECK-MESSAGES: :[[@LINE+1]]:6: note: differing parameters are named here: ('c'), in primary template declaration: ('a')
-void templateFunctionWithSeparateSpecializationDeclarationAndDefinition(int c) { c; }
-
-//////////////////////////////////////////////////////
-
-template<typename T>
-class ClassTemplate
-{
-public:
-// CHECK-MESSAGES: :[[@LINE+4]]:10: warning: function 'ClassTemplate::functionInClassTemplateWithSeparateDeclarationAndDefinition' has a definition
-// CHECK-MESSAGES: :[[@LINE+7]]:24: note: the definition seen here
-// CHECK-MESSAGES: :[[@LINE+2]]:10: note: differing parameters are named here: ('a'), in definition: ('b')
-// CHECK-FIXES: void functionInClassTemplateWithSeparateDeclarationAndDefinition(int b);
- void functionInClassTemplateWithSeparateDeclarationAndDefinition(int a);
-};
-
-template<typename T>
-void ClassTemplate<T>::functionInClassTemplateWithSeparateDeclarationAndDefinition(int b) { b; }
-
-//////////////////////////////////////////////////////
-
-class Class
-{
-public:
- template<typename T>
-// CHECK-MESSAGES: :[[@LINE+4]]:8: warning: function 'Class::memberFunctionTemplateWithSeparateDeclarationAndDefinition' has a definition
-// CHECK-MESSAGES: :[[@LINE+12]]:13: note: the definition seen here
-// CHECK-MESSAGES: :[[@LINE+2]]:8: note: differing parameters are named here: ('a'), in definition: ('b')
-// CHECK-FIXES: void memberFunctionTemplateWithSeparateDeclarationAndDefinition(T b);
- void memberFunctionTemplateWithSeparateDeclarationAndDefinition(T a);
-
- template<typename T>
- void memberFunctionTemplateWithSpecializations(T a) { a; }
-};
-
-//////////////////////////////////////////////////////
-
-template<typename T>
-void Class::memberFunctionTemplateWithSeparateDeclarationAndDefinition(T b) { b; }
-
-//////////////////////////////////////////////////////
-
-template<>
-// CHECK-MESSAGES: :[[@LINE+3]]:13: warning: function template specialization 'Class::memberFunctionTemplateWithSpecializations<int>' has a primary template
-// CHECK-MESSAGES: :[[@LINE-12]]:8: note: the primary template declaration seen here
-// CHECK-MESSAGES: :[[@LINE+1]]:13: note: differing parameters are named here: ('b'), in primary template declaration: ('a')
-void Class::memberFunctionTemplateWithSpecializations(int b) { b; }
-
-template<>
-// CHECK-MESSAGES: :[[@LINE+3]]:13: warning: function template specialization 'Class::memberFunctionTemplateWithSpecializations<float>' has a primary template
-// CHECK-MESSAGES: :[[@LINE-18]]:8: note: the primary template declaration seen here
-// CHECK-MESSAGES: :[[@LINE+1]]:13: note: differing parameters are named here: ('c'), in primary template declaration: ('a')
-void Class::memberFunctionTemplateWithSpecializations(float c) { c; }
-
-//////////////////////////////////////////////////////
-
-// This resulted in a warning by default.
-#define MACRO() \
- void f(int x);
-
-struct S {
- MACRO();
-};
-
-void S::f(int y)
-{
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration-cxx17.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration-cxx17.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration-cxx17.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration-cxx17.cpp (removed)
@@ -1,103 +0,0 @@
-// RUN: %check_clang_tidy -std=c++17 %s readability-isolate-declaration %t
-
-template <typename T1, typename T2>
-struct pair {
- T1 first;
- T2 second;
- pair(T1 v1, T2 v2) : first(v1), second(v2) {}
-
- template <int N>
- decltype(auto) get() const {
- if constexpr (N == 0)
- return first;
- else if constexpr (N == 1)
- return second;
- }
-};
-
-void forbidden_transformations() {
- if (int i = 42, j = i; i == j)
- ;
- switch (int i = 12, j = 14; i)
- ;
-
- auto [i, j] = pair<int, int>(42, 42);
-}
-
-struct SomeClass {
- SomeClass() = default;
- SomeClass(int value);
-};
-
-namespace std {
-template <typename T>
-class initializer_list {};
-
-template <typename T>
-class vector {
-public:
- vector() = default;
- vector(initializer_list<T> init) {}
-};
-
-class string {
-public:
- string() = default;
- string(const char *) {}
-};
-
-namespace string_literals {
-string operator""s(const char *, decltype(sizeof(int))) {
- return string();
-}
-} // namespace string_literals
-} // namespace std
-
-namespace Types {
-typedef int MyType;
-} // namespace Types
-
-int touch1, touch2;
-
-void modern() {
- auto autoInt1 = 3, autoInt2 = 4;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: auto autoInt1 = 3;
- // CHECK-FIXES: {{^ }}auto autoInt2 = 4;
-
- decltype(int()) declnottouch = 4;
- decltype(int()) declint1 = 5, declint2 = 3;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: decltype(int()) declint1 = 5;
- // CHECK-FIXES: {{^ }}decltype(int()) declint2 = 3;
-
- std::vector<int> vectorA = {1, 2}, vectorB = {1, 2, 3}, vectorC({1, 1, 1});
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: std::vector<int> vectorA = {1, 2};
- // CHECK-FIXES: {{^ }}std::vector<int> vectorB = {1, 2, 3};
- // CHECK-FIXES: {{^ }}std::vector<int> vectorC({1, 1, 1});
-
- using uType = int;
- uType utype1, utype2;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: uType utype1;
- // CHECK-FIXES: {{^ }}uType utype2;
-
- Types::MyType mytype1, mytype2, mytype3 = 3;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: Types::MyType mytype1;
- // CHECK-FIXES: {{^ }}Types::MyType mytype2;
- // CHECK-FIXES: {{^ }}Types::MyType mytype3 = 3;
-
- {
- using namespace std::string_literals;
-
- std::vector<std::string> s{"foo"s, "bar"s}, t{"foo"s}, u, a({"hey", "you"}), bb = {"h", "a"};
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: std::vector<std::string> s{"foo"s, "bar"s};
- // CHECK-FIXES: {{^ }}std::vector<std::string> t{"foo"s};
- // CHECK-FIXES: {{^ }}std::vector<std::string> u;
- // CHECK-FIXES: {{^ }}std::vector<std::string> a({"hey", "you"});
- // CHECK-FIXES: {{^ }}std::vector<std::string> bb = {"h", "a"};
- }
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration-fixing.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration-fixing.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration-fixing.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration-fixing.cpp (removed)
@@ -1,64 +0,0 @@
-// RUN: %check_clang_tidy %s readability-isolate-declaration %t
-// XFAIL: *
-
-struct S {
- int a;
- const int b;
- void f() {}
-};
-
-void member_pointers() {
- // FIXME: Memberpointers are transformed incorrect. Emit only a warning
- // for now.
- int S::*p = &S::a, S::*const q = &S::a;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int S::*p = &S::a;
- // CHECK-FIXES: {{^ }}int S::*const q = &S::a;
-
- int /* :: */ S::*pp2 = &S::a, var1 = 0;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int /* :: */ S::*pp2 = &S::a;
- // CHECK-FIXES: {{^ }}int var1 = 0;
-
- const int S::*r = &S::b, S::*t;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: const int S::*r = &S::b;
- // CHECK-FIXES: {{^ }}const int S::*t;
-
- {
- int S::*mdpa1[2] = {&S::a, &S::a}, var1 = 0;
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int S::*mdpa1[2] = {&S::a, &S::a};
- // CHECK-FIXES: {{^ }}int var1 = 0;
-
- int S ::**mdpa2[2] = {&p, &pp2}, var2 = 0;
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int S ::**mdpa2[2] = {&p, &pp2};
- // CHECK-FIXES: {{^ }}int var2 = 0;
-
- void (S::*mdfp1)() = &S::f, (S::*mdfp2)() = &S::f;
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: void (S::*mdfp1)() = &S::f;
- // CHECK-FIXES: {{^ }}void (S::*mdfp2)() = &S::f;
-
- void (S::*mdfpa1[2])() = {&S::f, &S::f}, (S::*mdfpa2)() = &S::f;
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: void (S::*mdfpa1[2])() = {&S::f, &S::f};
- // CHECK-FIXES: {{^ }}void (S::*mdfpa2)() = &S::f;
-
- void (S::* * mdfpa3[2])() = {&mdfpa1[0], &mdfpa1[1]}, (S::*mdfpa4)() = &S::f;
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: void (S::* * mdfpa3[2])() = {&mdfpa1[0], &mdfpa1[1]};
- // CHECK-FIXES: {{^ }}void (S::*mdfpa4)() = &S::f;
- }
-
- class CS {
- public:
- int a;
- const int b;
- };
- int const CS ::*pp = &CS::a, CS::*const qq = &CS::a;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int const CS ::*pp = &CS::a;
- // CHECK-FIXES: {{^ }}int const CS::*const qq = &CS::a;
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration-no-infinite-loop.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration-no-infinite-loop.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration-no-infinite-loop.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration-no-infinite-loop.cpp (removed)
@@ -1,7 +0,0 @@
-// RUN: %check_clang_tidy -expect-clang-tidy-error %s readability-isolate-declaration %t
-
-int main(){
- int a, b
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-MESSAGES: [[@LINE-2]]:11: error: expected ';' at end of declaration [clang-diagnostic-error]
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration.c
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration.c?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration.c (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration.c (removed)
@@ -1,13 +0,0 @@
-// RUN: %check_clang_tidy %s readability-isolate-declaration %t
-
-void c_specific() {
- void (*signal(int sig, void (*func)(int)))(int);
- int i = sizeof(struct S { int i; });
- int j = sizeof(struct T { int i; }), k;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int j = sizeof(struct T { int i; });
- // CHECK-FIXES: {{^ }}int k;
-
- void g(struct U { int i; } s); // One decl
- void h(struct V { int i; } s), m(int i, ...); // Two decls
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-isolate-declaration.cpp (removed)
@@ -1,412 +0,0 @@
-// RUN: %check_clang_tidy %s readability-isolate-declaration %t -- -- -fexceptions
-
-void f() {
- int i;
-}
-
-void f2() {
- int i, j, *k, lala = 42;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int i;
- // CHECK-FIXES: {{^ }}int j;
- // CHECK-FIXES: {{^ }}int *k;
- // CHECK-FIXES: {{^ }}int lala = 42;
-
- int normal, weird = /* comment */ 42;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int normal;
- // CHECK-FIXES: {{^ }}int weird = /* comment */ 42;
-
- int /* here is a comment */ v1,
- // another comment
- v2 = 42 // Ok, more comments
- ;
- // CHECK-MESSAGES: [[@LINE-4]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int /* here is a comment */ v1;
- // CHECK-FIXES: {{^ }}int /* here is a comment */ // another comment
- // CHECK-FIXES: {{^ }}v2 = 42 // Ok, more comments
- // CHECK-FIXES: {{^ }};
-
- auto int1 = 42, int2 = 0, int3 = 43;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: auto int1 = 42;
- // CHECK-FIXES: {{^ }}auto int2 = 0;
- // CHECK-FIXES: {{^ }}auto int3 = 43;
-
- decltype(auto) ptr1 = &int1, ptr2 = &int1;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: decltype(auto) ptr1 = &int1;
- // CHECK-FIXES: {{^ }}decltype(auto) ptr2 = &int1;
-
- decltype(k) ptr3 = &int1, ptr4 = &int1;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: decltype(k) ptr3 = &int1;
- // CHECK-FIXES: {{^ }}decltype(k) ptr4 = &int1;
-}
-
-void f3() {
- int i, *pointer1;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int i;
- // CHECK-FIXES: {{^ }}int *pointer1;
- //
- int *pointer2 = nullptr, *pointer3 = &i;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int *pointer2 = nullptr;
- // CHECK-FIXES: {{^ }}int *pointer3 = &i;
-
- int *(i_ptr) = nullptr, *((i_ptr2));
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int *(i_ptr) = nullptr;
- // CHECK-FIXES: {{^ }}int *((i_ptr2));
-
- float(*f_ptr)[42], (((f_value))) = 42;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: float (*f_ptr)[42];
- // CHECK-FIXES: {{^ }}float (((f_value))) = 42;
-
- float(((*f_ptr2)))[42], ((*f_ptr3)), f_value2 = 42.f;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: float (((*f_ptr2)))[42];
- // CHECK-FIXES: {{^ }}float ((*f_ptr3));
- // CHECK-FIXES: {{^ }}float f_value2 = 42.f;
-
- float(((*f_ptr4)))[42], *f_ptr5, ((f_value3));
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: float (((*f_ptr4)))[42];
- // CHECK-FIXES: {{^ }}float *f_ptr5;
- // CHECK-FIXES: {{^ }}float ((f_value3));
-
- void(((*f2))(int)), (*g2)(int, float);
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: void (((*f2))(int));
- // CHECK-FIXES: {{^ }}void (*g2)(int, float);
-
- float(*(*(*f_ptr6)))[42], (*f_ptr7);
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: float (*(*(*f_ptr6)))[42];
- // CHECK-FIXES: {{^ }}float (*f_ptr7);
-}
-
-void f4() {
- double d = 42. /* foo */, z = 43., /* hi */ y, c /* */ /* */, l = 2.;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: double d = 42. /* foo */;
- // CHECK-FIXES: {{^ }}double z = 43.;
- // CHECK-FIXES: {{^ }}double /* hi */ y;
- // CHECK-FIXES: {{^ }}double c /* */ /* */;
- // CHECK-FIXES: {{^ }}double l = 2.;
-}
-
-struct SomeClass {
- SomeClass() = default;
- SomeClass(int value);
-};
-
-class Point {
- double x;
- double y;
-
-public:
- Point(double x, double y) : x(x), y(y) {}
-};
-
-class Rectangle {
- Point TopLeft;
- Point BottomRight;
-
-public:
- Rectangle(Point TopLeft, Point BottomRight) : TopLeft(TopLeft), BottomRight(BottomRight) {}
-};
-
-void f5() {
- SomeClass v1, v2(42), v3{42}, v4(42.5);
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: SomeClass v1;
- // CHECK-FIXES: {{^ }}SomeClass v2(42);
- // CHECK-FIXES: {{^ }}SomeClass v3{42};
- // CHECK-FIXES: {{^ }}SomeClass v4(42.5);
-
- SomeClass v5 = 42, *p1 = nullptr;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: SomeClass v5 = 42;
- // CHECK-FIXES: {{^ }}SomeClass *p1 = nullptr;
-
- Point P1(0., 2.), P2{2., 0.};
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: Point P1(0., 2.);
- // CHECK-FIXES: {{^ }}Point P2{2., 0.};
-
- Rectangle R1({0., 0.}, {1., -2.}), R2{{0., 1.}, {1., 0.}}, R3(P1, P2), R4{P1, P2};
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: Rectangle R1({0., 0.}, {1., -2.});
- // CHECK-FIXES: {{^ }}Rectangle R2{{[{][{]}}0., 1.}, {1., 0.{{[}][}]}};
- // CHECK-FIXES: {{^ }}Rectangle R3(P1, P2);
- // CHECK-FIXES: {{^ }}Rectangle R4{P1, P2};
-}
-
-void f6() {
- int array1[] = {1, 2, 3, 4}, array2[] = {1, 2, 3}, value1, value2 = 42;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int array1[] = {1, 2, 3, 4};
- // CHECK-FIXES: {{^ }}int array2[] = {1, 2, 3};
- // CHECK-FIXES: {{^ }}int value1;
- // CHECK-FIXES: {{^ }}int value2 = 42;
-}
-
-template <typename T>
-struct TemplatedType {
- TemplatedType() = default;
- TemplatedType(T value);
-};
-
-void f7() {
- TemplatedType<int> TT1(42), TT2{42}, TT3;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: TemplatedType<int> TT1(42);
- // CHECK-FIXES: {{^ }}TemplatedType<int> TT2{42};
- // CHECK-FIXES: {{^ }}TemplatedType<int> TT3;
- //
- TemplatedType<int *> *TT4(nullptr), TT5, **TT6 = nullptr, *const *const TT7{nullptr};
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: TemplatedType<int *> *TT4(nullptr);
- // CHECK-FIXES: {{^ }}TemplatedType<int *> TT5;
- // CHECK-FIXES: {{^ }}TemplatedType<int *> **TT6 = nullptr;
- // CHECK-FIXES: {{^ }}TemplatedType<int *> *const *const TT7{nullptr};
-
- TemplatedType<int &> **TT8(nullptr), *TT9;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: TemplatedType<int &> **TT8(nullptr);
- // CHECK-FIXES: {{^ }}TemplatedType<int &> *TT9;
-
- TemplatedType<int *> TT10{nullptr}, *TT11(nullptr);
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: TemplatedType<int *> TT10{nullptr};
- // CHECK-FIXES: {{^ }}TemplatedType<int *> *TT11(nullptr);
-}
-
-void forbidden_transformations() {
- for (int i = 0, j = 42; i < j; ++i)
- ;
-}
-
-#define NULL 0
-#define MY_NICE_TYPE int **
-#define VAR_NAME(name) name##__LINE__
-#define A_BUNCH_OF_VARIABLES int m1 = 42, m2 = 43, m3 = 44;
-
-void macros() {
- int *p1 = NULL, *p2 = NULL;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int *p1 = NULL;
- // CHECK-FIXES: {{^ }}int *p2 = NULL;
-
- // Macros are involved, so there will be no transformation
- MY_NICE_TYPE p3, v1, v2;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
-
- int VAR_NAME(v3),
- VAR_NAME(v4),
- VAR_NAME(v5);
- // CHECK-MESSAGES: [[@LINE-3]]:3: warning: multiple declarations in a single statement reduces readability
-
- A_BUNCH_OF_VARIABLES
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
-
- int Unconditional,
- // Explanatory comment.
-#if CONFIGURATION
- IfConfigured = 42,
-#else
- IfConfigured = 0;
-#endif
- // CHECK-MESSAGES: [[@LINE-7]]:3: warning: multiple declarations in a single statement reduces readability
-}
-
-void dontTouchParameter(int param1, int param2) {}
-
-struct StructOne {
- StructOne() {}
- StructOne(int b) {}
-
- int member1, member2;
- // TODO: Handle FieldDecl's as well
-};
-
-using PointerType = int;
-
-struct {
- int i;
-} AS1, AS2;
-struct TemT {
- template <typename T>
- T *getAs() {
- return nullptr;
- }
-} TT1, TT2;
-
-void complex_typedefs() {
- typedef int *IntPtr;
- typedef int ArrayType[2];
- typedef int FunType(void);
-
- IntPtr intptr1, intptr2 = nullptr, intptr3;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: IntPtr intptr1;
- // CHECK-FIXES: {{^ }}IntPtr intptr2 = nullptr;
- // CHECK-FIXES: {{^ }}IntPtr intptr3;
-
- IntPtr *DoublePtr1 = nullptr, **TriplePtr, SinglePtr = nullptr;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: IntPtr *DoublePtr1 = nullptr;
- // CHECK-FIXES: {{^ }}IntPtr **TriplePtr;
- // CHECK-FIXES: {{^ }}IntPtr SinglePtr = nullptr;
-
- IntPtr intptr_array1[2], intptr_array2[4] = {nullptr, nullptr, nullptr, nullptr};
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: IntPtr intptr_array1[2];
- // CHECK-FIXES: {{^ }}IntPtr intptr_array2[4] = {nullptr, nullptr, nullptr, nullptr};
-
- ArrayType arraytype1, arraytype2 = {1}, arraytype3;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: ArrayType arraytype1;
- // CHECK-FIXES: {{^ }}ArrayType arraytype2 = {1};
- // CHECK-FIXES: {{^ }}ArrayType arraytype3;
-
- // Don't touch function declarations.
- FunType funtype1, funtype2, functype3;
-
- for (int index1 = 0, index2 = 0;;) {
- int localFor1 = 1, localFor2 = 2;
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int localFor1 = 1;
- // CHECK-FIXES: {{^ }}int localFor2 = 2;
- }
-
- StructOne s1, s2(23), s3, s4(3), *sptr = new StructOne(2);
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: StructOne s1;
- // CHECK-FIXES: {{^ }}StructOne s2(23);
- // CHECK-FIXES: {{^ }}StructOne s3;
- // CHECK-FIXES: {{^ }}StructOne s4(3);
- // CHECK-FIXES: {{^ }}StructOne *sptr = new StructOne(2);
-
- struct StructOne cs1, cs2(42);
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: struct StructOne cs1;
- // CHECK-FIXES: {{^ }}struct StructOne cs2(42);
-
- int *ptrArray[3], dummy, **ptrArray2[5], twoDim[2][3], *twoDimPtr[2][3];
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int *ptrArray[3];
- // CHECK-FIXES: {{^ }}int dummy;
- // CHECK-FIXES: {{^ }}int **ptrArray2[5];
- // CHECK-FIXES: {{^ }}int twoDim[2][3];
- // CHECK-FIXES: {{^ }}int *twoDimPtr[2][3];
-
- {
- void f1(int), g1(int, float);
- }
-
- {
- void gg(int, float);
-
- void (*f2)(int), (*g2)(int, float) = gg;
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: void (*f2)(int);
- // CHECK-FIXES: {{^ }}void (*g2)(int, float) = gg;
-
- void /*(*/ (/*(*/ *f3)(int), (*g3)(int, float);
- // CHECK-MESSAGES: [[@LINE-1]]:5: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: void /*(*/ (/*(*/ *f3)(int);
- // CHECK-FIXES: {{^ }}void /*(*/ (*g3)(int, float);
- }
-
- // clang-format off
- auto returner = []() { return int(32); };
- int intfunction = returner(), intarray[] =
- {
- 1,
- 2,
- 3,
- 4
- }, bb = 4;
- // CHECK-MESSAGES: [[@LINE-7]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int intfunction = returner();
- // CHECK-FIXES: {{^ }}int intarray[] =
- // CHECK-FIXES: {{^ }}{
- // CHECK-FIXES: {{^ }}1,
- // CHECK-FIXES: {{^ }}2,
- // CHECK-FIXES: {{^ }}3,
- // CHECK-FIXES: {{^ }}4
- // CHECK-FIXES: {{^ }}};
- // CHECK-FIXES: {{^ }}int bb = 4;
- // clang-format on
-
- TemT *T1 = &TT1, *T2 = &TT2;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: TemT *T1 = &TT1;
- // CHECK-FIXES: {{^ }}TemT *T2 = &TT2;
-
- const PointerType *PT1 = T1->getAs<PointerType>(),
- *PT2 = T2->getAs<PointerType>();
- // CHECK-MESSAGES: [[@LINE-2]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: const PointerType *PT1 = T1->getAs<PointerType>();
- // CHECK-FIXES: {{^ }}const PointerType *PT2 = T2->getAs<PointerType>();
-
- const int *p1 = nullptr;
- const int *p2 = nullptr;
-
- const int *&pref1 = p1, *&pref2 = p2;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: const int *&pref1 = p1;
- // CHECK-FIXES: {{^ }}const int *&pref2 = p2;
-
- // clang-format off
- const char *literal1 = "clang" "test"\
- "one",
- *literal2 = "empty", literal3[] = "three";
- // CHECK-MESSAGES: [[@LINE-3]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: const char *literal1 = "clang" "test"\
- // CHECK-FIXES: {{^ }}"one";
- // CHECK-FIXES: {{^ }}const char *literal2 = "empty";
- // CHECK-FIXES: {{^ }}const char literal3[] = "three";
- // clang-format on
-}
-
-void g() try {
- int i, j;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: int i;
- // CHECK-FIXES: {{^ }}int j;
-} catch (...) {
-}
-
-struct S {
- int a;
- const int b;
- void f() {}
-};
-
-void memberPointers() {
- typedef const int S::*MemPtr;
- MemPtr aaa = &S::a, bbb = &S::b;
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
- // CHECK-FIXES: MemPtr aaa = &S::a;
- // CHECK-FIXES: {{^ }}MemPtr bbb = &S::b;
-}
-
-typedef int *tptr, tbt;
-typedef int (&tfp)(int, long), tarr[10];
-typedef int tarr2[10], tct;
-
-template <typename A, typename B>
-void should_not_be_touched(A, B);
-
-int variable, function(void);
-
-int call_func_with_sideeffect();
-void bad_if_decl() {
- if (true)
- int i, j, k = call_func_with_sideeffect();
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-magic-numbers.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-magic-numbers.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-magic-numbers.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-magic-numbers.cpp (removed)
@@ -1,199 +0,0 @@
-// RUN: %check_clang_tidy %s readability-magic-numbers %t \
-// RUN: -config='{CheckOptions: \
-// RUN: [{key: readability-magic-numbers.IgnoredIntegerValues, value: "0;1;2;10;100;"}, \
-// RUN: {key: readability-magic-numbers.IgnoredFloatingPointValues, value: "3.14;2.71828;9.81;10000.0;101.0;0x1.2p3"}, \
-// RUN: {key: readability-magic-numbers.IgnorePowersOf2IntegerValues, value: 1}]}' \
-// RUN: --
-
-template <typename T, int V>
-struct ValueBucket {
- T value[V];
-};
-
-int BadGlobalInt = 5;
-// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: 5 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-
-int IntSquarer(int param) {
- return param * param;
-}
-
-void BuggyFunction() {
- int BadLocalInt = 6;
- // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: 6 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-
- (void)IntSquarer(7);
- // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: 7 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-
- int LocalArray[15];
- // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: 15 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-
- for (int ii = 0; ii < 22; ++ii)
- // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 22 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
- {
- LocalArray[ii] = 3 * ii;
- // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: 3 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
- }
-
- ValueBucket<int, 66> Bucket;
- // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: 66 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-}
-
-class TwoIntContainer {
-public:
- TwoIntContainer(int val) : anotherMember(val * val), yetAnotherMember(6), anotherConstant(val + val) {}
- // CHECK-MESSAGES: :[[@LINE-1]]:73: warning: 6 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-
- int getValue() const;
-
-private:
- int oneMember = 9;
- // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: 9 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-
- int anotherMember;
-
- int yetAnotherMember;
-
- const int oneConstant = 2;
-
- const int anotherConstant;
-};
-
-int ValueArray[] = {3, 5};
-// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: 3 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-// CHECK-MESSAGES: :[[@LINE-2]]:24: warning: 5 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-
-float FloatPiVariable = 3.1415926535f;
-// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: 3.1415926535f is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-double DoublePiVariable = 6.283185307;
-// CHECK-MESSAGES: :[[@LINE-1]]:27: warning: 6.283185307 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-
-float SomeFloats[] = {0.5, 0x1.2p4};
-// CHECK-MESSAGES: :[[@LINE-1]]:23: warning: 0.5 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-// CHECK-MESSAGES: :[[@LINE-2]]:28: warning: 0x1.2p4 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-
-int getAnswer() {
- if (ValueArray[0] < ValueArray[1])
- return ValueArray[1];
-
- return -3; // FILENOTFOUND
- // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: 3 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
-}
-
-/*
- * Clean code
- */
-
-#define INT_MACRO 5
-
-const int GoodGlobalIntConstant = 42;
-
-constexpr int AlsoGoodGlobalIntConstant = 42;
-
-int InitializedByMacro = INT_MACRO;
-
-void SolidFunction() {
- const int GoodLocalIntConstant = 43;
-
- (void)IntSquarer(GoodLocalIntConstant);
-
- int LocalArray[INT_MACRO];
-
- ValueBucket<int, INT_MACRO> Bucket;
-}
-
-const int ConstValueArray[] = {7, 9};
-
-const int ConstValueArray2D[2][2] = {{7, 9}, {13, 15}};
-
-/*
- * no warnings for ignored values (specified in the configuration above)
- */
-int GrandfatheredIntegerValues[] = {0, 1, 2, 10, 100, -1, -10, -100, 65536};
-
-float GrandfatheredFloatValues[] = {3.14f, 3.14, 2.71828, 2.71828f, -1.01E2, 1E4, 0x1.2p3};
-
-/*
- * no warnings for enums
- */
-enum Smorgasbord {
- STARTER,
- ALPHA = 3,
- BETA = 1 << 5,
-};
-
-const float FloatPiConstant = 3.1415926535f;
-const double DoublePiConstant = 6.283185307;
-
-const float Angles[] = {45.0f, 90.0f, 135.0f};
-
-double DoubleZeroIsAccepted = 0.0;
-float FloatZeroIsAccepted = 0.0f;
-
-namespace geometry {
-
-template <typename T>
-struct Point {
- T x;
- T y;
-
- explicit Point(T xval, T yval) noexcept : x{xval}, y{yval} {
- }
-};
-
-template <typename T>
-struct Dimension {
- T x;
- T y;
-
- explicit Dimension(T xval, T yval) noexcept : x{xval}, y{yval} {
- }
-};
-
-template <typename T>
-struct Rectangle {
- Point<T> origin;
- Dimension<T> size;
- T rotation; // angle of rotation around origin
-
- Rectangle(Point<T> origin_, Dimension<T> size_, T rotation_ = 0) noexcept : origin{origin_}, size{size_}, rotation{rotation_} {
- }
-
- bool contains(Point<T> point) const;
-};
-
-} // namespace geometry
-
-const geometry::Rectangle<double> mandelbrotCanvas{geometry::Point<double>{-2.5, -1}, geometry::Dimension<double>{3.5, 2}};
-
-// Simulate the macro magic in Google Test internal headers
-class AssertionHelper {
-public:
- AssertionHelper(const char *Message, int LineNumber) : Message(Message), LineNumber(LineNumber) {}
-
-private:
- const char *Message;
- int LineNumber;
-};
-
-#define ASSERTION_HELPER_AT(M, L) AssertionHelper(M, L)
-
-#define ASSERTION_HELPER(M) ASSERTION_HELPER_AT(M, __LINE__)
-
-void FunctionWithCompilerDefinedSymbol(void) {
- ASSERTION_HELPER("here and now");
-}
-
-// prove that integer literals introduced by the compiler are accepted silently
-extern int ConsumeString(const char *Input);
-
-const char *SomeStrings[] = {"alpha", "beta", "gamma"};
-
-int TestCheckerOverreach() {
- int Total = 0;
-
- for (const auto *Str : SomeStrings) {
- Total += ConsumeString(Str);
- }
-
- return Total;
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-misleading-indentation.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-misleading-indentation.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-misleading-indentation.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-misleading-indentation.cpp (removed)
@@ -1,120 +0,0 @@
-// RUN: %check_clang_tidy %s readability-misleading-indentation %t
-
-void foo1();
-void foo2();
-
-#define BLOCK \
- if (cond1) \
- foo1(); \
- foo2();
-
-void f()
-{
- bool cond1 = true;
- bool cond2 = true;
-
- if (cond1)
- if (cond2)
- foo1();
- else
- foo2();
- // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: different indentation for 'if' and corresponding 'else' [readability-misleading-indentation]
-
- if (cond1) {
- if (cond2)
- foo1();
- }
- else
- foo2();
-
- if (cond1)
- if (cond2)
- foo1();
- else
- foo2();
-
- if (cond2)
- foo1();
- foo2();
- // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: misleading indentation: statement is indented too deeply [readability-misleading-indentation]
- // CHECK-MESSAGES: :[[@LINE-4]]:3: note: did you mean this line to be inside this 'if'
- foo2(); // No redundant warning.
-
- if (cond1)
- {
- foo1();
- }
- foo2();
-
- if (cond1)
- foo1();
- foo2();
-
- if (cond2)
- if (cond1) foo1(); else foo2();
-
- if (cond1) {
- } else {
- }
-
- if (cond1) {
- }
- else {
- }
-
- if (cond1)
- {
- }
- else
- {
- }
-
- if (cond1)
- {
- }
- else
- {
- }
-
- if(cond1) {
- }
- else if (cond2) {
- }
- else {
- }
-
- if(cond1) {
- }
- else if (cond2) {
- }
- else {
- }
- // CHECK-MESSAGES: :[[@LINE-2]]:8: warning: different indentation for 'if' and corresponding 'else' [readability-misleading-indentation]
-
- if (cond1) {
- if (cond1) {
- }
- else if (cond2) {
- }
- else {
- }
- if (cond1) {
- } else if (cond2) {
- } else if (!cond2) {
- } else {
- }
- }
- else if (cond2) {
- }
-
- BLOCK
-}
-
-void g(bool x) {
- if (x)
- #pragma unroll
- for (int k = 0; k < 1; ++k) {}
-
- #pragma unroll
- for (int k = 0; k < 1; ++k) {}
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-misplaced-array-index.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-misplaced-array-index.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-misplaced-array-index.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-misplaced-array-index.cpp (removed)
@@ -1,34 +0,0 @@
-// RUN: %check_clang_tidy %s readability-misplaced-array-index %t
-
-#define ABC "abc"
-
-struct XY { int *X; int *Y; };
-
-void dostuff(int);
-
-void unusualSyntax(int *P1, struct XY *P2) {
- 10[P1] = 0;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: confusing array subscript expression, usually the index is inside the []
- // CHECK-FIXES: P1[10] = 0;
-
- 10[P2->X] = 0;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: confusing array subscript expression
- // CHECK-FIXES: P2->X[10] = 0;
-
- dostuff(1["abc"]);
- // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: confusing array subscript expression
- // CHECK-FIXES: dostuff("abc"[1]);
-
- dostuff(1[ABC]);
- // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: confusing array subscript expression
- // CHECK-FIXES: dostuff(ABC[1]);
-
- dostuff(0[0 + ABC]);
- // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: confusing array subscript expression
- // CHECK-FIXES: dostuff(0[0 + ABC]);
- // No fixit. Probably the code should be ABC[0]
-}
-
-void normalSyntax(int *X) {
- X[10] = 0;
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-named-parameter.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-named-parameter.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-named-parameter.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-named-parameter.cpp (removed)
@@ -1,133 +0,0 @@
-// RUN: %check_clang_tidy %s readability-named-parameter %t
-
-void Method(char *) { /* */ }
-// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: all parameters should be named in a function
-// CHECK-FIXES: void Method(char * /*unused*/) { /* */ }
-void Method2(char *) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: all parameters should be named in a function
-// CHECK-FIXES: void Method2(char * /*unused*/) {}
-void Method3(char *, void *) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: all parameters should be named in a function
-// CHECK-FIXES: void Method3(char * /*unused*/, void * /*unused*/) {}
-void Method4(char *, int /*unused*/) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: all parameters should be named in a function
-// CHECK-FIXES: void Method4(char * /*unused*/, int /*unused*/) {}
-void operator delete[](void *) throw() {}
-// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: all parameters should be named in a function
-// CHECK-FIXES: void operator delete[](void * /*unused*/) throw() {}
-int Method5(int) { return 0; }
-// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: all parameters should be named in a function
-// CHECK-FIXES: int Method5(int /*unused*/) { return 0; }
-void Method6(void (*)(void *)) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: all parameters should be named in a function
-// CHECK-FIXES: void Method6(void (* /*unused*/)(void *)) {}
-template <typename T> void Method7(T) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:37: warning: all parameters should be named in a function
-// CHECK-FIXES: template <typename T> void Method7(T /*unused*/) {}
-
-// Don't warn in macros.
-#define M void MethodM(int) {}
-M
-
-void operator delete(void *x) throw() {}
-void Method7(char * /*x*/) {}
-void Method8(char *x) {}
-typedef void (*TypeM)(int x);
-void operator delete[](void *x) throw();
-void operator delete[](void * /*x*/) throw();
-
-struct X {
- X operator++(int) {}
- X operator--(int) {}
-
- X(X&) = delete;
- X &operator=(X&) = default;
-
- const int &i;
-};
-
-void (*Func1)(void *);
-void Func2(void (*func)(void *)) {}
-template <void Func(void *)> void Func3() {}
-
-template <typename T>
-struct Y {
- void foo(T) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: all parameters should be named in a function
-// CHECK-FIXES: void foo(T /*unused*/) {}
-};
-
-Y<int> y;
-Y<float> z;
-
-struct Base {
- virtual void foo(bool notThisOne);
- virtual void foo(int argname);
-};
-
-struct Derived : public Base {
- void foo(int);
-// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: all parameters should be named in a function
-// CHECK-FIXES: void foo(int /*argname*/);
-};
-
-void FDef(int);
-// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: all parameters should be named in a function
-// CHECK-FIXES: void FDef(int /*n*/);
-void FDef(int n) {}
-
-void FDef2(int, int);
-// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: all parameters should be named in a function
-// CHECK-FIXES: void FDef2(int /*n*/, int /*unused*/);
-void FDef2(int n, int) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: all parameters should be named in a function
-// CHECK-FIXES: void FDef2(int n, int /*unused*/) {}
-
-void FNoDef(int);
-
-class Z {};
-
-Z &operator++(Z&) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function
-// CHECK-FIXES: Z &operator++(Z& /*unused*/) {}
-
-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) {}
-
-Z &operator--(Z&) {}
-// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: all parameters should be named in a function
-// CHECK-FIXES: Z &operator--(Z& /*unused*/) {}
-
-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) {}
-
-namespace testing {
-namespace internal {
-class IgnoredValue {
- public:
- template <typename T>
- IgnoredValue(const T& /* ignored */) {}
-};
-}
-typedef internal::IgnoredValue Unused;
-}
-
-using ::testing::Unused;
-
-void MockFunction(Unused, int q, Unused) {
- ++q;
- ++q;
- ++q;
-}
-
-namespace std {
-typedef decltype(nullptr) nullptr_t;
-}
-
-void f(std::nullptr_t) {}
-
-typedef void (F)(int);
-F f;
-void f(int x) {}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-non-const-parameter.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-non-const-parameter.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-non-const-parameter.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-non-const-parameter.cpp (removed)
@@ -1,289 +0,0 @@
-// RUN: %check_clang_tidy %s readability-non-const-parameter %t
-
-// Currently the checker only warns about pointer arguments.
-//
-// It can be defined both that the data is const and that the pointer is const,
-// the checker only checks if the data can be const-specified.
-//
-// It does not warn about pointers to records or function pointers.
-
-// Some external function where first argument is nonconst and second is const.
-char *strcpy1(char *dest, const char *src);
-unsigned my_strcpy(char *buf, const char *s);
-unsigned my_strlen(const char *buf);
-
-// CHECK-MESSAGES: :[[@LINE+1]]:29: warning: pointer parameter 'last' can be pointer to const [readability-non-const-parameter]
-void warn1(int *first, int *last) {
- // CHECK-FIXES: {{^}}void warn1(int *first, const int *last) {{{$}}
- *first = 0;
- if (first < last) {
- } // <- last can be const
-}
-
-// TODO: warning should be written here
-void warn2(char *p) {
- char buf[10];
- strcpy1(buf, p);
-}
-
-// CHECK-MESSAGES: :[[@LINE+1]]:19: warning: pointer parameter 'p' can be
-void assign1(int *p) {
- // CHECK-FIXES: {{^}}void assign1(const int *p) {{{$}}
- const int *q;
- q = p;
-}
-
-// CHECK-MESSAGES: :[[@LINE+1]]:19: warning: pointer parameter 'p' can be
-void assign2(int *p) {
- // CHECK-FIXES: {{^}}void assign2(const int *p) {{{$}}
- const int *q;
- q = p + 1;
-}
-
-void assign3(int *p) {
- *p = 0;
-}
-
-void assign4(int *p) {
- *p += 2;
-}
-
-void assign5(char *p) {
- p[0] = 0;
-}
-
-void assign6(int *p) {
- int *q;
- q = p++;
-}
-
-void assign7(char *p) {
- char *a, *b;
- a = b = p;
-}
-
-void assign8(char *a, char *b) {
- char *x;
- x = (a ? a : b);
-}
-
-void assign9(unsigned char *str, const unsigned int i) {
- unsigned char *p;
- for (p = str + i; *p;) {
- }
-}
-
-void assign10(int *buf) {
- int i, *p;
- for (i = 0, p = buf; i < 10; i++, p++) {
- *p = 1;
- }
-}
-
-// CHECK-MESSAGES: :[[@LINE+1]]:17: warning: pointer parameter 'p' can be
-void init1(int *p) {
- // CHECK-FIXES: {{^}}void init1(const int *p) {{{$}}
- const int *q = p;
-}
-
-// CHECK-MESSAGES: :[[@LINE+1]]:17: warning: pointer parameter 'p' can be
-void init2(int *p) {
- // CHECK-FIXES: {{^}}void init2(const int *p) {{{$}}
- const int *q = p + 1;
-}
-
-void init3(int *p) {
- int *q = p;
-}
-
-void init4(float *p) {
- int *q = (int *)p;
-}
-
-void init5(int *p) {
- int *i = p ? p : 0;
-}
-
-void init6(int *p) {
- int *a[] = {p, p, 0};
-}
-
-void init7(int *p, int x) {
- for (int *q = p + x - 1; 0; q++)
- ;
-}
-
-// CHECK-MESSAGES: :[[@LINE+1]]:18: warning: pointer parameter 'p' can be
-int return1(int *p) {
- // CHECK-FIXES: {{^}}int return1(const int *p) {{{$}}
- return *p;
-}
-
-// CHECK-MESSAGES: :[[@LINE+1]]:25: warning: pointer parameter 'p' can be
-const int *return2(int *p) {
- // CHECK-FIXES: {{^}}const int *return2(const int *p) {{{$}}
- return p;
-}
-
-// CHECK-MESSAGES: :[[@LINE+1]]:25: warning: pointer parameter 'p' can be
-const int *return3(int *p) {
- // CHECK-FIXES: {{^}}const int *return3(const int *p) {{{$}}
- return p + 1;
-}
-
-// CHECK-MESSAGES: :[[@LINE+1]]:27: warning: pointer parameter 'p' can be
-const char *return4(char *p) {
- // CHECK-FIXES: {{^}}const char *return4(const char *p) {{{$}}
- return p ? p : "";
-}
-
-char *return5(char *s) {
- return s;
-}
-
-char *return6(char *s) {
- return s + 1;
-}
-
-char *return7(char *a, char *b) {
- return a ? a : b;
-}
-
-char return8(int *p) {
- return ++(*p);
-}
-
-void dontwarn1(int *p) {
- ++(*p);
-}
-
-void dontwarn2(int *p) {
- (*p)++;
-}
-
-int dontwarn3(_Atomic(int) * p) {
- return *p;
-}
-
-void callFunction1(char *p) {
- strcpy1(p, "abc");
-}
-
-void callFunction2(char *p) {
- strcpy1(&p[0], "abc");
-}
-
-void callFunction3(char *p) {
- strcpy1(p + 2, "abc");
-}
-
-char *callFunction4(char *p) {
- return strcpy1(p, "abc");
-}
-
-unsigned callFunction5(char *buf) {
- unsigned len = my_strlen(buf);
- return len + my_strcpy(buf, "abc");
-}
-
-void f6(int **p);
-void callFunction6(int *p) { f6(&p); }
-
-typedef union { void *v; } t;
-void f7(t obj);
-void callFunction7(int *p) {
- f7((t){p});
-}
-
-void f8(int &x);
-void callFunction8(int *p) {
- f8(*p);
-}
-
-// Don't warn about nonconst function pointers that can be const.
-void functionpointer(double f(double), int x) {
- f(x);
-}
-
-// TODO: This is a false positive.
-// CHECK-MESSAGES: :[[@LINE+1]]:27: warning: pointer parameter 'p' can be
-int functionpointer2(int *p) {
- return *p;
-}
-void use_functionpointer2() {
- int (*fp)(int *) = functionpointer2; // <- the parameter 'p' can't be const
-}
-
-// Don't warn about nonconst record pointers that can be const.
-struct XY {
- int *x;
- int *y;
-};
-void recordpointer(struct XY *xy) {
- *(xy->x) = 0;
-}
-
-class C {
-public:
- C(int *p) : p(p) {}
-
-private:
- int *p;
-};
-
-class C2 {
-public:
- // CHECK-MESSAGES: :[[@LINE+1]]:11: warning: pointer parameter 'p' can be
- C2(int *p) : p(p) {}
- // CHECK-FIXES: {{^}} C2(const int *p) : p(p) {}{{$}}
-
-private:
- const int *p;
-};
-
-void tempObject(int *p) {
- C c(p);
-}
-
-// avoid fp for const pointer array
-void constPointerArray(const char *remapped[][2]) {
- const char *name = remapped[0][0];
-}
-
-class Warn {
-public:
- // CHECK-MESSAGES: :[[@LINE+1]]:21: warning: pointer parameter 'p' can be
- void doStuff(int *p) {
- // CHECK-FIXES: {{^}} void doStuff(const int *p) {{{$}}
- x = *p;
- }
-
-private:
- int x;
-};
-
-class Base {
-public:
- // Ensure there is no false positive for this method. It is virtual.
- virtual void doStuff(int *p) {
- int x = *p;
- }
-};
-
-class Derived : public Base {
-public:
- // Ensure there is no false positive for this method. It overrides a method.
- void doStuff(int *p) override {
- int x = *p;
- }
-};
-
-extern char foo(char *s); // 1
-// CHECK-FIXES: {{^}}extern char foo(const char *s); // 1{{$}}
-// CHECK-MESSAGES: :[[@LINE+1]]:16: warning: pointer parameter 's' can be
-char foo(char *s) {
- // CHECK-FIXES: {{^}}char foo(const char *s) {{{$}}
- return *s;
-}
-char foo(char *s); // 2
-// CHECK-FIXES: {{^}}char foo(const char *s); // 2{{$}}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-control-flow.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-control-flow.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-control-flow.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-control-flow.cpp (removed)
@@ -1,224 +0,0 @@
-// RUN: %check_clang_tidy %s readability-redundant-control-flow %t
-
-void g(int i);
-void j();
-
-void f() {
- return;
-}
-// CHECK-MESSAGES: :[[@LINE-2]]:3: warning: redundant return statement at the end of a function with a void return type [readability-redundant-control-flow]
-// CHECK-FIXES: {{^}}void f() {{{$}}
-// CHECK-FIXES-NEXT: {{^ *}$}}
-
-void g() {
- f();
- return;
-}
-// CHECK-MESSAGES: :[[@LINE-2]]:3: warning: redundant return statement
-// CHECK-FIXES: {{^ }}f();{{$}}
-// CHECK-FIXES-NEXT: {{^ *}$}}
-
-void g(int i) {
- if (i < 0) {
- return;
- }
- if (i < 10) {
- f();
- }
-}
-
-int h() {
- return 1;
-}
-
-void j() {
-}
-
-void k() {
- for (int i = 0; i < 10; ++i) {
- continue;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:5: warning: redundant continue statement at the end of loop statement
-// CHECK-FIXES: {{^}} for (int i = 0; i < 10; ++i) {{{$}}
-// CHECK-FIXES-NEXT: {{^ *}$}}
-
-void k2() {
- int v[10] = { 0 };
- for (auto i : v) {
- continue;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:5: warning: redundant continue statement
-// CHECK-FIXES: {{^}} for (auto i : v) {{{$}}
-// CHECK-FIXES-NEXT: {{^ *}$}}
-
-void m() {
- int i = 0;
- do {
- ++i;
- continue;
- } while (i < 10);
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:5: warning: redundant continue statement
-// CHECK-FIXES: {{^ do {$}}
-// CHECK-FIXES-NEXT: {{^}} ++i;{{$}}
-// CHECK-FIXES-NEXT: {{^ *}}} while (i < 10);{{$}}
-
-void p() {
- int i = 0;
- while (i < 10) {
- ++i;
- continue;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:5: warning: redundant continue statement
-// CHECK-FIXES: {{^}} while (i < 10) {{{$}}
-// CHECK-FIXES-NEXT: {{^}} ++i;{{$}}
-// CHECK-FIXES-NEXT: {{^ *}$}}
-
-void im_not_dead(int i) {
- if (i > 0) {
- return;
- }
- g();
-}
-
-void im_still_not_dead(int i) {
- for (int j = 0; j < 10; ++j) {
- if (i < 10) {
- continue;
- }
- g();
- }
-}
-
-void im_dead(int i) {
- if (i > 0) {
- return;
- g();
- }
- g();
-}
-
-void im_still_dead(int i) {
- for (int j = 0; j < 10; ++j) {
- if (i < 10) {
- continue;
- g();
- }
- g();
- }
-}
-
-void void_return() {
- return g();
-}
-
-void nested_return_unmolested() {
- g();
- {
- g();
- return;
- }
-}
-
-void nested_continue_unmolested() {
- for (int i = 0; i < 10; ++i) {
- if (i < 5) {
- continue;
- }
- }
-}
-
-#define MACRO_RETURN_UNMOLESTED(fn_) \
- (fn_)(); \
- return
-
-#define MACRO_CONTINUE_UNMOLESTED(x_) \
- do { \
- for (int i = 0; i < (x_); ++i) { \
- continue; \
- } \
- } while (false)
-
-void macro_return() {
- MACRO_RETURN_UNMOLESTED(g);
-}
-
-void macro_continue() {
- MACRO_CONTINUE_UNMOLESTED(10);
-}
-
-#define MACRO_RETURN_ARG(stmt_) \
- stmt_
-
-#define MACRO_CONTINUE_ARG(stmt_) \
- do { \
- for (int i = 0; i < 10; ++i) { \
- stmt_; \
- } \
- } while (false)
-
-void macro_arg_return() {
- MACRO_RETURN_ARG(return);
-}
-
-void macro_arg_continue() {
- MACRO_CONTINUE_ARG(continue);
-}
-
-template <typename T>
-void template_return(T check) {
- if (check < T(0)) {
- return;
- }
- return;
-}
-// CHECK-MESSAGES: :[[@LINE-2]]:3: warning: redundant return statement
-// CHECK-FIXES: {{^}} if (check < T(0)) {{{$}}
-// CHECK-FIXES-NEXT: {{^ return;$}}
-// CHECK-FIXES-NEXT: {{^ *}$}}
-// CHECK-FIXES-NEXT: {{^ *}$}}
-
-template <>
-void template_return(int check) {
- if (check < 0) {
- return;
- }
- return;
-}
-// CHECK-MESSAGES: :[[@LINE-2]]:3: warning: redundant return statement
-// CHECK-FIXES: {{^}} if (check < 0) {{{$}}
-// CHECK-FIXES-NEXT: {{^ return;$}}
-// CHECK-FIXES-NEXT: {{^ *}$}}
-// CHECK-FIXES-NEXT: {{^ *}$}}
-
-template <typename T>
-void template_loop(T end) {
- for (T i = 0; i < end; ++i) {
- continue;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:5: warning: redundant continue statement
-// CHECK-FIXES: {{^}} for (T i = 0; i < end; ++i) {{{$}}
-// CHECK-FIXES-NEXT: {{^ *}$}}
-
-template <>
-void template_loop(int end) {
- for (int i = 0; i < end; ++i) {
- continue;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:5: warning: redundant continue statement
-// CHECK-FIXES: {{^}} for (int i = 0; i < end; ++i) {{{$}}
-// CHECK-FIXES-NEXT: {{^ *}$}}
-
-void call_templates() {
- template_return(10);
- template_return(10.0f);
- template_return(10.0);
- template_loop(10);
- template_loop(10L);
- template_loop(10U);
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration-ignore-macros.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration-ignore-macros.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration-ignore-macros.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration-ignore-macros.cpp (removed)
@@ -1,21 +0,0 @@
-// RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \
-// RUN: -config="{CheckOptions: \
-// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
-// RUN: value: 1}]}"
-
-extern int Xyz;
-extern int Xyz; // Xyz
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'Xyz' declaration [readability-redundant-declaration]
-// CHECK-FIXES: {{^}}// Xyz{{$}}
-
-namespace macros {
-#define DECLARE(x) extern int x
-#define DEFINE(x) extern int x; int x = 42
-DECLARE(test);
-DEFINE(test);
-// CHECK-FIXES: {{^}}#define DECLARE(x) extern int x{{$}}
-// CHECK-FIXES: {{^}}#define DEFINE(x) extern int x; int x = 42{{$}}
-// CHECK-FIXES: {{^}}DECLARE(test);{{$}}
-// CHECK-FIXES: {{^}}DEFINE(test);{{$}}
-
-} // namespace macros
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.c
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.c?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.c (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.c (removed)
@@ -1,31 +0,0 @@
-// RUN: %check_clang_tidy %s readability-redundant-declaration %t
-
-extern int Xyz;
-extern int Xyz; // Xyz
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'Xyz' declaration [readability-redundant-declaration]
-// CHECK-FIXES: {{^}}// Xyz{{$}}
-int Xyz = 123;
-
-extern int A;
-extern int A, B;
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'A' declaration
-// CHECK-FIXES: {{^}}extern int A, B;{{$}}
-
-extern int Buf[10];
-extern int Buf[10]; // Buf[10]
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'Buf' declaration
-// CHECK-FIXES: {{^}}// Buf[10]{{$}}
-
-static int f();
-static int f(); // f
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'f' declaration
-// CHECK-FIXES: {{^}}// f{{$}}
-static int f() {}
-
-inline void g() {}
-
-inline void g();
-// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant 'g' declaration
-
-// OK: Needed to emit an external definition.
-extern inline void g();
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp (removed)
@@ -1,96 +0,0 @@
-// RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \
-// RUN: -config="{CheckOptions: \
-// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
-// RUN: value: 0}]}"
-//
-// With -fms-compatibility and -DEXTERNINLINE, the extern inline shouldn't
-// produce additional diagnostics, so same check suffix as before:
-// RUN: %check_clang_tidy %s readability-redundant-declaration %t -- \
-// RUN: -config="{CheckOptions: \
-// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
-// RUN: value: 0}]}" -- -fms-compatibility -DEXTERNINLINE
-//
-// With -fno-ms-compatiblity, DEXTERNINLINE causes additional output.
-// (The leading ',' means "default checks in addition to NOMSCOMPAT checks.)
-// RUN: %check_clang_tidy -check-suffix=,NOMSCOMPAT \
-// RUN: %s readability-redundant-declaration %t -- \
-// RUN: -config="{CheckOptions: \
-// RUN: [{key: readability-redundant-declaration.IgnoreMacros, \
-// RUN: value: 0}]}" -- -fno-ms-compatibility -DEXTERNINLINE
-
-extern int Xyz;
-extern int Xyz; // Xyz
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'Xyz' declaration [readability-redundant-declaration]
-// CHECK-FIXES: {{^}}// Xyz{{$}}
-int Xyz = 123;
-
-extern int A;
-extern int A, B;
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'A' declaration
-// CHECK-FIXES: {{^}}extern int A, B;{{$}}
-
-extern int Buf[10];
-extern int Buf[10]; // Buf[10]
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'Buf' declaration
-// CHECK-FIXES: {{^}}// Buf[10]{{$}}
-
-static int f();
-static int f(); // f
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'f' declaration
-// CHECK-FIXES: {{^}}// f{{$}}
-static int f() {}
-
-// Original check crashed for the code below.
-namespace std {
-typedef decltype(sizeof(0)) size_t;
-}
-void *operator new(std::size_t) __attribute__((__externally_visible__));
-void *operator new[](std::size_t) __attribute__((__externally_visible__));
-
-// Don't warn about static member definition.
-struct C {
- static int I;
-};
-int C::I;
-
-template <class T>
-struct C2 {
- C2();
-};
-
-template <class T>
-C2<T>::C2() = default;
-
-void best_friend();
-
-struct Friendly {
- friend void best_friend();
- friend void enemy();
-};
-
-void enemy();
-
-namespace macros {
-#define DECLARE(x) extern int x
-#define DEFINE(x) extern int x; int x = 42
-DECLARE(test);
-DEFINE(test);
-// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant 'test' declaration
-// CHECK-FIXES: {{^}}#define DECLARE(x) extern int x{{$}}
-// CHECK-FIXES: {{^}}#define DEFINE(x) extern int x; int x = 42{{$}}
-// CHECK-FIXES: {{^}}DECLARE(test);{{$}}
-// CHECK-FIXES: {{^}}DEFINE(test);{{$}}
-
-} // namespace macros
-
-inline void g() {}
-
-inline void g(); // g
-// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant 'g' declaration
-// CHECK-FIXES: {{^}}// g{{$}}
-
-#if defined(EXTERNINLINE)
-extern inline void g(); // extern g
-// CHECK-MESSAGES-NOMSCOMPAT: :[[@LINE-1]]:20: warning: redundant 'g' declaration
-// CHECK-FIXES-NOMSCOMPAT: {{^}}// extern g{{$}}
-#endif
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-function-ptr-dereference.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-function-ptr-dereference.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-function-ptr-dereference.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-function-ptr-dereference.cpp (removed)
@@ -1,45 +0,0 @@
-// RUN: %check_clang_tidy %s readability-redundant-function-ptr-dereference %t
-
-void f(int i);
-
-void positive() {
- void (*p)(int) = f;
-
- (**p)(1);
- // CHECK-MESSAGES: :[[@LINE-1]]:4: warning: redundant repeated dereference of function pointer [readability-redundant-function-ptr-dereference]
- // CHECK-FIXES: (*p)(1);
- (*****p)(2);
- // CHECK-MESSAGES: :[[@LINE-1]]:4: warning: redundant repeated
- // CHECK-MESSAGES: :[[@LINE-2]]:5: warning: redundant repeated
- // CHECK-MESSAGES: :[[@LINE-3]]:6: warning: redundant repeated
- // CHECK-MESSAGES: :[[@LINE-4]]:7: warning: redundant repeated
- // CHECK-FIXES: (*p)(2);
-}
-
-template<typename T>
-void invoke(const T& fn) {
- fn(0); // 1
- (*fn)(0); // 2
- // CHECK-MESSAGES: :[[@LINE-1]]:4: warning: redundant repeated
- // CHECK-FIXES: fn(0); // 1
- // CHECK-FIXES: (fn)(0); // 2
- // FIXME: Remove unnecessary parentheses.
-}
-
-void f1(int);
-void f2(double);
-void f3(char);
-
-void instantiate() {
- invoke(f1);
- invoke(f2);
- invoke(f3);
- invoke([](unsigned) {});
-}
-
-void negative() {
- void (*q)(int) = &f;
-
- q(1);
- (*q)(2);
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-member-init.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-member-init.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-member-init.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-member-init.cpp (removed)
@@ -1,219 +0,0 @@
-// RUN: %check_clang_tidy %s readability-redundant-member-init %t
-
-struct S {
- S() = default;
- S(int i) : i(i) {}
- int i = 1;
-};
-
-struct T {
- T(int i = 1) : i(i) {}
- int i;
-};
-
-struct U {
- int i;
-};
-
-union V {
- int i;
- double f;
-};
-
-// Initializer calls default constructor
-struct F1 {
- F1() : f() {}
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant
- // CHECK-FIXES: F1() {}
- S f;
-};
-
-// Initializer calls default constructor with default argument
-struct F2 {
- F2() : f() {}
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant
- // CHECK-FIXES: F2() {}
- T f;
-};
-
-// Multiple redundant initializers for same constructor
-struct F3 {
- F3() : f(), g(1), h() {}
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant
- // CHECK-MESSAGES: :[[@LINE-2]]:21: warning: initializer for member 'h' is redundant
- // CHECK-FIXES: F3() : g(1) {}
- S f, g, h;
-};
-
-// Templated class independent type
-template <class V>
-struct F4 {
- F4() : f() {}
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'f' is redundant
- // CHECK-FIXES: F4() {}
- S f;
-};
-F4<int> f4i;
-F4<S> f4s;
-
-// Base class
-struct F5 : S {
- F5() : S() {}
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for base class 'S' is redundant
- // CHECK-FIXES: F5() {}
-};
-
-// Constructor call requires cleanup
-struct Cleanup {
- ~Cleanup() {}
-};
-
-struct UsesCleanup {
- UsesCleanup(const Cleanup &c = Cleanup()) {}
-};
-
-struct F6 {
- F6() : uc() {}
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 'uc' is redundant
- // CHECK-FIXES: F6() {}
- UsesCleanup uc;
-};
-
-// Multiple inheritance
-struct F7 : S, T {
- F7() : S(), T() {}
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for base class 'S' is redundant
- // CHECK-MESSAGES: :[[@LINE-2]]:15: warning: initializer for base class 'T' is redundant
- // CHECK-FIXES: F7() {}
-};
-
-namespace Foo {
-inline namespace Bar {
-template <int N>
-struct Template {
- Template() = default;
- int i = N;
-};
-}
-}
-
-enum { N_THINGS = 5 };
-
-struct F8 : Foo::Template<N_THINGS> {
- F8() : Template() {}
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for base class 'Foo::Template<N_THINGS>' is redundant
- // CHECK-FIXES: F8() {}
-};
-
-// Anonymous struct
-struct F9 {
- F9() : s1() {}
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 's1' is redundant
- // CHECK-FIXES: F9() {}
- struct {
- S s1;
- S s2;
- };
-};
-
-// Initializer not written
-struct NF1 {
- NF1() {}
- S f;
-};
-
-// Initializer doesn't call default constructor
-struct NF2 {
- NF2() : f(1) {}
- S f;
-};
-
-// Initializer calls default constructor without using default argument
-struct NF3 {
- NF3() : f(1) {}
- T f;
-};
-
-// Initializer calls default constructor without using default argument
-struct NF4 {
- NF4() : f(2) {}
- T f;
-};
-
-// Initializer is zero-initialization
-struct NF5 {
- NF5() : i() {}
- int i;
-};
-
-// Initializer is direct-initialization
-struct NF6 {
- NF6() : i(1) {}
- int i;
-};
-
-// Initializer is aggregate initialization of struct
-struct NF7 {
- NF7() : f{} {}
- U f;
-};
-
-// Initializer is zero-initialization of struct
-struct NF7b {
- NF7b() : f() {}
- U f;
-};
-
-// Initializer is aggregate initialization of array
-struct NF8 {
- NF8() : f{} {}
- int f[2];
-};
-
-struct NF9 {
- NF9() : f{} {}
- S f[2];
-};
-
-// Initializing member of union
-union NF10 {
- NF10() : s() {}
- int i;
- S s;
-};
-
-// Templated class dependent type
-template <class V>
-struct NF11 {
- NF11() : f() {}
- V f;
-};
-NF11<int> nf11i;
-NF11<S> nf11s;
-
-// Delegating constructor
-class NF12 {
- NF12() = default;
- NF12(int) : NF12() {}
-};
-
-// Const member
-struct NF13 {
- NF13() : f() {}
- const S f;
-};
-
-// Union member
-struct NF14 {
- NF14() : f() {}
- V f;
-};
-
-// Anonymous union member
-struct NF15 {
- NF15() : s1() {}
- union {
- S s1;
- S s2;
- };
-};
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-preprocessor-ifdef.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-preprocessor-ifdef.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-preprocessor-ifdef.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-preprocessor-ifdef.cpp (removed)
@@ -1,36 +0,0 @@
-// RUN: %check_clang_tidy %s readability-redundant-preprocessor %t -- -- -DFOO
-
-// Positive testing.
-#ifdef FOO
-// CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant #ifdef; consider removing it [readability-redundant-preprocessor]
-#ifdef FOO
-// CHECK-NOTES: [[@LINE-3]]:2: note: previous #ifdef was here
-void f();
-#endif
-#endif
-
-// Positive testing of inverted condition.
-#ifdef FOO
-// CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant #ifndef; consider removing it [readability-redundant-preprocessor]
-#ifndef FOO
-// CHECK-NOTES: [[@LINE-3]]:2: note: previous #ifdef was here
-void f2();
-#endif
-#endif
-
-// Negative testing.
-#ifdef BAR
-void g();
-#endif
-
-#ifdef FOO
-#ifdef BAR
-void h();
-#endif
-#endif
-
-#ifdef FOO
-#ifndef BAR
-void i();
-#endif
-#endif
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-preprocessor.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-preprocessor.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-preprocessor.cpp (removed)
@@ -1,84 +0,0 @@
-// RUN: %check_clang_tidy %s readability-redundant-preprocessor %t -- -- -I %S
-
-// Positive testing.
-#ifndef FOO
-// CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant #ifndef; consider removing it [readability-redundant-preprocessor]
-#ifndef FOO
-// CHECK-NOTES: [[@LINE-3]]:2: note: previous #ifndef was here
-void f();
-#endif
-#endif
-
-// Positive testing of inverted condition.
-#ifndef FOO
-// CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant #ifdef; consider removing it [readability-redundant-preprocessor]
-#ifdef FOO
-// CHECK-NOTES: [[@LINE-3]]:2: note: previous #ifndef was here
-void f2();
-#endif
-#endif
-
-// Negative testing.
-#include "readability-redundant-preprocessor.h"
-
-#ifndef BAR
-void g();
-#endif
-
-#ifndef FOO
-#ifndef BAR
-void h();
-#endif
-#endif
-
-#ifndef FOO
-#ifdef BAR
-void i();
-#endif
-#endif
-
-// Positive #if testing.
-#define FOO 4
-
-#if FOO == 4
-// CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant #if; consider removing it [readability-redundant-preprocessor]
-#if FOO == 4
-// CHECK-NOTES: [[@LINE-3]]:2: note: previous #if was here
-void j();
-#endif
-#endif
-
-#if FOO == 3 + 1
-// CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant #if; consider removing it [readability-redundant-preprocessor]
-#if FOO == 3 + 1
-// CHECK-NOTES: [[@LINE-3]]:2: note: previous #if was here
-void j();
-#endif
-#endif
-
-#if FOO == \
- 4
-// CHECK-NOTES: [[@LINE+1]]:2: warning: nested redundant #if; consider removing it [readability-redundant-preprocessor]
-#if FOO == \
- 4
-// CHECK-NOTES: [[@LINE-5]]:2: note: previous #if was here
-void j();
-#endif
-#endif
-
-// Negative #if testing.
-#define BAR 4
-
-#if FOO == 4
-#if BAR == 4
-void k();
-#endif
-#endif
-
-#if FOO == \
- 4
-#if BAR == \
- 5
-void k();
-#endif
-#endif
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-preprocessor.h?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-preprocessor.h (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-preprocessor.h (removed)
@@ -1,5 +0,0 @@
-#ifndef FOO
-#ifndef FOO // this would warn, but not in a header
-void f();
-#endif
-#endif
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get-macros.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get-macros.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get-macros.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get-macros.cpp (removed)
@@ -1,23 +0,0 @@
-// RUN: %check_clang_tidy %s readability-redundant-smartptr-get %t -- \
-// RUN: -config="{CheckOptions: [{key: readability-redundant-smartptr-get.IgnoreMacros, value: 0}]}"
-
-namespace std {
-
-template <typename T>
-struct shared_ptr {
- T &operator*() const;
- T *operator->() const;
- T *get() const;
- explicit operator bool() const noexcept;
-};
-
-} // namespace std
-
-#define MACRO(p) p.get()
-
-void Positive() {
- std::shared_ptr<int> x;
- if (MACRO(x) == nullptr)
- ;
- // CHECK-MESSAGES: :[[@LINE-2]]:13: warning: redundant get() call on smart pointer
-};
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get-msvc.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get-msvc.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get-msvc.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get-msvc.cpp (removed)
@@ -1,94 +0,0 @@
-// RUN: %check_clang_tidy %s readability-redundant-smartptr-get %t
-
-#define NULL __null
-
-namespace std {
-
-// MSVC headers define operator templates instead of plain operators.
-
-template <typename T>
-struct unique_ptr {
- template <typename T2 = T>
- T2& operator*() const;
- template <typename T2 = T>
- T2* operator->() const;
- T* get() const;
- explicit operator bool() const noexcept;
-};
-
-template <typename T>
-struct shared_ptr {
- template <typename T2 = T>
- T2& operator*() const;
- template <typename T2 = T>
- T2* operator->() const;
- T* get() const;
- explicit operator bool() const noexcept;
-};
-
-} // namespace std
-
-struct Bar {
- void Do();
- void ConstDo() const;
-};
-
-void Positive() {
- std::unique_ptr<Bar>* up;
- (*up->get()).Do();
- // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: redundant get() call
- // CHECK-MESSAGES: (*up->get()).Do();
- // CHECK-FIXES: (**up).Do();
-
- std::unique_ptr<int> uu;
- std::shared_ptr<double> *ss;
- bool bb = uu.get() == nullptr;
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant get() call
- // CHECK-MESSAGES: uu.get() == nullptr;
- // CHECK-FIXES: bool bb = uu == nullptr;
-
- if (up->get());
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant get() call
- // CHECK-MESSAGES: if (up->get());
- // CHECK-FIXES: if (*up);
- if ((uu.get()));
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
- // CHECK-MESSAGES: if ((uu.get()));
- // CHECK-FIXES: if ((uu));
- bb = !ss->get();
- // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: redundant get() call
- // CHECK-MESSAGES: bb = !ss->get();
- // CHECK-FIXES: bb = !*ss;
-
- bb = nullptr != ss->get();
- // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: redundant get() call
- // CHECK-MESSAGES: nullptr != ss->get();
- // CHECK-FIXES: bb = nullptr != *ss;
-
- bb = std::unique_ptr<int>().get() == NULL;
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
- // CHECK-MESSAGES: bb = std::unique_ptr<int>().get() == NULL;
- // CHECK-FIXES: bb = std::unique_ptr<int>() == NULL;
- bb = ss->get() == NULL;
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
- // CHECK-MESSAGES: bb = ss->get() == NULL;
- // CHECK-FIXES: bb = *ss == NULL;
-
- std::unique_ptr<int> x, y;
- if (x.get() == nullptr);
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant get() call
- // CHECK-MESSAGES: if (x.get() == nullptr);
- // CHECK-FIXES: if (x == nullptr);
- if (nullptr == y.get());
- // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: redundant get() call
- // CHECK-MESSAGES: if (nullptr == y.get());
- // CHECK-FIXES: if (nullptr == y);
- if (x.get() == NULL);
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant get() call
- // CHECK-MESSAGES: if (x.get() == NULL);
- // CHECK-FIXES: if (x == NULL);
- if (NULL == x.get());
- // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: redundant get() call
- // CHECK-MESSAGES: if (NULL == x.get());
- // CHECK-FIXES: if (NULL == x);
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-smartptr-get.cpp (removed)
@@ -1,201 +0,0 @@
-// RUN: %check_clang_tidy %s readability-redundant-smartptr-get %t
-
-#define NULL __null
-
-namespace std {
-
-template <typename T>
-struct unique_ptr {
- T& operator*() const;
- T* operator->() const;
- T* get() const;
- explicit operator bool() const noexcept;
-};
-
-template <typename T>
-struct shared_ptr {
- T& operator*() const;
- T* operator->() const;
- T* get() const;
- explicit operator bool() const noexcept;
-};
-
-} // namespace std
-
-struct Bar {
- void Do();
- void ConstDo() const;
-};
-struct BarPtr {
- Bar* operator->();
- Bar& operator*();
- Bar* get();
- explicit operator bool() const;
-};
-struct int_ptr {
- int* get();
- int* operator->();
- int& operator*();
-};
-
-struct Fail1 {
- Bar* get();
-};
-struct Fail2 {
- Bar* get();
- int* operator->();
- int& operator*();
-};
-
-struct PointerWithOverloadedGet {
- int* get();
- template <typename T>
- T* get();
- int* operator->();
- int& operator*();
-};
-
-void Positive() {
- BarPtr u;
- // CHECK-FIXES: BarPtr u;
- BarPtr().get()->Do();
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: redundant get() call on smart pointer [readability-redundant-smartptr-get]
- // CHECK-MESSAGES: BarPtr().get()->Do();
- // CHECK-FIXES: BarPtr()->Do();
-
- u.get()->ConstDo();
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: redundant get() call
- // CHECK-MESSAGES: u.get()->ConstDo();
- // CHECK-FIXES: u->ConstDo();
-
- Bar& b = *BarPtr().get();
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant get() call
- // CHECK-MESSAGES: Bar& b = *BarPtr().get();
- // CHECK-FIXES: Bar& b = *BarPtr();
-
- Bar& b2 = *std::unique_ptr<Bar>().get();
- // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: redundant get() call
- // CHECK-MESSAGES: Bar& b2 = *std::unique_ptr<Bar>().get();
- // CHECK-FIXES: Bar& b2 = *std::unique_ptr<Bar>();
-
- (*BarPtr().get()).ConstDo();
- // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: redundant get() call
- // CHECK-MESSAGES: (*BarPtr().get()).ConstDo();
- // CHECK-FIXES: (*BarPtr()).ConstDo();
-
- (*std::unique_ptr<Bar>().get()).ConstDo();
- // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: redundant get() call
- // CHECK-MESSAGES: (*std::unique_ptr<Bar>().get()).ConstDo();
- // CHECK-FIXES: (*std::unique_ptr<Bar>()).ConstDo();
-
- std::unique_ptr<Bar>* up;
- (*up->get()).Do();
- // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: redundant get() call
- // CHECK-MESSAGES: (*up->get()).Do();
- // CHECK-FIXES: (**up).Do();
-
- int_ptr ip;
- int i = *ip.get();
- // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant get() call
- // CHECK-MESSAGES: int i = *ip.get();
- // CHECK-FIXES: int i = *ip;
-
- auto ip2 = ip;
- i = *ip2.get();
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
- // CHECK-MESSAGES: i = *ip2.get();
- // CHECK-FIXES: i = *ip2;
-
- std::unique_ptr<int> uu;
- std::shared_ptr<double> *ss;
- bool bb = uu.get() == nullptr;
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant get() call
- // CHECK-MESSAGES: uu.get() == nullptr;
- // CHECK-FIXES: bool bb = uu == nullptr;
-
- if (up->get());
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant get() call
- // CHECK-MESSAGES: if (up->get());
- // CHECK-FIXES: if (*up);
- if ((uu.get()));
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
- // CHECK-MESSAGES: if ((uu.get()));
- // CHECK-FIXES: if ((uu));
- bb = !ss->get();
- // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: redundant get() call
- // CHECK-MESSAGES: bb = !ss->get();
- // CHECK-FIXES: bb = !*ss;
- bb = u.get() ? true : false;
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
- // CHECK-MESSAGES: bb = u.get() ? true : false;
- // CHECK-FIXES: bb = u ? true : false;
-
- bb = nullptr != ss->get();
- // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: redundant get() call
- // CHECK-MESSAGES: nullptr != ss->get();
- // CHECK-FIXES: bb = nullptr != *ss;
-
- i = *PointerWithOverloadedGet().get();
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
- // CHECK-MESSAGES: i = *PointerWithOverloadedGet().get();
- // CHECK-FIXES: i = *PointerWithOverloadedGet();
-
- bb = std::unique_ptr<int>().get() == NULL;
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
- // CHECK-MESSAGES: bb = std::unique_ptr<int>().get() == NULL;
- // CHECK-FIXES: bb = std::unique_ptr<int>() == NULL;
- bb = ss->get() == NULL;
- // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
- // CHECK-MESSAGES: bb = ss->get() == NULL;
- // CHECK-FIXES: bb = *ss == NULL;
-
- std::unique_ptr<int> x, y;
- if (x.get() == nullptr);
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant get() call
- // CHECK-MESSAGES: if (x.get() == nullptr);
- // CHECK-FIXES: if (x == nullptr);
- if (nullptr == y.get());
- // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: redundant get() call
- // CHECK-MESSAGES: if (nullptr == y.get());
- // CHECK-FIXES: if (nullptr == y);
- if (x.get() == NULL);
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant get() call
- // CHECK-MESSAGES: if (x.get() == NULL);
- // CHECK-FIXES: if (x == NULL);
- if (NULL == x.get());
- // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: redundant get() call
- // CHECK-MESSAGES: if (NULL == x.get());
- // CHECK-FIXES: if (NULL == x);
-}
-
-#define MACRO(p) p.get()
-
-void Negative() {
- struct NegPtr {
- int* get();
- int* operator->() {
- return &*this->get();
- }
- int& operator*() {
- return *get();
- }
- };
-
- long l = *PointerWithOverloadedGet().get<long>();
-
- std::unique_ptr<Bar>* u;
- u->get()->Do();
-
- Fail1().get()->Do();
- Fail2().get()->Do();
- const Bar& b = *Fail1().get();
- (*Fail2().get()).Do();
-
- int_ptr ip;
- bool bb = ip.get() == nullptr;
- bb = !ip.get();
- bb = ip.get() ? true : false;
- std::unique_ptr<int> x;
- if (MACRO(x) == nullptr)
- ;
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-cstr-msvc.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-cstr-msvc.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-cstr-msvc.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-cstr-msvc.cpp (removed)
@@ -1,47 +0,0 @@
-// RUN: %check_clang_tidy %s readability-redundant-string-cstr %t
-
-namespace std {
-template <typename T>
-class allocator {};
-template <typename T>
-class char_traits {};
-template <typename C, typename T, typename A>
-struct basic_string {
- basic_string();
- // MSVC headers define two constructors instead of using optional arguments.
- basic_string(const C *p);
- basic_string(const C *p, const A &a);
- const C *c_str() const;
- const C *data() const;
-};
-typedef basic_string<char, std::char_traits<char>, std::allocator<char>> string;
-}
-namespace llvm {
-struct StringRef {
- StringRef(const char *p);
- StringRef(const std::string &);
-};
-}
-
-void f1(const std::string &s) {
- f1(s.c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call to 'c_str' [readability-redundant-string-cstr]
- // CHECK-FIXES: {{^ }}f1(s);{{$}}
- f1(s.data());
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call to 'data' [readability-redundant-string-cstr]
- // CHECK-FIXES: {{^ }}f1(s);{{$}}
-}
-void f2(const llvm::StringRef r) {
- std::string s;
- f2(s.c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}std::string s;{{$}}
- // CHECK-FIXES-NEXT: {{^ }}f2(s);{{$}}
-}
-void f3(const llvm::StringRef &r) {
- std::string s;
- f3(s.c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}std::string s;{{$}}
- // CHECK-FIXES-NEXT: {{^ }}f3(s);{{$}}
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-cstr.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-cstr.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-cstr.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-cstr.cpp (removed)
@@ -1,207 +0,0 @@
-// RUN: %check_clang_tidy %s readability-redundant-string-cstr %t
-
-typedef unsigned __INT16_TYPE__ char16;
-typedef unsigned __INT32_TYPE__ char32;
-typedef __SIZE_TYPE__ size;
-
-namespace std {
-template <typename T>
-class allocator {};
-template <typename T>
-class char_traits {};
-template <typename C, typename T, typename A>
-struct basic_string {
- typedef basic_string<C, T, A> _Type;
- basic_string();
- basic_string(const C *p, const A &a = A());
-
- const C *c_str() const;
- const C *data() const;
-
- _Type& append(const C *s);
- _Type& append(const C *s, size n);
- _Type& assign(const C *s);
- _Type& assign(const C *s, size n);
-
- int compare(const _Type&) const;
- int compare(const C* s) const;
- int compare(size pos, size len, const _Type&) const;
- int compare(size pos, size len, const C* s) const;
-
- size find(const _Type& str, size pos = 0) const;
- size find(const C* s, size pos = 0) const;
- size find(const C* s, size pos, size n) const;
-
- _Type& insert(size pos, const _Type& str);
- _Type& insert(size pos, const C* s);
- _Type& insert(size pos, const C* s, size n);
-
- _Type& operator+=(const _Type& str);
- _Type& operator+=(const C* s);
- _Type& operator=(const _Type& str);
- _Type& operator=(const C* s);
-};
-
-typedef basic_string<char, std::char_traits<char>, std::allocator<char>> string;
-typedef basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>> wstring;
-typedef basic_string<char16, std::char_traits<char16>, std::allocator<char16>> u16string;
-typedef basic_string<char32, std::char_traits<char32>, std::allocator<char32>> u32string;
-}
-
-std::string operator+(const std::string&, const std::string&);
-std::string operator+(const std::string&, const char*);
-std::string operator+(const char*, const std::string&);
-
-bool operator==(const std::string&, const std::string&);
-bool operator==(const std::string&, const char*);
-bool operator==(const char*, const std::string&);
-
-namespace llvm {
-struct StringRef {
- StringRef(const char *p);
- StringRef(const std::string &);
-};
-}
-
-// Tests for std::string.
-
-void f1(const std::string &s) {
- f1(s.c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call to 'c_str' [readability-redundant-string-cstr]
- // CHECK-FIXES: {{^ }}f1(s);{{$}}
- f1(s.data());
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call to 'data' [readability-redundant-string-cstr]
- // CHECK-FIXES: {{^ }}f1(s);{{$}}
-}
-void f2(const llvm::StringRef r) {
- std::string s;
- f2(s.c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}std::string s;{{$}}
- // CHECK-FIXES-NEXT: {{^ }}f2(s);{{$}}
-}
-void f3(const llvm::StringRef &r) {
- std::string s;
- f3(s.c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}std::string s;{{$}}
- // CHECK-FIXES-NEXT: {{^ }}f3(s);{{$}}
-}
-void f4(const std::string &s) {
- const std::string* ptr = &s;
- f1(ptr->c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call to 'c_str' [readability-redundant-string-cstr]
- // CHECK-FIXES: {{^ }}f1(*ptr);{{$}}
-}
-void f5(const std::string &s) {
- std::string tmp;
- tmp.append(s.c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}tmp.append(s);{{$}}
- tmp.assign(s.c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}tmp.assign(s);{{$}}
-
- if (tmp.compare(s.c_str()) == 0) return;
- // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}if (tmp.compare(s) == 0) return;{{$}}
-
- if (tmp.compare(1, 2, s.c_str()) == 0) return;
- // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}if (tmp.compare(1, 2, s) == 0) return;{{$}}
-
- if (tmp.find(s.c_str()) == 0) return;
- // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}if (tmp.find(s) == 0) return;{{$}}
-
- if (tmp.find(s.c_str(), 2) == 0) return;
- // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}if (tmp.find(s, 2) == 0) return;{{$}}
-
- if (tmp.find(s.c_str(), 2) == 0) return;
- // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}if (tmp.find(s, 2) == 0) return;{{$}}
-
- tmp.insert(1, s.c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}tmp.insert(1, s);{{$}}
-
- tmp = s.c_str();
- // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}tmp = s;{{$}}
-
- tmp += s.c_str();
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}tmp += s;{{$}}
-
- if (tmp == s.c_str()) return;
- // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}if (tmp == s) return;{{$}}
-
- tmp = s + s.c_str();
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}tmp = s + s;{{$}}
-
- tmp = s.c_str() + s;
- // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: redundant call {{.*}}
- // CHECK-FIXES: {{^ }}tmp = s + s;{{$}}
-}
-void f6(const std::string &s) {
- std::string tmp;
- tmp.append(s.c_str(), 2);
- tmp.assign(s.c_str(), 2);
-
- if (tmp.compare(s) == 0) return;
- if (tmp.compare(1, 2, s) == 0) return;
-
- tmp = s;
- tmp += s;
-
- if (tmp == s)
- return;
-
- tmp = s + s;
-
- if (tmp.find(s.c_str(), 2, 4) == 0) return;
-
- tmp.insert(1, s);
- tmp.insert(1, s.c_str(), 2);
-}
-
-// Tests for std::wstring.
-
-void g1(const std::wstring &s) {
- g1(s.c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call to 'c_str' [readability-redundant-string-cstr]
- // CHECK-FIXES: {{^ }}g1(s);{{$}}
-}
-
-// Tests for std::u16string.
-
-void h1(const std::u16string &s) {
- h1(s.c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call to 'c_str' [readability-redundant-string-cstr]
- // CHECK-FIXES: {{^ }}h1(s);{{$}}
-}
-
-// Tests for std::u32string.
-
-void k1(const std::u32string &s) {
- k1(s.c_str());
- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: redundant call to 'c_str' [readability-redundant-string-cstr]
- // CHECK-FIXES: {{^ }}k1(s);{{$}}
-}
-
-// Tests on similar classes that aren't good candidates for this checker.
-
-struct NotAString {
- NotAString();
- NotAString(const NotAString&);
- const char *c_str() const;
-};
-
-void dummy(const char*) {}
-
-void invalid(const NotAString &s) {
- dummy(s.c_str());
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-init-msvc.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-init-msvc.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-init-msvc.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-init-msvc.cpp (removed)
@@ -1,62 +0,0 @@
-// RUN: %check_clang_tidy -std=c++11,c++14 %s readability-redundant-string-init %t
-// FIXME: Fix the checker to work in C++17 mode.
-
-namespace std {
-template <typename T>
-class allocator {};
-template <typename T>
-class char_traits {};
-template <typename C, typename T = std::char_traits<C>, typename A = std::allocator<C>>
-struct basic_string {
- basic_string();
- basic_string(const basic_string&);
- // MSVC headers define two constructors instead of using optional arguments.
- basic_string(const C *);
- basic_string(const C *, const A &);
- ~basic_string();
-};
-typedef basic_string<char> string;
-typedef basic_string<wchar_t> wstring;
-}
-
-void f() {
- std::string a = "";
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization [readability-redundant-string-init]
- // CHECK-FIXES: std::string a;
- std::string b("");
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization
- // CHECK-FIXES: std::string b;
- std::string c = R"()";
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization
- // CHECK-FIXES: std::string c;
- std::string d(R"()");
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization
- // CHECK-FIXES: std::string d;
-
- std::string u = "u";
- std::string w("w");
- std::string x = R"(x)";
- std::string y(R"(y)");
- std::string z;
-}
-
-void g() {
- std::wstring a = L"";
- // CHECK-MESSAGES: [[@LINE-1]]:16: warning: redundant string initialization
- // CHECK-FIXES: std::wstring a;
- std::wstring b(L"");
- // CHECK-MESSAGES: [[@LINE-1]]:16: warning: redundant string initialization
- // CHECK-FIXES: std::wstring b;
- std::wstring c = LR"()";
- // CHECK-MESSAGES: [[@LINE-1]]:16: warning: redundant string initialization
- // CHECK-FIXES: std::wstring c;
- std::wstring d(LR"()");
- // CHECK-MESSAGES: [[@LINE-1]]:16: warning: redundant string initialization
- // CHECK-FIXES: std::wstring d;
-
- std::wstring u = L"u";
- std::wstring w(L"w");
- std::wstring x = LR"(x)";
- std::wstring y(LR"(y)");
- std::wstring z;
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-init.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-init.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-init.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-string-init.cpp (removed)
@@ -1,141 +0,0 @@
-// RUN: %check_clang_tidy -std=c++11,c++14 %s readability-redundant-string-init %t
-// FIXME: Fix the checker to work in C++17 mode.
-
-namespace std {
-template <typename T>
-class allocator {};
-template <typename T>
-class char_traits {};
-template <typename C, typename T = std::char_traits<C>, typename A = std::allocator<C>>
-struct basic_string {
- basic_string();
- basic_string(const basic_string&);
- basic_string(const C *, const A &a = A());
- ~basic_string();
-};
-typedef basic_string<char> string;
-typedef basic_string<wchar_t> wstring;
-}
-
-void f() {
- std::string a = "";
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization [readability-redundant-string-init]
- // CHECK-FIXES: std::string a;
- std::string b("");
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization
- // CHECK-FIXES: std::string b;
- std::string c = R"()";
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization
- // CHECK-FIXES: std::string c;
- std::string d(R"()");
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization
- // CHECK-FIXES: std::string d;
-
- std::string u = "u";
- std::string w("w");
- std::string x = R"(x)";
- std::string y(R"(y)");
- std::string z;
-}
-
-void g() {
- std::wstring a = L"";
- // CHECK-MESSAGES: [[@LINE-1]]:16: warning: redundant string initialization
- // CHECK-FIXES: std::wstring a;
- std::wstring b(L"");
- // CHECK-MESSAGES: [[@LINE-1]]:16: warning: redundant string initialization
- // CHECK-FIXES: std::wstring b;
- std::wstring c = LR"()";
- // CHECK-MESSAGES: [[@LINE-1]]:16: warning: redundant string initialization
- // CHECK-FIXES: std::wstring c;
- std::wstring d(LR"()");
- // CHECK-MESSAGES: [[@LINE-1]]:16: warning: redundant string initialization
- // CHECK-FIXES: std::wstring d;
-
- std::wstring u = L"u";
- std::wstring w(L"w");
- std::wstring x = LR"(x)";
- std::wstring y(LR"(y)");
- std::wstring z;
-}
-
-template <typename T>
-void templ() {
- std::string s = "";
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization
- // CHECK-FIXES: std::string s;
-}
-
-#define M(x) x
-#define N { std::string s = ""; }
-// CHECK-FIXES: #define N { std::string s = ""; }
-
-void h() {
- templ<int>();
- templ<double>();
-
- M({ std::string s = ""; })
- // CHECK-MESSAGES: [[@LINE-1]]:19: warning: redundant string initialization
- // CHECK-FIXES: M({ std::string s; })
-
- N
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: redundant string initialization
- // CHECK-FIXES: N
- N
- // CHECK-MESSAGES: [[@LINE-1]]:3: warning: redundant string initialization
- // CHECK-FIXES: N
-}
-
-typedef std::string MyString;
-#define STRING MyString
-#define DECL_STRING(name, val) STRING name = val
-
-void i() {
- MyString a = "";
- // CHECK-MESSAGES: [[@LINE-1]]:12: warning: redundant string initialization
- // CHECK-FIXES: MyString a;
- STRING b = "";
- // CHECK-MESSAGES: [[@LINE-1]]:10: warning: redundant string initialization
- // CHECK-FIXES: STRING b;
- MyString c = "" "" "";
- // CHECK-MESSAGES: [[@LINE-1]]:12: warning: redundant string initialization
- // CHECK-FIXES: MyString c;
- STRING d = "" "" "";
- // CHECK-MESSAGES: [[@LINE-1]]:10: warning: redundant string initialization
- // CHECK-FIXES: STRING d;
- DECL_STRING(e, "");
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization
-
- MyString f = "u";
- STRING g = "u";
- DECL_STRING(h, "u");
-}
-
-#define EMPTY_STR ""
-void j() {
- std::string a(EMPTY_STR);
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization
- // CHECK-FIXES: std::string a;
- std::string b = (EMPTY_STR);
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization
- // CHECK-FIXES: std::string b;
-
- std::string c(EMPTY_STR "u" EMPTY_STR);
-}
-
-void k() {
- std::string a = "", b = "", c = "";
- // CHECK-MESSAGES: [[@LINE-1]]:15: warning: redundant string initialization
- // CHECK-MESSAGES: [[@LINE-2]]:23: warning: redundant string initialization
- // CHECK-MESSAGES: [[@LINE-3]]:31: warning: redundant string initialization
- // CHECK-FIXES: std::string a, b, c;
-
- std::string d = "u", e = "u", f = "u";
-}
-
-// These cases should not generate warnings.
-extern void Param1(std::string param = "");
-extern void Param2(const std::string& param = "");
-void Param3(std::string param = "") {}
-void Param4(STRING param = "") {}
-
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-chained-conditional-assignment.cpp (removed)
@@ -1,34 +0,0 @@
-// RUN: %check_clang_tidy %s readability-simplify-boolean-expr %t -- -config="{CheckOptions: [{key: "readability-simplify-boolean-expr.ChainedConditionalAssignment", value: 1}]}" --
-
-void chained_conditional_compound_assignment(int i) {
- bool b;
- if (i < 0) {
- b = true;
- } else if (i < 10) {
- b = false;
- } else if (i > 20) {
- b = true;
- } else {
- b = false;
- }
- // CHECK-MESSAGES: :[[@LINE-4]]:9: warning: redundant boolean literal in conditional assignment [readability-simplify-boolean-expr]
- // CHECK-FIXES: {{^}} } else if (i < 10) {{{$}}
- // CHECK-FIXES-NEXT: {{^}} b = false;{{$}}
- // CHECK-FIXES-NEXT: {{^}} } else b = i > 20;{{$}}
-}
-
-void chained_conditional_assignment(int i) {
- bool b;
- if (i < 0)
- b = true;
- else if (i < 10)
- b = false;
- else if (i > 20)
- b = true;
- else
- b = false;
- // CHECK-MESSAGES: :[[@LINE-3]]:9: warning: {{.*}} in conditional assignment
- // CHECK-FIXES: {{^}} else if (i < 10)
- // CHECK-FIXES-NEXT: {{^}} b = false;
- // CHECK-FIXES-NEXT: {{^}} else b = i > 20;
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-chained-conditional-return.cpp (removed)
@@ -1,94 +0,0 @@
-// RUN: %check_clang_tidy %s readability-simplify-boolean-expr %t -- -config="{CheckOptions: [{key: "readability-simplify-boolean-expr.ChainedConditionalReturn", value: 1}]}" --
-
-bool chained_conditional_compound_return(int i) {
- if (i < 0) {
- return true;
- } else if (i < 10) {
- return false;
- } else if (i > 20) {
- return true;
- } else {
- return false;
- }
- // CHECK-MESSAGES: :[[@LINE-4]]:12: warning: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
- // CHECK-FIXES: {{^}} } else if (i < 10) {{{$}}
- // CHECK-FIXES-NEXT: {{^}} return false;{{$}}
- // CHECK-FIXES-NEXT: {{^}} } else return i > 20;{{$}}
-}
-
-bool chained_conditional_return(int i) {
- if (i < 0)
- return true;
- else if (i < 10)
- return false;
- else if (i > 20)
- return true;
- else
- return false;
- // CHECK-MESSAGES: :[[@LINE-3]]:12: warning: {{.*}} in conditional return statement
- // CHECK-FIXES: {{^}} else if (i < 10)
- // CHECK-FIXES-NEXT: {{^}} return false;
- // CHECK-FIXES-NEXT: {{^}} else return i > 20;
-}
-
-bool chained_simple_if_return(int i) {
- if (i < 5)
- return true;
- if (i > 10)
- return true;
- return false;
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}}bool chained_simple_if_return(int i) {{{$}}
-// CHECK-FIXES: {{^}} if (i < 5){{$}}
-// CHECK-FIXES: {{^ return true;$}}
-// CHECK-FIXES: {{^ return i > 10;$}}
-// CHECK-FIXES: {{^}$}}
-
-bool chained_simple_if_return_negated(int i) {
- if (i < 5)
- return false;
- if (i > 10)
- return false;
- return true;
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}}bool chained_simple_if_return_negated(int i) {{{$}}
-// CHECK-FIXES: {{^}} if (i < 5){{$}}
-// CHECK-FIXES: {{^ return false;$}}
-// CHECK-FIXES: {{^ return i <= 10;$}}
-// CHECK-FIXES: {{^}$}}
-
-bool complex_chained_if_return_return(int i) {
- if (i < 5) {
- return true;
- }
- if (i > 10) {
- return true;
- }
- return false;
-}
-// CHECK-MESSAGES: :[[@LINE-4]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}}bool complex_chained_if_return_return(int i) {{{$}}
-// CHECK-FIXES: {{^}} if (i < 5) {{{$}}
-// CHECK-FIXES: {{^}} return true;{{$}}
-// CHECK-FIXES: {{^}} }{{$}}
-// CHECK-FIXES: {{^ return i > 10;$}}
-// CHECK-FIXES: {{^}$}}
-
-bool complex_chained_if_return_return_negated(int i) {
- if (i < 5) {
- return false;
- }
- if (i > 10) {
- return false;
- }
- return true;
-}
-// CHECK-MESSAGES: :[[@LINE-4]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}}bool complex_chained_if_return_return_negated(int i) {{{$}}
-// CHECK-FIXES: {{^}} if (i < 5) {{{$}}
-// CHECK-FIXES: {{^}} return false;{{$}}
-// CHECK-FIXES: {{^}} }{{$}}
-// CHECK-FIXES: {{^ return i <= 10;$}}
-// CHECK-FIXES: {{^}$}}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-members.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-members.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-members.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr-members.cpp (removed)
@@ -1,356 +0,0 @@
-// RUN: %check_clang_tidy %s readability-simplify-boolean-expr %t
-
-class A {
-public:
- int m;
-};
-
-struct S {
- S() : m_ar(s_a) {}
-
- void operator_equals();
- void operator_or();
- void operator_and();
- void ternary_operator();
- void operator_not_equal();
- void simple_conditional_assignment_statements();
- void complex_conditional_assignment_statements();
- void chained_conditional_assignment();
- bool non_null_pointer_condition();
- bool null_pointer_condition();
- bool negated_non_null_pointer_condition();
- bool negated_null_pointer_condition();
- bool integer_not_zero();
- bool member_pointer_nullptr();
- bool integer_member_implicit_cast();
- bool expr_with_cleanups();
-
- bool m_b1 = false;
- bool m_b2 = false;
- bool m_b3 = false;
- bool m_b4 = false;
- int *m_p = nullptr;
- int A::*m_m = nullptr;
- int m_i = 0;
- A *m_a = nullptr;
- static A s_a;
- A &m_ar;
-};
-
-void S::operator_equals() {
- int i = 0;
- m_b1 = (i > 2);
- if (m_b1 == true) {
- // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(m_b1\) {$}}
- i = 5;
- } else {
- i = 6;
- }
- m_b2 = (i > 4);
- if (m_b2 == false) {
- // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(!m_b2\) {$}}
- i = 7;
- } else {
- i = 9;
- }
- m_b3 = (i > 6);
- if (true == m_b3) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(m_b3\) {$}}
- i = 10;
- } else {
- i = 11;
- }
- m_b4 = (i > 8);
- if (false == m_b4) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(!m_b4\) {$}}
- i = 12;
- } else {
- i = 13;
- }
-}
-
-void S::operator_or() {
- int i = 0;
- m_b1 = (i > 10);
- if (m_b1 || false) {
- // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(m_b1\) {$}}
- i = 14;
- } else {
- i = 15;
- }
- m_b2 = (i > 10);
- if (m_b2 || true) {
- // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(true\) {$}}
- i = 16;
- } else {
- i = 17;
- }
- m_b3 = (i > 10);
- if (false || m_b3) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(m_b3\) {$}}
- i = 18;
- } else {
- i = 19;
- }
- m_b4 = (i > 10);
- if (true || m_b4) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(true\) {$}}
- i = 20;
- } else {
- i = 21;
- }
-}
-
-void S::operator_and() {
- int i = 0;
- m_b1 = (i > 20);
- if (m_b1 && false) {
- // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(false\) {$}}
- i = 22;
- } else {
- i = 23;
- }
- m_b2 = (i > 20);
- if (m_b2 && true) {
- // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(m_b2\) {$}}
- i = 24;
- } else {
- i = 25;
- }
- m_b3 = (i > 20);
- if (false && m_b3) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(false\) {$}}
- i = 26;
- } else {
- i = 27;
- }
- m_b4 = (i > 20);
- if (true && m_b4) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(m_b4\) {$}}
- i = 28;
- } else {
- i = 29;
- }
-}
-
-void S::ternary_operator() {
- int i = 0;
- m_b1 = (i > 20) ? true : false;
- // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: {{.*}} in ternary expression result
- // CHECK-FIXES: {{^ m_b1 = i > 20;$}}
-
- m_b2 = (i > 20) ? false : true;
- // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: {{.*}} in ternary expression result
- // CHECK-FIXES: {{^ m_b2 = i <= 20;$}}
-
- m_b3 = ((i > 20)) ? false : true;
- // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: {{.*}} in ternary expression result
- // CHECK-FIXES: {{^ m_b3 = i <= 20;$}}
-}
-
-void S::operator_not_equal() {
- int i = 0;
- m_b1 = (i > 20);
- if (false != m_b1) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(m_b1\) {$}}
- i = 30;
- } else {
- i = 31;
- }
- m_b2 = (i > 20);
- if (true != m_b2) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(!m_b2\) {$}}
- i = 32;
- } else {
- i = 33;
- }
- m_b3 = (i > 20);
- if (m_b3 != false) {
- // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(m_b3\) {$}}
- i = 34;
- } else {
- i = 35;
- }
- m_b4 = (i > 20);
- if (m_b4 != true) {
- // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(!m_b4\) {$}}
- i = 36;
- } else {
- i = 37;
- }
-}
-
-void S::simple_conditional_assignment_statements() {
- if (m_i > 10)
- m_b1 = true;
- else
- m_b1 = false;
- bool bb = false;
- // CHECK-MESSAGES: :[[@LINE-4]]:12: warning: {{.*}} in conditional assignment
- // CHECK-FIXES: {{^ }}m_b1 = m_i > 10;{{$}}
- // CHECK-FIXES: bool bb = false;
-
- if (m_i > 20)
- m_b2 = false;
- else
- m_b2 = true;
- bool c2 = false;
- // CHECK-MESSAGES: :[[@LINE-4]]:12: warning: {{.*}} in conditional assignment
- // CHECK-FIXES: {{^ }}m_b2 = m_i <= 20;{{$}}
- // CHECK-FIXES: bool c2 = false;
-
- // Unchanged: different variables.
- if (m_i > 12)
- m_b1 = true;
- else
- m_b2 = false;
-
- // Unchanged: no else statement.
- if (m_i > 15)
- m_b3 = true;
-
- // Unchanged: not boolean assignment.
- int j;
- if (m_i > 17)
- j = 10;
- else
- j = 20;
-
- // Unchanged: different variables assigned.
- int k = 0;
- m_b4 = false;
- if (m_i > 10)
- m_b4 = true;
- else
- k = 10;
-}
-
-void S::complex_conditional_assignment_statements() {
- if (m_i > 30) {
- m_b1 = true;
- } else {
- m_b1 = false;
- }
- m_b1 = false;
- // CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional assignment
- // CHECK-FIXES: {{^ }}m_b1 = m_i > 30;{{$}}
- // CHECK-FIXES: m_b1 = false;
-
- if (m_i > 40) {
- m_b2 = false;
- } else {
- m_b2 = true;
- }
- m_b2 = false;
- // CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional assignment
- // CHECK-FIXES: {{^ }}m_b2 = m_i <= 40;{{$}}
- // CHECK-FIXES: m_b2 = false;
-}
-
-// Unchanged: chained return statements, but ChainedConditionalReturn not set.
-void S::chained_conditional_assignment() {
- if (m_i < 0)
- m_b1 = true;
- else if (m_i < 10)
- m_b1 = false;
- else if (m_i > 20)
- m_b1 = true;
- else
- m_b1 = false;
-}
-
-bool S::non_null_pointer_condition() {
- if (m_p) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: return m_p != nullptr;{{$}}
-
-bool S::null_pointer_condition() {
- if (!m_p) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: return m_p == nullptr;{{$}}
-
-bool S::negated_non_null_pointer_condition() {
- if (m_p) {
- return false;
- } else {
- return true;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: return m_p == nullptr;{{$}}
-
-bool S::negated_null_pointer_condition() {
- if (!m_p) {
- return false;
- } else {
- return true;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: return m_p != nullptr;{{$}}
-
-bool S::integer_not_zero() {
- if (m_i) {
- return false;
- } else {
- return true;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} return m_i == 0;{{$}}
-
-bool S::member_pointer_nullptr() {
- if (m_m) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: return m_m != nullptr;{{$}}
-
-bool S::integer_member_implicit_cast() {
- if (m_a->m) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: return m_a->m != 0;{{$}}
-
-bool operator!=(const A &, const A &) { return false; }
-bool S::expr_with_cleanups() {
- if (m_ar != (A)m_ar)
- return false;
-
- return true;
-}
-// CHECK-MESSAGES: :[[@LINE-4]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: m_ar == (A)m_ar;{{$}}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-simplify-bool-expr.cpp (removed)
@@ -1,950 +0,0 @@
-// RUN: %check_clang_tidy %s readability-simplify-boolean-expr %t
-
-bool a1 = false;
-
-//=-=-=-=-=-=-= operator ==
-bool aa = false == a1;
-// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr]
-// CHECK-FIXES: {{^bool aa = !a1;$}}
-bool ab = true == a1;
-// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool ab = a1;$}}
-bool a2 = a1 == false;
-// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool a2 = !a1;$}}
-bool a3 = a1 == true;
-// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool a3 = a1;$}}
-
-//=-=-=-=-=-=-= operator !=
-bool n1 = a1 != false;
-// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool n1 = a1;$}}
-bool n2 = a1 != true;
-// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool n2 = !a1;$}}
-bool n3 = false != a1;
-// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool n3 = a1;$}}
-bool n4 = true != a1;
-// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool n4 = !a1;$}}
-
-//=-=-=-=-=-=-= operator ||
-bool a4 = a1 || false;
-// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool a4 = a1;$}}
-bool a5 = a1 || true;
-// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool a5 = true;$}}
-bool a6 = false || a1;
-// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool a6 = a1;$}}
-bool a7 = true || a1;
-// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool a7 = true;$}}
-
-//=-=-=-=-=-=-= operator &&
-bool a8 = a1 && false;
-// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool a8 = false;$}}
-bool a9 = a1 && true;
-// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool a9 = a1;$}}
-bool ac = false && a1;
-// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool ac = false;$}}
-bool ad = true && a1;
-// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}} to boolean operator
-// CHECK-FIXES: {{^bool ad = a1;$}}
-
-void if_with_bool_literal_condition() {
- int i = 0;
- if (false) {
- i = 1;
- } else {
- i = 2;
- }
- i = 3;
- // CHECK-MESSAGES: :[[@LINE-6]]:7: warning: {{.*}} in if statement condition
- // CHECK-FIXES: {{^ int i = 0;$}}
- // CHECK-FIXES-NEXT: {{^ {$}}
- // CHECK-FIXES-NEXT: {{^ i = 2;$}}
- // CHECK-FIXES-NEXT: {{^ }$}}
- // CHECK-FIXES-NEXT: {{^ i = 3;$}}
-
- i = 4;
- if (true) {
- i = 5;
- } else {
- i = 6;
- }
- i = 7;
- // CHECK-MESSAGES: :[[@LINE-6]]:7: warning: {{.*}} in if statement condition
- // CHECK-FIXES: {{^ i = 4;$}}
- // CHECK-FIXES-NEXT: {{^ {$}}
- // CHECK-FIXES-NEXT: {{^ i = 5;$}}
- // CHECK-FIXES-NEXT: {{^ }$}}
- // CHECK-FIXES-NEXT: {{^ i = 7;$}}
-
- i = 8;
- if (false) {
- i = 9;
- }
- i = 11;
- // CHECK-MESSAGES: :[[@LINE-4]]:7: warning: {{.*}} in if statement condition
- // CHECK-FIXES: {{^ i = 8;$}}
- // CHECK-FIXES-NEXT: {{^ $}}
- // CHECK-FIXES-NEXT: {{^ i = 11;$}}
-}
-
-void operator_equals() {
- int i = 0;
- bool b1 = (i > 2);
- if (b1 == true) {
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(b1\) {$}}
- i = 5;
- } else {
- i = 6;
- }
- bool b2 = (i > 4);
- if (b2 == false) {
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(!b2\) {$}}
- i = 7;
- } else {
- i = 9;
- }
- bool b3 = (i > 6);
- if (true == b3) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(b3\) {$}}
- i = 10;
- } else {
- i = 11;
- }
- bool b4 = (i > 8);
- if (false == b4) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(!b4\) {$}}
- i = 12;
- } else {
- i = 13;
- }
-}
-
-void operator_or() {
- int i = 0;
- bool b5 = (i > 10);
- if (b5 || false) {
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(b5\) {$}}
- i = 14;
- } else {
- i = 15;
- }
- bool b6 = (i > 10);
- if (b6 || true) {
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(true\) {$}}
- i = 16;
- } else {
- i = 17;
- }
- bool b7 = (i > 10);
- if (false || b7) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(b7\) {$}}
- i = 18;
- } else {
- i = 19;
- }
- bool b8 = (i > 10);
- if (true || b8) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(true\) {$}}
- i = 20;
- } else {
- i = 21;
- }
-}
-
-void operator_and() {
- int i = 0;
- bool b9 = (i > 20);
- if (b9 && false) {
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(false\) {$}}
- i = 22;
- } else {
- i = 23;
- }
- bool ba = (i > 20);
- if (ba && true) {
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(ba\) {$}}
- i = 24;
- } else {
- i = 25;
- }
- bool bb = (i > 20);
- if (false && bb) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(false\) {$}}
- i = 26;
- } else {
- i = 27;
- }
- bool bc = (i > 20);
- if (true && bc) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(bc\) {$}}
- i = 28;
- } else {
- i = 29;
- }
-}
-
-void ternary_operator() {
- int i = 0;
- bool bd = (i > 20) ? true : false;
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: {{.*}} in ternary expression result
- // CHECK-FIXES: {{^ bool bd = i > 20;$}}
-
- bool be = (i > 20) ? false : true;
- // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: {{.*}} in ternary expression result
- // CHECK-FIXES: {{^ bool be = i <= 20;$}}
-
- bool bf = ((i > 20)) ? false : true;
- // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: {{.*}} in ternary expression result
- // CHECK-FIXES: {{^ bool bf = i <= 20;$}}
-}
-
-void operator_not_equal() {
- int i = 0;
- bool bf = (i > 20);
- if (false != bf) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(bf\) {$}}
- i = 30;
- } else {
- i = 31;
- }
- bool bg = (i > 20);
- if (true != bg) {
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(!bg\) {$}}
- i = 32;
- } else {
- i = 33;
- }
- bool bh = (i > 20);
- if (bh != false) {
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(bh\) {$}}
- i = 34;
- } else {
- i = 35;
- }
- bool bi = (i > 20);
- if (bi != true) {
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(!bi\) {$}}
- i = 36;
- } else {
- i = 37;
- }
-}
-
-void nested_booleans() {
- if (false || (true || false)) {
- // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(false \|\| \(true\)\) {$}}
- }
- if (true && (true || false)) {
- // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(true && \(true\)\) {$}}
- }
- if (false || (true && false)) {
- // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(false \|\| \(false\)\) {$}}
- }
- if (true && (true && false)) {
- // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: {{.*}} to boolean operator
- // CHECK-FIXES: {{^ if \(true && \(false\)\) {$}}
- }
-}
-
-static constexpr bool truthy() {
- return true;
-}
-
-#define HAS_XYZ_FEATURE true
-#define M1(what) M2(true, what)
-#define M2(condition, what) if (condition) what
-
-void macros_and_constexprs(int i = 0) {
- bool b = (i == 1);
- if (b && truthy()) {
- // leave this alone; if you want it simplified, then you should
- // inline the constexpr function first.
- i = 1;
- }
- i = 2;
- if (b && HAS_XYZ_FEATURE) {
- // leave this alone; if you want it simplified, then you should
- // inline the macro first.
- i = 3;
- }
- if (HAS_XYZ_FEATURE) {
- i = 5;
- }
- i = 4;
- M1(i = 7);
-}
-
-#undef HAS_XYZ_FEATURE
-
-bool conditional_return_statements(int i) {
- if (i == 0) return true; else return false;
-}
-// CHECK-MESSAGES: :[[@LINE-2]]:22: warning: {{.*}} in conditional return statement
-// CHECK-FIXES: {{^}} return i == 0;{{$}}
-// CHECK-FIXES-NEXT: {{^}$}}
-
-bool conditional_return_statements_then_expr(int i, int j) {
- if (i == j) return (i == 0); else return false;
-}
-
-bool conditional_return_statements_else_expr(int i, int j) {
- if (i == j) return true; else return (i == 0);
-}
-
-bool negated_conditional_return_statements(int i) {
- if (i == 0) return false; else return true;
-}
-// CHECK-MESSAGES: :[[@LINE-2]]:22: warning: {{.*}} in conditional return statement
-// CHECK-FIXES: {{^}} return i != 0;{{$}}
-// CHECK-FIXES-NEXT: {{^}$}}
-
-bool negative_condition_conditional_return_statement(int i) {
- if (!(i == 0)) return false; else return true;
-}
-// CHECK-MESSAGES: :[[@LINE-2]]:25: warning: {{.*}} in conditional return statement
-// CHECK-FIXES: {{^}} return i == 0;{{$}}
-// CHECK-FIXES-NEXT: {{^}$}}
-
-bool conditional_compound_return_statements(int i) {
- if (i == 1) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return statement
-// CHECK-FIXES: {{^}}bool conditional_compound_return_statements(int i) {{{$}}
-// CHECK-FIXES-NEXT: {{^}} return i == 1;{{$}}
-// CHECK-FIXES-NEXT: {{^}$}}
-
-bool negated_conditional_compound_return_statements(int i) {
- if (i == 1) {
- return false;
- } else {
- return true;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return statement
-// CHECK-FIXES: {{^}}bool negated_conditional_compound_return_statements(int i) {{{$}}
-// CHECK-FIXES-NEXT: {{^}} return i != 1;{{$}}
-// CHECK-FIXES-NEXT: {{^}$}}
-
-bool conditional_return_statements_side_effects_then(int i) {
- if (i == 2) {
- macros_and_constexprs();
- return true;
- } else
- return false;
-}
-
-bool negated_conditional_return_statements_side_effects_then(int i) {
- if (i == 2) {
- macros_and_constexprs();
- return false;
- } else
- return true;
-}
-
-bool conditional_return_statements_side_effects_else(int i) {
- if (i == 2)
- return true;
- else {
- macros_and_constexprs();
- return false;
- }
-}
-
-bool negated_conditional_return_statements_side_effects_else(int i) {
- if (i == 2)
- return false;
- else {
- macros_and_constexprs();
- return true;
- }
-}
-
-void lambda_conditional_return_statements() {
- auto lambda = [](int n) -> bool { if (n > 0) return true; else return false; };
- // CHECK-MESSAGES: :[[@LINE-1]]:55: warning: {{.*}} in conditional return statement
- // CHECK-FIXES: {{^}} auto lambda = [](int n) -> bool { return n > 0; };{{$}}
-
- auto lambda2 = [](int n) -> bool {
- if (n > 0) {
- return true;
- } else {
- return false;
- }
- };
- // CHECK-MESSAGES: :[[@LINE-5]]:16: warning: {{.*}} in conditional return statement
- // CHECK-FIXES: {{^}} auto lambda2 = [](int n) -> bool {{{$}}
- // CHECK-FIXES-NEXT: {{^}} return n > 0;{{$}}
- // CHECK-FIXES-NEXT: {{^}} };{{$}}
-
- auto lambda3 = [](int n) -> bool { if (n > 0) {macros_and_constexprs(); return true; } else return false; };
-
- auto lambda4 = [](int n) -> bool {
- if (n > 0)
- return true;
- else {
- macros_and_constexprs();
- return false;
- }
- };
-
- auto lambda5 = [](int n) -> bool { if (n > 0) return false; else return true; };
- // CHECK-MESSAGES: :[[@LINE-1]]:56: warning: {{.*}} in conditional return statement
- // CHECK-FIXES: {{^}} auto lambda5 = [](int n) -> bool { return n <= 0; };{{$}}
-
- auto lambda6 = [](int n) -> bool {
- if (n > 0) {
- return false;
- } else {
- return true;
- }
- };
- // CHECK-MESSAGES: :[[@LINE-5]]:16: warning: {{.*}} in conditional return statement
- // CHECK-FIXES: {{^}} auto lambda6 = [](int n) -> bool {{{$}}
- // CHECK-FIXES-NEXT: {{^}} return n <= 0;{{$}}
- // CHECK-FIXES-NEXT: {{^}} };{{$}}
-}
-
-void simple_conditional_assignment_statements(int i) {
- bool b;
- if (i > 10)
- b = true;
- else
- b = false;
- bool bb = false;
- // CHECK-MESSAGES: :[[@LINE-4]]:9: warning: {{.*}} in conditional assignment
- // CHECK-FIXES: bool b;
- // CHECK-FIXES: {{^ }}b = i > 10;{{$}}
- // CHECK-FIXES: bool bb = false;
-
- bool c;
- if (i > 20)
- c = false;
- else
- c = true;
- bool c2 = false;
- // CHECK-MESSAGES: :[[@LINE-4]]:9: warning: {{.*}} in conditional assignment
- // CHECK-FIXES: bool c;
- // CHECK-FIXES: {{^ }}c = i <= 20;{{$}}
- // CHECK-FIXES: bool c2 = false;
-
- // Unchanged: different variables.
- bool b2;
- if (i > 12)
- b = true;
- else
- b2 = false;
-
- // Unchanged: no else statement.
- bool b3;
- if (i > 15)
- b3 = true;
-
- // Unchanged: not boolean assignment.
- int j;
- if (i > 17)
- j = 10;
- else
- j = 20;
-
- // Unchanged: different variables assigned.
- int k = 0;
- bool b4 = false;
- if (i > 10)
- b4 = true;
- else
- k = 10;
-}
-
-void complex_conditional_assignment_statements(int i) {
- bool d;
- if (i > 30) {
- d = true;
- } else {
- d = false;
- }
- d = false;
- // CHECK-MESSAGES: :[[@LINE-5]]:9: warning: {{.*}} in conditional assignment
- // CHECK-FIXES: bool d;
- // CHECK-FIXES: {{^ }}d = i > 30;{{$}}
- // CHECK-FIXES: d = false;
-
- bool e;
- if (i > 40) {
- e = false;
- } else {
- e = true;
- }
- e = false;
- // CHECK-MESSAGES: :[[@LINE-5]]:9: warning: {{.*}} in conditional assignment
- // CHECK-FIXES: bool e;
- // CHECK-FIXES: {{^ }}e = i <= 40;{{$}}
- // CHECK-FIXES: e = false;
-
- // Unchanged: no else statement.
- bool b3;
- if (i > 15) {
- b3 = true;
- }
-
- // Unchanged: not a boolean assignment.
- int j;
- if (i > 17) {
- j = 10;
- } else {
- j = 20;
- }
-
- // Unchanged: multiple statements.
- bool f;
- if (j > 10) {
- j = 10;
- f = true;
- } else {
- j = 20;
- f = false;
- }
-
- // Unchanged: multiple statements.
- bool g;
- if (j > 10)
- f = true;
- else {
- j = 20;
- f = false;
- }
-
- // Unchanged: multiple statements.
- bool h;
- if (j > 10) {
- j = 10;
- f = true;
- } else
- f = false;
-}
-
-// Unchanged: chained return statements, but ChainedConditionalReturn not set.
-bool chained_conditional_compound_return(int i) {
- if (i < 0) {
- return true;
- } else if (i < 10) {
- return false;
- } else if (i > 20) {
- return true;
- } else {
- return false;
- }
-}
-
-// Unchanged: chained return statements, but ChainedConditionalReturn not set.
-bool chained_conditional_return(int i) {
- if (i < 0)
- return true;
- else if (i < 10)
- return false;
- else if (i > 20)
- return true;
- else
- return false;
-}
-
-// Unchanged: chained assignments, but ChainedConditionalAssignment not set.
-void chained_conditional_compound_assignment(int i) {
- bool b;
- if (i < 0) {
- b = true;
- } else if (i < 10) {
- b = false;
- } else if (i > 20) {
- b = true;
- } else {
- b = false;
- }
-}
-
-// Unchanged: chained return statements, but ChainedConditionalReturn not set.
-void chained_conditional_assignment(int i) {
- bool b;
- if (i < 0)
- b = true;
- else if (i < 10)
- b = false;
- else if (i > 20)
- b = true;
- else
- b = false;
-}
-
-// Unchanged: chained return statements, but ChainedConditionalReturn not set.
-bool chained_simple_if_return_negated(int i) {
- if (i < 5)
- return false;
- if (i > 10)
- return false;
- return true;
-}
-
-// Unchanged: chained return statements, but ChainedConditionalReturn not set.
-bool complex_chained_if_return_return(int i) {
- if (i < 5) {
- return true;
- }
- if (i > 10) {
- return true;
- }
- return false;
-}
-
-// Unchanged: chained return statements, but ChainedConditionalReturn not set.
-bool complex_chained_if_return_return_negated(int i) {
- if (i < 5) {
- return false;
- }
- if (i > 10) {
- return false;
- }
- return true;
-}
-
-// Unchanged: chained return statements, but ChainedConditionalReturn not set.
-bool chained_simple_if_return(int i) {
- if (i < 5)
- return true;
- if (i > 10)
- return true;
- return false;
-}
-
-bool simple_if_return_return(int i) {
- if (i > 10)
- return true;
- return false;
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}}bool simple_if_return_return(int i) {{{$}}
-// CHECK-FIXES: {{^ return i > 10;$}}
-// CHECK-FIXES: {{^}$}}
-
-bool simple_if_return_return_negated(int i) {
- if (i > 10)
- return false;
- return true;
-}
-// CHECK-MESSAGES: :[[@LINE-3]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}}bool simple_if_return_return_negated(int i) {{{$}}
-// CHECK-FIXES: {{^ return i <= 10;$}}
-// CHECK-FIXES: {{^}$}}
-
-bool complex_if_return_return(int i) {
- if (i > 10) {
- return true;
- }
- return false;
-}
-// CHECK-MESSAGES: :[[@LINE-4]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}}bool complex_if_return_return(int i) {{{$}}
-// CHECK-FIXES: {{^ return i > 10;$}}
-// CHECK-FIXES: {{^}$}}
-
-bool complex_if_return_return_negated(int i) {
- if (i > 10) {
- return false;
- }
- return true;
-}
-// CHECK-MESSAGES: :[[@LINE-4]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}}bool complex_if_return_return_negated(int i) {{{$}}
-// CHECK-FIXES: {{^ return i <= 10;$}}
-// CHECK-FIXES: {{^}$}}
-
-bool if_implicit_bool_expr(int i) {
- if (i & 1) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} return (i & 1) != 0;{{$}}
-
-bool negated_if_implicit_bool_expr(int i) {
- if (i - 1) {
- return false;
- } else {
- return true;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} return (i - 1) == 0;{{$}}
-
-bool implicit_int(int i) {
- if (i) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} return i != 0;{{$}}
-
-bool explicit_bool(bool b) {
- if (b) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} return b;{{$}}
-
-class Implicit {
-public:
- operator bool() {
- return true;
- }
-};
-
-bool object_bool_implicit_conversion(Implicit O) {
- if (O) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} return O;{{$}}
-
-bool negated_explicit_bool(bool b) {
- if (!b) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} return !b;{{$}}
-
-bool bitwise_complement_conversion(int i) {
- if (~i) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} return ~i != 0;{{$}}
-
-bool logical_or(bool a, bool b) {
- if (a || b) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} return a || b;{{$}}
-
-bool logical_and(bool a, bool b) {
- if (a && b) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} return a && b;{{$}}
-
-class Comparable
-{
-public:
- bool operator==(Comparable const &rhs) { return true; }
- bool operator!=(Comparable const &rhs) { return false; }
-};
-
-bool comparable_objects() {
- Comparable c;
- Comparable d;
- if (c == d) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} return c == d;{{$}}
-
-bool negated_comparable_objects() {
- Comparable c;
- Comparable d;
- if (c == d) {
- return false;
- } else {
- return true;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} return c != d;{{$}}
-
-struct X {
- explicit operator bool();
-};
-
-void explicit_conversion_assignment(X x) {
- bool y;
- if (x) {
- y = true;
- } else {
- y = false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:9: warning: {{.*}} in conditional assignment
-// CHECK-FIXES: {{^ bool y;$}}
-// CHECK-FIXES: {{^}} y = static_cast<bool>(x);{{$}}
-
-void ternary_integer_condition(int i) {
- bool b = i ? true : false;
-}
-// CHECK-MESSAGES: :[[@LINE-2]]:16: warning: {{.*}} in ternary expression result
-// CHECK-FIXES: bool b = i != 0;{{$}}
-
-bool non_null_pointer_condition(int *p1) {
- if (p1) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: return p1 != nullptr;{{$}}
-
-bool null_pointer_condition(int *p2) {
- if (!p2) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: return p2 == nullptr;{{$}}
-
-bool negated_non_null_pointer_condition(int *p3) {
- if (p3) {
- return false;
- } else {
- return true;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: return p3 == nullptr;{{$}}
-
-bool negated_null_pointer_condition(int *p4) {
- if (!p4) {
- return false;
- } else {
- return true;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: return p4 != nullptr;{{$}}
-
-bool comments_in_the_middle(bool b) {
- if (b) {
- return true;
- } else {
- // something wicked this way comes
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-6]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} if (b) {
-// CHECK-FIXES: // something wicked this way comes{{$}}
-
-bool preprocessor_in_the_middle(bool b) {
- if (b) {
- return true;
- } else {
-#define SOMETHING_WICKED false
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-6]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} if (b) {
-// CHECK-FIXES: {{^}}#define SOMETHING_WICKED false
-
-bool integer_not_zero(int i) {
- if (i) {
- return false;
- } else {
- return true;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: {{^}} return i == 0;{{$}}
-
-class A {
-public:
- int m;
-};
-
-bool member_pointer_nullptr(int A::*p) {
- if (p) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: return p != nullptr;{{$}}
-
-bool integer_member_implicit_cast(A *p) {
- if (p->m) {
- return true;
- } else {
- return false;
- }
-}
-// CHECK-MESSAGES: :[[@LINE-5]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: return p->m != 0;{{$}}
-
-bool operator!=(const A&, const A&) { return false; }
-bool expr_with_cleanups(A &S) {
- if (S != (A)S)
- return false;
-
- return true;
-}
-// CHECK-MESSAGES: :[[@LINE-4]]:12: warning: {{.*}} in conditional return
-// CHECK-FIXES: S == (A)S;{{$}}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-simplify-subscript-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-simplify-subscript-expr.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-simplify-subscript-expr.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-simplify-subscript-expr.cpp (removed)
@@ -1,108 +0,0 @@
-// RUN: %check_clang_tidy %s readability-simplify-subscript-expr %t \
-// RUN: -config="{CheckOptions: \
-// RUN: [{key: readability-simplify-subscript-expr.Types, \
-// RUN: value: '::std::basic_string;::std::basic_string_view;MyVector'}]}" --
-
-namespace std {
-
-template <class T>
-class basic_string {
- public:
- using size_type = unsigned;
- using value_type = T;
- using reference = value_type&;
- using const_reference = const value_type&;
-
- reference operator[](size_type);
- const_reference operator[](size_type) const;
- T* data();
- const T* data() const;
-};
-
-using string = basic_string<char>;
-
-template <class T>
-class basic_string_view {
- public:
- using size_type = unsigned;
- using const_reference = const T&;
- using const_pointer = const T*;
-
- constexpr const_reference operator[](size_type) const;
- constexpr const_pointer data() const noexcept;
-};
-
-using string_view = basic_string_view<char>;
-
-}
-
-template <class T>
-class MyVector {
- public:
- using size_type = unsigned;
- using const_reference = const T&;
- using const_pointer = const T*;
-
- const_reference operator[](size_type) const;
- const T* data() const noexcept;
-};
-
-#define DO(x) do { x; } while (false)
-#define ACCESS(x) (x)
-#define GET(x, i) (x).data()[i]
-
-template <class T>
-class Foo {
- public:
- char bar(int i) {
- return x.data()[i];
- }
- private:
- T x;
-};
-
-void f(int i) {
- MyVector<int> v;
- int x = v.data()[i];
- // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: accessing an element of the container does not require a call to 'data()'; did you mean to use 'operator[]'? [readability-simplify-subscript-expr]
- // CHECK-FIXES: int x = v[i];
-
- std::string s;
- char c1 = s.data()[i];
- // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: accessing an element
- // CHECK-FIXES: char c1 = s[i];
-
- std::string_view sv;
- char c2 = sv.data()[i];
- // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: accessing an element
- // CHECK-FIXES: char c2 = sv[i];
-
- std::string* ps = &s;
- char c3 = ps->data()[i];
- // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: accessing an element
- // CHECK-FIXES: char c3 = (*ps)[i];
-
- char c4 = (*ps).data()[i];
- // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: accessing an element
- // CHECK-FIXES: char c4 = (*ps)[i];
-
- DO(char c5 = s.data()[i]);
- // CHECK-MESSAGES: :[[@LINE-1]]:18: warning: accessing an element
- // CHECK-FIXES: DO(char c5 = s[i]);
-
- char c6 = ACCESS(s).data()[i];
- // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: accessing an element
- // CHECK-FIXES: char c6 = ACCESS(s)[i];
-
- char c7 = ACCESS(s.data())[i];
- // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: accessing an element
- // CHECK-FIXES: char c7 = ACCESS(s)[i];
-
- char c8 = ACCESS(s.data()[i]);
- // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: accessing an element
- // CHECK-FIXES: char c8 = ACCESS(s[i]);
-
- char c9 = GET(s, i);
-
- char c10 = Foo<std::string>{}.bar(i);
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance-nesting-threshold.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance-nesting-threshold.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance-nesting-threshold.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance-nesting-threshold.cpp (removed)
@@ -1,33 +0,0 @@
-// RUN: %check_clang_tidy %s readability-static-accessed-through-instance %t -- -config="{CheckOptions: [{key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold, value: 4}]}" --
-
-// Nested specifiers
-namespace M {
-namespace N {
-struct V {
- static int v;
- struct T {
- static int t;
- struct U {
- static int u;
- };
- };
-};
-}
-}
-
-void f(M::N::V::T::U u) {
- M::N::V v;
- v.v = 12;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} M::N::V::v = 12;{{$}}
-
- M::N::V::T w;
- w.t = 12;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} M::N::V::T::t = 12;{{$}}
-
- // u.u is not changed, because the nesting level is over 4
- u.u = 12;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} u.u = 12;{{$}}
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-static-accessed-through-instance.cpp (removed)
@@ -1,250 +0,0 @@
-// RUN: %check_clang_tidy %s readability-static-accessed-through-instance %t
-
-struct C {
- static void foo();
- static int x;
- int nsx;
- void mf() {
- (void)&x; // OK, x is accessed inside the struct.
- (void)&C::x; // OK, x is accessed using a qualified-id.
- foo(); // OK, foo() is accessed inside the struct.
- }
- void ns() const;
-};
-
-int C::x = 0;
-
-struct CC {
- void foo();
- int x;
-};
-
-template <typename T> struct CT {
- static T foo();
- static T x;
- int nsx;
- void mf() {
- (void)&x; // OK, x is accessed inside the struct.
- (void)&C::x; // OK, x is accessed using a qualified-id.
- foo(); // OK, foo() is accessed inside the struct.
- }
-};
-
-// Expressions with side effects
-C &f(int, int, int, int);
-void g() {
- f(1, 2, 3, 4).x;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through instance [readability-static-accessed-through-instance]
- // CHECK-FIXES: {{^}} f(1, 2, 3, 4).x;{{$}}
-}
-
-int i(int &);
-void j(int);
-C h();
-bool a();
-int k(bool);
-
-void f(C c) {
- j(i(h().x));
- // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: static member
- // CHECK-FIXES: {{^}} j(i(h().x));{{$}}
-
- // The execution of h() depends on the return value of a().
- j(k(a() && h().x));
- // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: static member
- // CHECK-FIXES: {{^}} j(k(a() && h().x));{{$}}
-
- if ([c]() {
- c.ns();
- return c;
- }().x == 15)
- ;
- // CHECK-MESSAGES: :[[@LINE-5]]:7: warning: static member
- // CHECK-FIXES: {{^}} if ([c]() {{{$}}
-}
-
-// Nested specifiers
-namespace N {
-struct V {
- static int v;
- struct T {
- static int t;
- struct U {
- static int u;
- };
- };
-};
-}
-
-void f(N::V::T::U u) {
- N::V v;
- v.v = 12;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} N::V::v = 12;{{$}}
-
- N::V::T w;
- w.t = 12;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} N::V::T::t = 12;{{$}}
-
- // u.u is not changed to N::V::T::U::u; because the nesting level is over 3.
- u.u = 12;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} u.u = 12;{{$}}
-
- using B = N::V::T::U;
- B b;
- b.u;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} B::u;{{$}}
-}
-
-// Templates
-template <typename T> T CT<T>::x;
-
-template <typename T> struct CCT {
- T foo();
- T x;
-};
-
-typedef C D;
-
-using E = D;
-
-#define FOO(c) c.foo()
-#define X(c) c.x
-
-template <typename T> void f(T t, C c) {
- t.x; // OK, t is a template parameter.
- c.x;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} C::x;{{$}}
-}
-
-template <int N> struct S { static int x; };
-
-template <> struct S<0> { int x; };
-
-template <int N> void h() {
- S<N> sN;
- sN.x; // OK, value of N affects whether x is static or not.
-
- S<2> s2;
- s2.x;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} S<2>::x;{{$}}
-}
-
-void static_through_instance() {
- C *c1 = new C();
- c1->foo(); // 1
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} C::foo(); // 1{{$}}
- c1->x; // 2
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} C::x; // 2{{$}}
- c1->nsx; // OK, nsx is a non-static member.
-
- const C *c2 = new C();
- c2->foo(); // 2
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} C::foo(); // 2{{$}}
-
- C::foo(); // OK, foo() is accessed using a qualified-id.
- C::x; // OK, x is accessed using a qualified-id.
-
- D d;
- d.foo();
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} D::foo();{{$}}
- d.x;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} D::x;{{$}}
-
- E e;
- e.foo();
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} E::foo();{{$}}
- e.x;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} E::x;{{$}}
-
- CC *cc = new CC;
-
- f(*c1, *c1);
- f(*cc, *c1);
-
- // Macros: OK, macros are not checked.
- FOO((*c1));
- X((*c1));
- FOO((*cc));
- X((*cc));
-
- // Templates
- CT<int> ct;
- ct.foo();
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} CT<int>::foo();{{$}}
- ct.x;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} CT<int>::x;{{$}}
- ct.nsx; // OK, nsx is a non-static member
-
- CCT<int> cct;
- cct.foo(); // OK, CCT has no static members.
- cct.x; // OK, CCT has no static members.
-
- h<4>();
-}
-
-// Overloaded member access operator
-struct Q {
- static int K;
- int y = 0;
-};
-
-int Q::K = 0;
-
-struct Qptr {
- Q *q;
-
- explicit Qptr(Q *qq) : q(qq) {}
-
- Q *operator->() {
- ++q->y;
- return q;
- }
-};
-
-int func(Qptr qp) {
- qp->y = 10; // OK, the overloaded operator might have side-effects.
- qp->K = 10; //
-}
-
-namespace {
- struct Anonymous {
- static int I;
- };
-}
-
-void use_anonymous() {
- Anonymous Anon;
- Anon.I;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} Anonymous::I;{{$}}
-}
-
-namespace Outer {
- inline namespace Inline {
- struct S {
- static int I;
- };
- }
-}
-
-void use_inline() {
- Outer::S V;
- V.I;
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member
- // CHECK-FIXES: {{^}} Outer::S::I;{{$}}
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-static-definition-in-anonymous-namespace.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-static-definition-in-anonymous-namespace.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-static-definition-in-anonymous-namespace.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-static-definition-in-anonymous-namespace.cpp (removed)
@@ -1,49 +0,0 @@
-// RUN: %check_clang_tidy %s readability-static-definition-in-anonymous-namespace %t
-
-namespace {
-
-int a = 1;
-const int b = 1;
-static int c = 1;
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'c' is a static definition in anonymous namespace; static is redundant here [readability-static-definition-in-anonymous-namespace]
-// CHECK-FIXES: {{^}}int c = 1;
-static const int d = 1;
-// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: 'd' is a static definition in anonymous namespace
-// CHECK-FIXES: {{^}}const int d = 1;
-const static int e = 1;
-// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: 'e' is a static definition in anonymous namespace
-// CHECK-FIXES: {{^}}const int e = 1;
-
-void f() {
- int a = 1;
- static int b = 1;
-}
-
-static int g() {
-// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'g' is a static definition in anonymous namespace
-// CHECK-FIXES: {{^}}int g() {
- return 1;
-}
-
-#define DEFINE_STATIC static
-// CHECK-FIXES: {{^}}#define DEFINE_STATIC static
-DEFINE_STATIC int h = 1;
-// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: 'h' is a static definition in anonymous namespace
-// CHECK-FIXES: {{^}}DEFINE_STATIC int h = 1;
-
-#define DEFINE_STATIC_VAR(x) static int x = 2
-// CHECK-FIXES: {{^}}#define DEFINE_STATIC_VAR(x) static int x = 2
-DEFINE_STATIC_VAR(i);
-// CHECK-FIXES: {{^}}DEFINE_STATIC_VAR(i);
-
-} // namespace
-
-namespace N {
-
-int a = 1;
-const int b = 1;
-static int c = 1;
-static const int d = 1;
-const static int e = 1;
-
-} // namespace N
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-string-compare.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-string-compare.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-string-compare.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-string-compare.cpp (removed)
@@ -1,119 +0,0 @@
-// RUN: %check_clang_tidy %s readability-string-compare %t
-
-namespace std {
-template <typename T>
-class allocator {};
-template <typename T>
-class char_traits {};
-template <typename C, typename T = std::char_traits<C>, typename A = std::allocator<C>>
-class basic_string {
-public:
- basic_string();
- basic_string(const C *, unsigned int size);
- int compare(const basic_string<char> &str) const;
- int compare(const C *) const;
- int compare(int, int, const basic_string<char> &str) const;
- bool empty();
-};
-bool operator==(const basic_string<char> &lhs, const basic_string<char> &rhs);
-bool operator!=(const basic_string<char> &lhs, const basic_string<char> &rhs);
-bool operator==(const basic_string<char> &lhs, const char *&rhs);
-typedef basic_string<char> string;
-}
-
-void func(bool b);
-
-std::string comp() {
- std::string str("a", 1);
- return str;
-}
-
-void Test() {
- std::string str1("a", 1);
- std::string str2("b", 1);
-
- if (str1.compare(str2)) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:7: warning: do not use 'compare' to test equality of strings; use the string equality operator instead [readability-string-compare]
- if (!str1.compare(str2)) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:8: warning: do not use 'compare' to test equality of strings; use the string equality operator instead [readability-string-compare]
- if (str1.compare(str2) == 0) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:7: warning: do not use 'compare' to test equality of strings;
- // CHECK-FIXES: if (str1 == str2) {
- if (str1.compare(str2) != 0) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:7: warning: do not use 'compare' to test equality of strings;
- // CHECK-FIXES: if (str1 != str2) {
- if (str1.compare("foo") == 0) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:7: warning: do not use 'compare' to test equality of strings;
- // CHECK-FIXES: if (str1 == "foo") {
- if (0 == str1.compare(str2)) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:7: warning: do not use 'compare' to test equality of strings;
- // CHECK-FIXES: if (str2 == str1) {
- if (0 != str1.compare(str2)) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:7: warning: do not use 'compare' to test equality of strings;
- // CHECK-FIXES: if (str2 != str1) {
- func(str1.compare(str2));
- // CHECK-MESSAGES: [[@LINE-1]]:8: warning: do not use 'compare' to test equality of strings;
- if (str2.empty() || str1.compare(str2) != 0) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:23: warning: do not use 'compare' to test equality of strings;
- // CHECK-FIXES: if (str2.empty() || str1 != str2) {
- std::string *str3 = &str1;
- if (str3->compare(str2)) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:7: warning: do not use 'compare' to test equality of strings;
- if (str3->compare(str2) == 0) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:7: warning: do not use 'compare' to test equality of strings;
- // CHECK-FIXES: if (*str3 == str2) {
- if (str2.compare(*str3) == 0) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:7: warning: do not use 'compare' to test equality of strings;
- // CHECK-FIXES: if (str2 == *str3) {
- if (comp().compare(str1) == 0) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:7: warning: do not use 'compare' to test equality of strings;
- // CHECK-FIXES: if (comp() == str1) {
- if (str1.compare(comp()) == 0) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:7: warning: do not use 'compare' to test equality of strings;
- // CHECK-FIXES: if (str1 == comp()) {
- if (str1.compare(comp())) {
- }
- // CHECK-MESSAGES: [[@LINE-2]]:7: warning: do not use 'compare' to test equality of strings;
-}
-
-void Valid() {
- std::string str1("a", 1);
- std::string str2("b", 1);
- if (str1 == str2) {
- }
- if (str1 != str2) {
- }
- if (str1.compare(str2) == str1.compare(str2)) {
- }
- if (0 == 0) {
- }
- if (str1.compare(str2) > 0) {
- }
- if (str1.compare(1, 3, str2)) {
- }
- if (str1.compare(str2) > 0) {
- }
- if (str1.compare(str2) < 0) {
- }
- if (str1.compare(str2) == 2) {
- }
- if (str1.compare(str2) == -3) {
- }
- if (str1.compare(str2) == 1) {
- }
- if (str1.compare(str2) == -1) {
- }
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-uniqueptr-delete-release.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-uniqueptr-delete-release.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-uniqueptr-delete-release.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-uniqueptr-delete-release.cpp (removed)
@@ -1,76 +0,0 @@
-// RUN: %check_clang_tidy %s readability-uniqueptr-delete-release %t
-
-namespace std {
-template <typename T>
-struct default_delete {};
-
-template <typename T, typename D = default_delete<T>>
-class unique_ptr {
- public:
- unique_ptr();
- ~unique_ptr();
- explicit unique_ptr(T*);
- template <typename U, typename E>
- unique_ptr(unique_ptr<U, E>&&);
- T* release();
-};
-} // namespace std
-
-std::unique_ptr<int>& ReturnsAUnique();
-
-void Positives() {
- std::unique_ptr<int> P;
- delete P.release();
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: prefer '= nullptr' to 'delete x.release()' to reset unique_ptr<> objects [readability-uniqueptr-delete-release]
- // CHECK-FIXES: {{^}} P = nullptr;
-
- auto P2 = P;
- delete P2.release();
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: prefer '= nullptr' to 'delete x.release()' to reset unique_ptr<> objects [readability-uniqueptr-delete-release]
- // CHECK-FIXES: {{^}} P2 = nullptr;
-
- std::unique_ptr<int> Array[20];
- delete Array[4].release();
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: prefer '= nullptr' to 'delete
- // CHECK-FIXES: {{^}} Array[4] = nullptr;
-
- delete ReturnsAUnique().release();
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: prefer '= nullptr' to 'delete
- // CHECK-FIXES: {{^}} ReturnsAUnique() = nullptr;
-}
-
-struct NotDefaultDeleter {};
-
-struct NotUniquePtr {
- int* release();
-};
-
-void Negatives() {
- std::unique_ptr<int, NotDefaultDeleter> P;
- delete P.release();
-
- NotUniquePtr P2;
- delete P2.release();
-}
-
-template <typename T, typename D>
-void NegativeDeleterT() {
- // Ideally this would trigger a warning, but we have all dependent types
- // disabled for now.
- std::unique_ptr<T> P;
- delete P.release();
-
- // We ignore this one because the deleter is a template argument.
- // Not all instantiations will use the default deleter.
- std::unique_ptr<int, D> P2;
- delete P2.release();
-}
-template void NegativeDeleterT<int, std::default_delete<int>>();
-
-// Test some macros
-
-#define DELETE_RELEASE(x) delete (x).release()
-void NegativesWithTemplate() {
- std::unique_ptr<int> P;
- DELETE_RELEASE(P);
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-float16.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-float16.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-float16.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-float16.cpp (removed)
@@ -1,51 +0,0 @@
-// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -target aarch64-linux-gnu -I %S
-
-#include "readability-uppercase-literal-suffix.h"
-
-void float16_normal_literals() {
- // _Float16
-
- static constexpr auto v14 = 1.f16;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 1.f16;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F16{{$}}
- // CHECK-FIXES: static constexpr auto v14 = 1.F16;
- static_assert(is_same<decltype(v14), const _Float16>::value, "");
- static_assert(v14 == 1.F16, "");
-
- static constexpr auto v15 = 1.e0f16;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v15 = 1.e0f16;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F16{{$}}
- // CHECK-FIXES: static constexpr auto v15 = 1.e0F16;
- static_assert(is_same<decltype(v15), const _Float16>::value, "");
- static_assert(v15 == 1.F16, "");
-
- static constexpr auto v16 = 1.F16; // OK.
- static_assert(is_same<decltype(v16), const _Float16>::value, "");
- static_assert(v16 == 1.F16, "");
-
- static constexpr auto v17 = 1.e0F16; // OK.
- static_assert(is_same<decltype(v17), const _Float16>::value, "");
- static_assert(v17 == 1.F16, "");
-}
-
-void float16_hexadecimal_literals() {
-// _Float16
-
- static constexpr auto v13 = 0xfp0f16;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'f16', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v13 = 0xfp0f16;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F16{{$}}
- // CHECK-FIXES: static constexpr auto v13 = 0xfp0F16;
- static_assert(is_same<decltype(v13), const _Float16>::value, "");
- static_assert(v13 == 0xfp0F16, "");
-
- static constexpr auto v14 = 0xfp0F16; // OK.
- static_assert(is_same<decltype(v14), const _Float16>::value, "");
- static_assert(v14 == 0xfp0F16, "");
-
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-floating-point-opencl-half.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-floating-point-opencl-half.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-floating-point-opencl-half.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-floating-point-opencl-half.cpp (removed)
@@ -1,30 +0,0 @@
-// RUN: %check_clang_tidy -std=cl2.0 %s readability-uppercase-literal-suffix %t -- -- -target x86_64-pc-linux-gnu -I %S -x cl
-// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
-// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -- -target x86_64-pc-linux-gnu -I %S -std=cl2.0 -x cl
-// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -- -target x86_64-pc-linux-gnu -I %S -std=cl2.0 -x cl
-
-#pragma OPENCL EXTENSION cl_khr_fp16 : enable
-
-void floating_point_half_suffix() {
- static half v0 = 0x0p0; // no literal
-
- // half
-
- static half v2 = 1.h;
- // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: floating point literal has suffix 'h', which is not uppercase
- // CHECK-MESSAGES-NEXT: static half v2 = 1.h;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}H{{$}}
- // CHECK-HIXES: static half v2 = 1.H;
-
- static half v3 = 1.e0h;
- // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: floating point literal has suffix 'h', which is not uppercase
- // CHECK-MESSAGES-NEXT: static half v3 = 1.e0h;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}H{{$}}
- // CHECK-HIXES: static half v3 = 1.e0H;
-
- static half v4 = 1.H; // OK.
-
- static half v5 = 1.e0H; // OK.
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp (removed)
@@ -1,170 +0,0 @@
-// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -target x86_64-pc-linux-gnu -I %S
-// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
-// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -- -target x86_64-pc-linux-gnu -I %S
-// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -- -target x86_64-pc-linux-gnu -I %S
-
-#include "readability-uppercase-literal-suffix.h"
-
-void floating_point_suffix() {
- static constexpr auto v0 = 1.; // no literal
- static_assert(is_same<decltype(v0), const double>::value, "");
- static_assert(v0 == 1., "");
-
- static constexpr auto v1 = 1.e0; // no literal
- static_assert(is_same<decltype(v1), const double>::value, "");
- static_assert(v1 == 1., "");
-
- // Float
-
- static constexpr auto v2 = 1.f;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v2 = 1.f;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}}
- // CHECK-FIXES: static constexpr auto v2 = 1.F;
- static_assert(is_same<decltype(v2), const float>::value, "");
- static_assert(v2 == 1.0F, "");
-
- static constexpr auto v3 = 1.e0f;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v3 = 1.e0f;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}}
- // CHECK-FIXES: static constexpr auto v3 = 1.e0F;
- static_assert(is_same<decltype(v3), const float>::value, "");
- static_assert(v3 == 1.0F, "");
-
- static constexpr auto v4 = 1.F; // OK.
- static_assert(is_same<decltype(v4), const float>::value, "");
- static_assert(v4 == 1.0F, "");
-
- static constexpr auto v5 = 1.e0F; // OK.
- static_assert(is_same<decltype(v5), const float>::value, "");
- static_assert(v5 == 1.0F, "");
-
- // Long double
-
- static constexpr auto v6 = 1.l;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'l', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v6 = 1.l;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}}
- // CHECK-FIXES: static constexpr auto v6 = 1.L;
- static_assert(is_same<decltype(v6), const long double>::value, "");
- static_assert(v6 == 1., "");
-
- static constexpr auto v7 = 1.e0l;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'l', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 1.e0l;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}}
- // CHECK-FIXES: static constexpr auto v7 = 1.e0L;
- static_assert(is_same<decltype(v7), const long double>::value, "");
- static_assert(v7 == 1., "");
-
- static constexpr auto v8 = 1.L; // OK.
- static_assert(is_same<decltype(v8), const long double>::value, "");
- static_assert(v8 == 1., "");
-
- static constexpr auto v9 = 1.e0L; // OK.
- static_assert(is_same<decltype(v9), const long double>::value, "");
- static_assert(v9 == 1., "");
-
- // __float128
-
- static constexpr auto v10 = 1.q;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'q', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v10 = 1.q;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}Q{{$}}
- // CHECK-FIXES: static constexpr auto v10 = 1.Q;
- static_assert(is_same<decltype(v10), const __float128>::value, "");
- static_assert(v10 == 1., "");
-
- static constexpr auto v11 = 1.e0q;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'q', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v11 = 1.e0q;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}Q{{$}}
- // CHECK-FIXES: static constexpr auto v11 = 1.e0Q;
- static_assert(is_same<decltype(v11), const __float128>::value, "");
- static_assert(v11 == 1., "");
-
- static constexpr auto v12 = 1.Q; // OK.
- static_assert(is_same<decltype(v12), const __float128>::value, "");
- static_assert(v12 == 1., "");
-
- static constexpr auto v13 = 1.e0Q; // OK.
- static_assert(is_same<decltype(v13), const __float128>::value, "");
- static_assert(v13 == 1., "");
-}
-
-void floating_point_complex_suffix() {
- // _Complex, I
-
- static constexpr auto v14 = 1.i;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'i', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 1.i;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}I{{$}}
- // CHECK-FIXES: static constexpr auto v14 = 1.I;
- static_assert(is_same<decltype(v14), const _Complex double>::value, "");
- static_assert(v14 == 1.I, "");
-
- static constexpr auto v15 = 1.e0i;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'i', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v15 = 1.e0i;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}I{{$}}
- // CHECK-FIXES: static constexpr auto v15 = 1.e0I;
- static_assert(is_same<decltype(v15), const _Complex double>::value, "");
- static_assert(v15 == 1.I, "");
-
- static constexpr auto v16 = 1.I; // OK.
- static_assert(is_same<decltype(v16), const _Complex double>::value, "");
- static_assert(v16 == 1.I, "");
-
- static constexpr auto v17 = 1.e0I; // OK.
- static_assert(is_same<decltype(v17), const _Complex double>::value, "");
- static_assert(v17 == 1.I, "");
-
- // _Complex, J
-
- static constexpr auto v18 = 1.j;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'j', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v18 = 1.j;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}J{{$}}
- // CHECK-FIXES: static constexpr auto v18 = 1.J;
- static_assert(is_same<decltype(v18), const _Complex double>::value, "");
- static_assert(v18 == 1.J, "");
-
- static constexpr auto v19 = 1.e0j;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'j', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v19 = 1.e0j;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}J{{$}}
- // CHECK-FIXES: static constexpr auto v19 = 1.e0J;
- static_assert(is_same<decltype(v19), const _Complex double>::value, "");
- static_assert(v19 == 1.J, "");
-
- static constexpr auto v20 = 1.J; // OK.
- static_assert(is_same<decltype(v20), const _Complex double>::value, "");
- static_assert(v20 == 1.J, "");
-
- static constexpr auto v21 = 1.e0J; // OK.
- static_assert(is_same<decltype(v21), const _Complex double>::value, "");
- static_assert(v21 == 1.J, "");
-}
-
-void macros() {
-#define PASSTHROUGH(X) X
- static constexpr auto m0 = PASSTHROUGH(1.f);
- // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: floating point literal has suffix 'f', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto m0 = PASSTHROUGH(1.f);
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}}
- // CHECK-FIXES: static constexpr auto m0 = PASSTHROUGH(1.F);
- static_assert(is_same<decltype(m0), const float>::value, "");
- static_assert(m0 == 1.0F, "");
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp (removed)
@@ -1,140 +0,0 @@
-// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -target x86_64-pc-linux-gnu -I %S
-// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
-// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -- -target x86_64-pc-linux-gnu -I %S
-// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -- -target x86_64-pc-linux-gnu -I %S
-
-#include "readability-uppercase-literal-suffix.h"
-
-void floating_point_suffix() {
- static constexpr auto v0 = 0x0p0; // no literal
- static_assert(is_same<decltype(v0), const double>::value, "");
- static_assert(v0 == 0, "");
-
- // Float
-
- static constexpr auto v1 = 0xfp0f;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v1 = 0xfp0f;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}}
- // CHECK-FIXES: static constexpr auto v1 = 0xfp0F;
- static_assert(is_same<decltype(v1), const float>::value, "");
- static_assert(v1 == 15, "");
-
- static constexpr auto v2 = 0xfp0F; // OK
- static_assert(is_same<decltype(v2), const float>::value, "");
- static_assert(v2 == 15, "");
-
- static constexpr auto v3 = 0xfP0f;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v3 = 0xfP0f;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}}
- // CHECK-FIXES: static constexpr auto v3 = 0xfP0F;
- static_assert(is_same<decltype(v3), const float>::value, "");
- static_assert(v3 == 15, "");
-
- static constexpr auto v4 = 0xfP0F; // OK
- static_assert(is_same<decltype(v4), const float>::value, "");
- static_assert(v4 == 15, "");
-
- static constexpr auto v5 = 0xFP0f;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 0xFP0f;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}}
- // CHECK-FIXES: static constexpr auto v5 = 0xFP0F;
- static_assert(is_same<decltype(v5), const float>::value, "");
- static_assert(v5 == 15, "");
-
- static constexpr auto v6 = 0xFP0F; // OK
- static_assert(is_same<decltype(v6), const float>::value, "");
- static_assert(v6 == 15, "");
-
- static constexpr auto v7 = 0xFp0f;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 0xFp0f;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}}
- // CHECK-FIXES: static constexpr auto v7 = 0xFp0F;
- static_assert(is_same<decltype(v7), const float>::value, "");
- static_assert(v7 == 15, "");
-
- static constexpr auto v8 = 0xFp0F; // OK
- static_assert(is_same<decltype(v8), const float>::value, "");
- static_assert(v8 == 15, "");
-
- // long double
-
- static constexpr auto v9 = 0xfp0l;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'l', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v9 = 0xfp0l;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}}
- // CHECK-FIXES: static constexpr auto v9 = 0xfp0L;
- static_assert(is_same<decltype(v9), const long double>::value, "");
- static_assert(v9 == 0xfp0, "");
-
- static constexpr auto v10 = 0xfp0L; // OK.
- static_assert(is_same<decltype(v10), const long double>::value, "");
- static_assert(v10 == 0xfp0, "");
-
- // __float128
-
- static constexpr auto v11 = 0xfp0q;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'q', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v11 = 0xfp0q;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}Q{{$}}
- // CHECK-FIXES: static constexpr auto v11 = 0xfp0Q;
- static_assert(is_same<decltype(v11), const __float128>::value, "");
- static_assert(v11 == 0xfp0, "");
-
- static constexpr auto v12 = 0xfp0Q; // OK.
- static_assert(is_same<decltype(v12), const __float128>::value, "");
- static_assert(v12 == 0xfp0, "");
-}
-
-void floating_point_complex_suffix() {
- // _Complex, I
-
- static constexpr auto v14 = 0xfp0i;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'i', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 0xfp0i;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}I{{$}}
- // CHECK-FIXES: static constexpr auto v14 = 0xfp0I;
- static_assert(is_same<decltype(v14), const _Complex double>::value, "");
- static_assert(v14 == 0xfp0I, "");
-
- static constexpr auto v16 = 0xfp0I; // OK.
- static_assert(is_same<decltype(v16), const _Complex double>::value, "");
- static_assert(v16 == 0xfp0I, "");
-
- // _Complex, J
-
- static constexpr auto v18 = 0xfp0j;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: floating point literal has suffix 'j', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v18 = 0xfp0j;
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}J{{$}}
- // CHECK-FIXES: static constexpr auto v18 = 0xfp0J;
- static_assert(is_same<decltype(v18), const _Complex double>::value, "");
- static_assert(v18 == 0xfp0J, "");
-
- static constexpr auto v20 = 0xfp0J; // OK.
- static_assert(is_same<decltype(v20), const _Complex double>::value, "");
- static_assert(v20 == 0xfp0J, "");
-}
-
-void macros() {
-#define PASSTHROUGH(X) X
- static constexpr auto m0 = PASSTHROUGH(0x0p0f);
- // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: floating point literal has suffix 'f', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto m0 = PASSTHROUGH(0x0p0f);
- // CHECK-MESSAGES-NEXT: ^ ~
- // CHECK-MESSAGES-NEXT: {{^ *}}F{{$}}
- // CHECK-FIXES: static constexpr auto m0 = PASSTHROUGH(0x0p0F);
- static_assert(is_same<decltype(m0), const float>::value, "");
- static_assert(m0 == 0x0p0F, "");
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer-custom-list.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer-custom-list.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer-custom-list.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer-custom-list.cpp (removed)
@@ -1,130 +0,0 @@
-// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -config="{CheckOptions: [{key: readability-uppercase-literal-suffix.NewSuffixes, value: 'L;uL'}]}" -- -I %S
-// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
-// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -config="{CheckOptions: [{key: readability-uppercase-literal-suffix.NewSuffixes, value: 'L;uL'}]}" -- -I %S
-// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -config="{CheckOptions: [{key: readability-uppercase-literal-suffix.NewSuffixes, value: 'L;uL'}]}" -- -I %S
-
-#include "readability-uppercase-literal-suffix.h"
-
-void integer_suffix() {
- // Unsigned
-
- static constexpr auto v3 = 1u; // OK.
- static_assert(is_same<decltype(v3), const unsigned int>::value, "");
- static_assert(v3 == 1, "");
-
- static constexpr auto v4 = 1U; // OK.
- static_assert(is_same<decltype(v4), const unsigned int>::value, "");
- static_assert(v4 == 1, "");
-
- // Long
-
- static constexpr auto v5 = 1l;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'l', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 1l;
- // CHECK-MESSAGES-NEXT: ^~
- // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}}
- // CHECK-FIXES: static constexpr auto v5 = 1L;
- static_assert(is_same<decltype(v5), const long>::value, "");
- static_assert(v5 == 1, "");
-
- static constexpr auto v6 = 1L; // OK.
- static_assert(is_same<decltype(v6), const long>::value, "");
- static_assert(v6 == 1, "");
-
- // Long Long
-
- static constexpr auto v7 = 1ll; // OK.
- static_assert(is_same<decltype(v7), const long long>::value, "");
- static_assert(v7 == 1, "");
-
- static constexpr auto v8 = 1LL; // OK.
- static_assert(is_same<decltype(v8), const long long>::value, "");
- static_assert(v8 == 1, "");
-
- // Unsigned Long
-
- static constexpr auto v9 = 1ul;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'ul', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v9 = 1ul;
- // CHECK-MESSAGES-NEXT: ^~~
- // CHECK-MESSAGES-NEXT: {{^ *}}uL{{$}}
- // CHECK-FIXES: static constexpr auto v9 = 1uL;
- static_assert(is_same<decltype(v9), const unsigned long>::value, "");
- static_assert(v9 == 1, "");
-
- static constexpr auto v10 = 1uL; // OK.
- static_assert(is_same<decltype(v10), const unsigned long>::value, "");
- static_assert(v10 == 1, "");
-
- static constexpr auto v11 = 1Ul;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'Ul', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v11 = 1Ul;
- // CHECK-MESSAGES-NEXT: ^~~
- // CHECK-MESSAGES-NEXT: {{^ *}}uL{{$}}
- // CHECK-FIXES: static constexpr auto v11 = 1uL;
- static_assert(is_same<decltype(v11), const unsigned long>::value, "");
- static_assert(v11 == 1, "");
-
- static constexpr auto v12 = 1UL; // OK.
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'UL', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v12 = 1UL;
- // CHECK-MESSAGES-NEXT: ^~~
- // CHECK-MESSAGES-NEXT: {{^ *}}uL{{$}}
- // CHECK-FIXES: static constexpr auto v12 = 1uL;
- static_assert(is_same<decltype(v12), const unsigned long>::value, "");
- static_assert(v12 == 1, "");
-
- // Long Unsigned
-
- static constexpr auto v13 = 1lu; // OK.
- static_assert(is_same<decltype(v13), const unsigned long>::value, "");
- static_assert(v13 == 1, "");
-
- static constexpr auto v14 = 1Lu; // OK.
- static_assert(is_same<decltype(v14), const unsigned long>::value, "");
- static_assert(v14 == 1, "");
-
- static constexpr auto v15 = 1lU; // OK.
- static_assert(is_same<decltype(v15), const unsigned long>::value, "");
- static_assert(v15 == 1, "");
-
- static constexpr auto v16 = 1LU; // OK.
- static_assert(is_same<decltype(v16), const unsigned long>::value, "");
- static_assert(v16 == 1, "");
-
- // Unsigned Long Long
-
- static constexpr auto v17 = 1ull; // OK.
- static_assert(is_same<decltype(v17), const unsigned long long>::value, "");
- static_assert(v17 == 1, "");
-
- static constexpr auto v18 = 1uLL; // OK.
- static_assert(is_same<decltype(v18), const unsigned long long>::value, "");
- static_assert(v18 == 1, "");
-
- static constexpr auto v19 = 1Ull; // OK.
- static_assert(is_same<decltype(v19), const unsigned long long>::value, "");
- static_assert(v19 == 1, "");
-
- static constexpr auto v20 = 1ULL; // OK.
- static_assert(is_same<decltype(v20), const unsigned long long>::value, "");
- static_assert(v20 == 1, "");
-
- // Long Long Unsigned
-
- static constexpr auto v21 = 1llu; // OK.
- static_assert(is_same<decltype(v21), const unsigned long long>::value, "");
- static_assert(v21 == 1, "");
-
- static constexpr auto v22 = 1LLu; // OK.
- static_assert(is_same<decltype(v22), const unsigned long long>::value, "");
- static_assert(v22 == 1, "");
-
- static constexpr auto v23 = 1llU; // OK.
- static_assert(is_same<decltype(v23), const unsigned long long>::value, "");
- static_assert(v23 == 1, "");
-
- static constexpr auto v24 = 1LLU; // OK.
- static_assert(is_same<decltype(v24), const unsigned long long>::value, "");
- static_assert(v24 == 1, "");
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer-macro.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer-macro.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer-macro.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer-macro.cpp (removed)
@@ -1,27 +0,0 @@
-// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- \
-// RUN: -config="{CheckOptions: [{key: readability-uppercase-literal-suffix.IgnoreMacros, value: 0}]}" \
-// RUN: -- -I %S
-
-void macros() {
-#define INMACRO(X) 1.f
- static constexpr auto m1 = INMACRO();
- // CHECK-NOTES: :[[@LINE-1]]:30: warning: floating point literal has suffix 'f', which is not uppercase
- // CHECK-NOTES: :[[@LINE-3]]:20: note: expanded from macro 'INMACRO'
- // CHECK-FIXES: #define INMACRO(X) 1.f
- // CHECK-FIXES: static constexpr auto m1 = INMACRO();
- // ^ so no fix-its here.
-}
-
-void horrible_macros() {
-#define MAKE_UNSIGNED(x) x##u
-#define ONE MAKE_UNSIGNED(1)
- static constexpr auto hm0 = ONE;
- // CHECK-NOTES: :[[@LINE-1]]:31: warning: integer literal has suffix 'u', which is not uppercase
- // CHECK-NOTES: :[[@LINE-3]]:13: note: expanded from macro 'ONE'
- // CHECK-NOTES: :[[@LINE-5]]:26: note: expanded from macro 'MAKE_UNSIGNED'
- // CHECK-NOTES: note: expanded from here
- // CHECK-FIXES: #define MAKE_UNSIGNED(x) x##u
- // CHECK-FIXES: #define ONE MAKE_UNSIGNED(1)
- // CHECK-FIXES: static constexpr auto hm0 = ONE;
- // Certainly no fix-its.
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer-ms.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer-ms.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer-ms.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer-ms.cpp (removed)
@@ -1,77 +0,0 @@
-// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -target x86_64-pc-linux-gnu -I %S -fms-extensions
-// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
-// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -- -target x86_64-pc-linux-gnu -I %S -fms-extensions
-// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -- -target x86_64-pc-linux-gnu -I %S -fms-extensions
-
-#include "readability-uppercase-literal-suffix.h"
-
-void integer_suffix() {
- static constexpr auto v0 = __LINE__; // synthetic
- static_assert(v0 == 9 || v0 == 5, "");
-
- static constexpr auto v1 = __cplusplus; // synthetic, long
-
- static constexpr auto v2 = 1; // no literal
- static_assert(is_same<decltype(v2), const int>::value, "");
- static_assert(v2 == 1, "");
-
- // i32
-
- static constexpr auto v3 = 1i32;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'i32', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v3 = 1i32;
- // CHECK-MESSAGES-NEXT: ^~
- // CHECK-MESSAGES-NEXT: {{^ *}}I32{{$}}
- // CHECK-FIXES: static constexpr auto v3 = 1I32;
- static_assert(is_same<decltype(v3), const int>::value, "");
- static_assert(v3 == 1I32, "");
-
- static constexpr auto v4 = 1I32; // OK.
- static_assert(is_same<decltype(v4), const int>::value, "");
- static_assert(v4 == 1I32, "");
-
- // i64
-
- static constexpr auto v5 = 1i64;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'i64', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 1i64;
- // CHECK-MESSAGES-NEXT: ^~
- // CHECK-MESSAGES-NEXT: {{^ *}}I64{{$}}
- // CHECK-FIXES: static constexpr auto v5 = 1I64;
- static_assert(is_same<decltype(v5), const long int>::value, "");
- static_assert(v5 == 1I64, "");
-
- static constexpr auto v6 = 1I64; // OK.
- static_assert(is_same<decltype(v6), const long int>::value, "");
- static_assert(v6 == 1I64, "");
-
- // i16
-
- static constexpr auto v7 = 1i16;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'i16', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 1i16;
- // CHECK-MESSAGES-NEXT: ^~
- // CHECK-MESSAGES-NEXT: {{^ *}}I16{{$}}
- // CHECK-FIXES: static constexpr auto v7 = 1I16;
- static_assert(is_same<decltype(v7), const short>::value, "");
- static_assert(v7 == 1I16, "");
-
- static constexpr auto v8 = 1I16; // OK.
- static_assert(is_same<decltype(v8), const short>::value, "");
- static_assert(v8 == 1I16, "");
-
- // i8
-
- static constexpr auto v9 = 1i8;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'i8', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v9 = 1i8;
- // CHECK-MESSAGES-NEXT: ^~
- // CHECK-MESSAGES-NEXT: {{^ *}}I8{{$}}
- // CHECK-FIXES: static constexpr auto v9 = 1I8;
- static_assert(is_same<decltype(v9), const char>::value, "");
- static_assert(v9 == 1I8, "");
-
- static constexpr auto v10 = 1I8; // OK.
- static_assert(is_same<decltype(v10), const char>::value, "");
- static_assert(v10 == 1I8, "");
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp (removed)
@@ -1,272 +0,0 @@
-// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t -- -- -I %S
-// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
-// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -- -I %S
-// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -- -I %S
-
-#include "readability-uppercase-literal-suffix.h"
-
-void integer_suffix() {
- static constexpr auto v0 = __LINE__; // synthetic
- static_assert(v0 == 9 || v0 == 5, "");
-
- static constexpr auto v1 = __cplusplus; // synthetic, long
-
- static constexpr auto v2 = 1; // no literal
- static_assert(is_same<decltype(v2), const int>::value, "");
- static_assert(v2 == 1, "");
-
- // Unsigned
-
- static constexpr auto v3 = 1u;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'u', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v3 = 1u;
- // CHECK-MESSAGES-NEXT: ^~
- // CHECK-MESSAGES-NEXT: {{^ *}}U{{$}}
- // CHECK-FIXES: static constexpr auto v3 = 1U;
- static_assert(is_same<decltype(v3), const unsigned int>::value, "");
- static_assert(v3 == 1, "");
-
- static constexpr auto v4 = 1U; // OK.
- static_assert(is_same<decltype(v4), const unsigned int>::value, "");
- static_assert(v4 == 1, "");
-
- // Long
-
- static constexpr auto v5 = 1l;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'l', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 1l;
- // CHECK-MESSAGES-NEXT: ^~
- // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}}
- // CHECK-FIXES: static constexpr auto v5 = 1L;
- static_assert(is_same<decltype(v5), const long>::value, "");
- static_assert(v5 == 1, "");
-
- static constexpr auto v6 = 1L; // OK.
- static_assert(is_same<decltype(v6), const long>::value, "");
- static_assert(v6 == 1, "");
-
- // Long Long
-
- static constexpr auto v7 = 1ll;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'll', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 1ll;
- // CHECK-MESSAGES-NEXT: ^~~
- // CHECK-MESSAGES-NEXT: {{^ *}}LL{{$}}
- // CHECK-FIXES: static constexpr auto v7 = 1LL;
- static_assert(is_same<decltype(v7), const long long>::value, "");
- static_assert(v7 == 1, "");
-
- static constexpr auto v8 = 1LL; // OK.
- static_assert(is_same<decltype(v8), const long long>::value, "");
- static_assert(v8 == 1, "");
-
- // Unsigned Long
-
- static constexpr auto v9 = 1ul;
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal has suffix 'ul', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v9 = 1ul;
- // CHECK-MESSAGES-NEXT: ^~~
- // CHECK-MESSAGES-NEXT: {{^ *}}UL{{$}}
- // CHECK-FIXES: static constexpr auto v9 = 1UL;
- static_assert(is_same<decltype(v9), const unsigned long>::value, "");
- static_assert(v9 == 1, "");
-
- static constexpr auto v10 = 1uL;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'uL', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v10 = 1uL;
- // CHECK-MESSAGES-NEXT: ^~~
- // CHECK-MESSAGES-NEXT: {{^ *}}UL{{$}}
- // CHECK-FIXES: static constexpr auto v10 = 1UL;
- static_assert(is_same<decltype(v10), const unsigned long>::value, "");
- static_assert(v10 == 1, "");
-
- static constexpr auto v11 = 1Ul;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'Ul', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v11 = 1Ul;
- // CHECK-MESSAGES-NEXT: ^~~
- // CHECK-MESSAGES-NEXT: {{^ *}}UL{{$}}
- // CHECK-FIXES: static constexpr auto v11 = 1UL;
- static_assert(is_same<decltype(v11), const unsigned long>::value, "");
- static_assert(v11 == 1, "");
-
- static constexpr auto v12 = 1UL; // OK.
- static_assert(is_same<decltype(v12), const unsigned long>::value, "");
- static_assert(v12 == 1, "");
-
- // Long Unsigned
-
- static constexpr auto v13 = 1lu;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'lu', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v13 = 1lu;
- // CHECK-MESSAGES-NEXT: ^~~
- // CHECK-MESSAGES-NEXT: {{^ *}}LU{{$}}
- // CHECK-FIXES: static constexpr auto v13 = 1LU;
- static_assert(is_same<decltype(v13), const unsigned long>::value, "");
- static_assert(v13 == 1, "");
-
- static constexpr auto v14 = 1Lu;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'Lu', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v14 = 1Lu;
- // CHECK-MESSAGES-NEXT: ^~~
- // CHECK-MESSAGES-NEXT: {{^ *}}LU{{$}}
- // CHECK-FIXES: static constexpr auto v14 = 1LU;
- static_assert(is_same<decltype(v14), const unsigned long>::value, "");
- static_assert(v14 == 1, "");
-
- static constexpr auto v15 = 1lU;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'lU', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v15 = 1lU;
- // CHECK-MESSAGES-NEXT: ^~~
- // CHECK-MESSAGES-NEXT: {{^ *}}LU{{$}}
- // CHECK-FIXES: static constexpr auto v15 = 1LU;
- static_assert(is_same<decltype(v15), const unsigned long>::value, "");
- static_assert(v15 == 1, "");
-
- static constexpr auto v16 = 1LU; // OK.
- static_assert(is_same<decltype(v16), const unsigned long>::value, "");
- static_assert(v16 == 1, "");
-
- // Unsigned Long Long
-
- static constexpr auto v17 = 1ull;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'ull', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v17 = 1ull;
- // CHECK-MESSAGES-NEXT: ^~~~
- // CHECK-MESSAGES-NEXT: {{^ *}}ULL{{$}}
- // CHECK-FIXES: static constexpr auto v17 = 1ULL;
- static_assert(is_same<decltype(v17), const unsigned long long>::value, "");
- static_assert(v17 == 1, "");
-
- static constexpr auto v18 = 1uLL;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'uLL', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v18 = 1uLL;
- // CHECK-MESSAGES-NEXT: ^~~~
- // CHECK-MESSAGES-NEXT: {{^ *}}ULL{{$}}
- // CHECK-FIXES: static constexpr auto v18 = 1ULL;
- static_assert(is_same<decltype(v18), const unsigned long long>::value, "");
- static_assert(v18 == 1, "");
-
- static constexpr auto v19 = 1Ull;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'Ull', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v19 = 1Ull;
- // CHECK-MESSAGES-NEXT: ^~~~
- // CHECK-MESSAGES-NEXT: {{^ *}}ULL{{$}}
- // CHECK-FIXES: static constexpr auto v19 = 1ULL;
- static_assert(is_same<decltype(v19), const unsigned long long>::value, "");
- static_assert(v19 == 1, "");
-
- static constexpr auto v20 = 1ULL; // OK.
- static_assert(is_same<decltype(v20), const unsigned long long>::value, "");
- static_assert(v20 == 1, "");
-
- // Long Long Unsigned
-
- static constexpr auto v21 = 1llu;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'llu', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v21 = 1llu;
- // CHECK-MESSAGES-NEXT: ^~~~
- // CHECK-MESSAGES-NEXT: {{^ *}}LLU{{$}}
- // CHECK-FIXES: static constexpr auto v21 = 1LLU;
- static_assert(is_same<decltype(v21), const unsigned long long>::value, "");
- static_assert(v21 == 1, "");
-
- static constexpr auto v22 = 1LLu;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'LLu', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v22 = 1LLu;
- // CHECK-MESSAGES-NEXT: ^~~~
- // CHECK-MESSAGES-NEXT: {{^ *}}LLU{{$}}
- // CHECK-FIXES: static constexpr auto v22 = 1LLU;
- static_assert(is_same<decltype(v22), const unsigned long long>::value, "");
- static_assert(v22 == 1, "");
-
- static constexpr auto v23 = 1llU;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'llU', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v23 = 1llU;
- // CHECK-MESSAGES-NEXT: ^~~~
- // CHECK-MESSAGES-NEXT: {{^ *}}LLU{{$}}
- // CHECK-FIXES: static constexpr auto v23 = 1LLU;
- static_assert(is_same<decltype(v23), const unsigned long long>::value, "");
- static_assert(v23 == 1, "");
-
- static constexpr auto v24 = 1LLU; // OK.
- static_assert(is_same<decltype(v24), const unsigned long long>::value, "");
- static_assert(v24 == 1, "");
-}
-
-void integer_complex_suffix() {
- // _Complex, I
-
- static constexpr auto v25 = 1i;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'i', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v25 = 1i;
- // CHECK-MESSAGES-NEXT: ^~
- // CHECK-MESSAGES-NEXT: {{^ *}}I{{$}}
- // CHECK-FIXES: static constexpr auto v25 = 1I;
- static_assert(is_same<decltype(v25), const _Complex int>::value, "");
- static_assert(v25 == 1I, "");
-
- static constexpr auto v26 = 1I; // OK.
- static_assert(is_same<decltype(v26), const _Complex int>::value, "");
- static_assert(v26 == 1I, "");
-
- // _Complex, J
-
- static constexpr auto v27 = 1j;
- // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal has suffix 'j', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto v27 = 1j;
- // CHECK-MESSAGES-NEXT: ^~
- // CHECK-MESSAGES-NEXT: {{^ *}}J{{$}}
- // CHECK-FIXES: static constexpr auto v27 = 1J;
- static_assert(is_same<decltype(v27), const _Complex int>::value, "");
- static_assert(v27 == 1J, "");
-
- static constexpr auto v28 = 1J; // OK.
- static_assert(is_same<decltype(v28), const _Complex int>::value, "");
- static_assert(v28 == 1J, "");
-}
-
-void macros() {
-#define PASSTHROUGH(X) X
- static constexpr auto m0 = PASSTHROUGH(1u);
- // CHECK-MESSAGES: :[[@LINE-1]]:42: warning: integer literal has suffix 'u', which is not uppercase
- // CHECK-MESSAGES-NEXT: static constexpr auto m0 = PASSTHROUGH(1u);
- // CHECK-MESSAGES-NEXT: ^~
- // CHECK-MESSAGES-NEXT: {{^ *}}U{{$}}
- // CHECK-FIXES: static constexpr auto m0 = PASSTHROUGH(1U);
- static_assert(is_same<decltype(m0), const unsigned int>::value, "");
- static_assert(m0 == 1, "");
-
- // This location is inside a macro, no warning on that by default.
-#define MACRO 1u
- int foo = MACRO;
-}
-
-// Check that user-defined literals do not cause any diags.
-
-unsigned long long int operator"" _ull(unsigned long long int);
-void user_defined_literals() {
- 1_ull;
-}
-
-template <unsigned alignment>
-void template_test() {
- static_assert(alignment, "");
-}
-void actual_template_test() {
- template_test<4>();
-}
-
-const int table[6] = {};
-void read_test() {
- for (auto i : table) {
- }
-}
-
-namespace {
-enum a { b };
-constexpr bool operator&(a, a) { return int(); }
-template <a l>
-void c() { l &a(); }
-void d();
-void d() { c<b>(); }
-} // namespace
Removed: clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix.h?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix.h (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-uppercase-literal-suffix.h (removed)
@@ -1,16 +0,0 @@
-template <class T, T v>
-struct integral_constant {
- static constexpr T value = v;
- typedef T value_type;
- typedef integral_constant type; // using injected-class-name
- constexpr operator value_type() const noexcept { return value; }
-};
-
-using false_type = integral_constant<bool, false>;
-using true_type = integral_constant<bool, true>;
-
-template <class T, class U>
-struct is_same : false_type {};
-
-template <class T>
-struct is_same<T, T> : true_type {};
Removed: clang-tools-extra/trunk/test/clang-tidy/run-clang-tidy.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/run-clang-tidy.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/run-clang-tidy.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/run-clang-tidy.cpp (removed)
@@ -1,18 +0,0 @@
-// RUN: %run_clang_tidy --help
-// RUN: rm -rf %t
-// RUN: mkdir %t
-// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c %/t/test.cpp\",\"file\":\"%/t/test.cpp\"}]" | sed -e 's/\\/\\\\/g' > %t/compile_commands.json
-// RUN: echo "Checks: '-*,modernize-use-auto'" > %t/.clang-tidy
-// RUN: echo "WarningsAsErrors: '*'" >> %t/.clang-tidy
-// RUN: echo "CheckOptions:" >> %t/.clang-tidy
-// RUN: echo " - key: modernize-use-auto.MinTypeNameLength" >> %t/.clang-tidy
-// RUN: echo " value: '0'" >> %t/.clang-tidy
-// RUN: cp "%s" "%t/test.cpp"
-// RUN: cd "%t"
-// RUN: not %run_clang_tidy "%t/test.cpp"
-
-int main()
-{
- int* x = new int();
- delete x;
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/select-checks.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/select-checks.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/select-checks.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/select-checks.cpp (removed)
@@ -1,11 +0,0 @@
-// RUN: clang-tidy %s -checks='-*,llvm-namespace-*' -- 2>&1 | FileCheck -implicit-check-not='{{warning:|error:}}' %s
-// RUN: not clang-tidy %s -checks='-*,an-unknown-check' -- 2>&1 | FileCheck -implicit-check-not='{{warning:|error:}}' -check-prefix=CHECK2 %s
-
-// CHECK2: Error: no checks enabled.
-
-namespace i {
-}
-// CHECK: :[[@LINE-1]]:1: warning: namespace 'i' not terminated with a closing comment [llvm-namespace-comment]
-
-// Expect no warnings from the google-explicit-constructor check:
-class A { A(int i); };
Removed: clang-tools-extra/trunk/test/clang-tidy/serialize-diagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/serialize-diagnostics.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/serialize-diagnostics.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/serialize-diagnostics.cpp (removed)
@@ -1,3 +0,0 @@
-// RUN: not clang-tidy -checks=-*,llvm-namespace-comment %s -- -serialize-diagnostics %t | FileCheck %s
-// CHECK: :[[@LINE+1]]:12: error: expected ';' after struct [clang-diagnostic-error]
-struct A {}
Removed: clang-tools-extra/trunk/test/clang-tidy/static-analyzer-config.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/static-analyzer-config.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/static-analyzer-config.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/static-analyzer-config.cpp (removed)
@@ -1,20 +0,0 @@
-// REQUIRES: static-analyzer
-// RUN: clang-tidy %s -checks='-*,clang-analyzer-unix.Malloc' -config='{CheckOptions: [{ key: "clang-analyzer-unix.DynamicMemoryModeling:Optimistic", value: true}]}' -- | FileCheck %s
-typedef __typeof(sizeof(int)) size_t;
-void *malloc(size_t);
-void free(void *);
-void __attribute((ownership_returns(malloc))) *my_malloc(size_t);
-void __attribute((ownership_takes(malloc, 1))) my_free(void *);
-
-void f1() {
- void *p = malloc(12);
- return;
- // CHECK: warning: Potential leak of memory pointed to by 'p' [clang-analyzer-unix.Malloc]
-}
-
-void af2() {
- void *p = my_malloc(12);
- my_free(p);
- free(p);
- // CHECK: warning: Attempt to free released memory [clang-analyzer-unix.Malloc]
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/static-analyzer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/static-analyzer.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/static-analyzer.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/static-analyzer.cpp (removed)
@@ -1,18 +0,0 @@
-// REQUIRES: static-analyzer
-// RUN: clang-tidy %s -checks='-*,clang-analyzer-*' -- | FileCheck %s
-extern void *malloc(unsigned long);
-extern void free(void *);
-
-void f() {
- int *p = new int(42);
- delete p;
- delete p;
- // CHECK: warning: Attempt to free released memory [clang-analyzer-cplusplus.NewDelete]
-}
-
-void g() {
- void *q = malloc(132);
- free(q);
- free(q);
- // CHECK: warning: Attempt to free released memory [clang-analyzer-unix.Malloc]
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/temporaries.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/temporaries.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/temporaries.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/temporaries.cpp (removed)
@@ -1,25 +0,0 @@
-// REQUIRES: static-analyzer
-// RUN: clang-tidy -checks='-*,clang-analyzer-core.NullDereference' %s -- | FileCheck %s
-
-struct NoReturnDtor {
- ~NoReturnDtor() __attribute__((noreturn));
-};
-
-extern bool check(const NoReturnDtor &);
-
-// CHECK-NOT: warning
-void testNullPointerDereferencePositive() {
- int *value = 0;
- // CHECK: [[@LINE+1]]:10: warning: Dereference of null pointer (loaded from variable 'value') [clang-analyzer-core.NullDereference]
- *value = 1;
-}
-
-// CHECK-NOT: warning
-void testNullPointerDereference() {
- int *value = 0;
- if (check(NoReturnDtor())) {
- // This unreachable code causes a warning if analysis of temporary
- // destructors is not enabled.
- *value = 1;
- }
-}
Removed: clang-tools-extra/trunk/test/clang-tidy/validate-check-names.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/validate-check-names.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/validate-check-names.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/validate-check-names.cpp (removed)
@@ -1,2 +0,0 @@
-// Check names may only contain alphanumeric characters, '-', '_', and '.'.
-// RUN: clang-tidy -checks=* -list-checks | grep '^ ' | cut -b5- | not grep -v '^[a-zA-Z0-9_.\-]\+$'
Removed: clang-tools-extra/trunk/test/clang-tidy/vfsoverlay.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/vfsoverlay.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/vfsoverlay.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/vfsoverlay.cpp (removed)
@@ -1,8 +0,0 @@
-// RUN: sed -e "s:INPUT_DIR:%S/Inputs/vfsoverlay:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay/vfsoverlay.yaml > %t.yaml
-// RUN: clang-tidy %s -checks='-*,modernize-use-nullptr' -vfsoverlay %t.yaml -- -I %t | FileCheck %s
-// REQUIRES: shell
-
-#include "not_real.h"
-
-X *ptr = 0;
-// CHECK: warning: use nullptr [modernize-use-nullptr]
Removed: clang-tools-extra/trunk/test/clang-tidy/warnings-as-errors-diagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/warnings-as-errors-diagnostics.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/warnings-as-errors-diagnostics.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/warnings-as-errors-diagnostics.cpp (removed)
@@ -1,18 +0,0 @@
-// RUN: clang-tidy %s -checks='-*,llvm-namespace-comment,clang-diagnostic*' \
-// RUN: -- -Wunused-variable 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-WARN -implicit-check-not='{{warning|error}}:'
-// RUN: not clang-tidy %s -checks='-*,llvm-namespace-comment,clang-diagnostic*' \
-// RUN: -warnings-as-errors='clang-diagnostic*' -- -Wunused-variable 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-WERR -implicit-check-not='{{warning|error}}:'
-// RUN: not clang-tidy %s -checks='-*,llvm-namespace-comment,clang-diagnostic*' \
-// RUN: -warnings-as-errors='clang-diagnostic*' -quiet -- -Wunused-variable 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-WERR-QUIET -implicit-check-not='{{warning|error}}:'
-
-void f() { int i; }
-// CHECK-WARN: warning: unused variable 'i' [clang-diagnostic-unused-variable]
-// CHECK-WERR: error: unused variable 'i' [clang-diagnostic-unused-variable,-warnings-as-errors]
-// CHECK-WERR-QUIET: error: unused variable 'i' [clang-diagnostic-unused-variable,-warnings-as-errors]
-
-// CHECK-WARN-NOT: treated as
-// CHECK-WERR: 1 warning treated as error
-// CHECK-WERR-QUIET-NOT: treated as
Removed: clang-tools-extra/trunk/test/clang-tidy/warnings-as-errors-plural.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/warnings-as-errors-plural.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/warnings-as-errors-plural.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/warnings-as-errors-plural.cpp (removed)
@@ -1,24 +0,0 @@
-// RUN: clang-tidy %s -checks='-*,llvm-namespace-comment,clang-diagnostic*' -- 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-WARN -implicit-check-not='{{warning|error}}:'
-// RUN: not clang-tidy %s -checks='-*,llvm-namespace-comment,clang-diagnostic*' \
-// RUN: -warnings-as-errors='llvm-namespace-comment' -- 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-WERR -implicit-check-not='{{warning|error}}:'
-// RUN: not clang-tidy %s -checks='-*,llvm-namespace-comment,clang-diagnostic*' \
-// RUN: -warnings-as-errors='llvm-namespace-comment' -quiet -- 2>&1 \
-// RUN: | FileCheck %s --check-prefix=CHECK-WERR-QUIET -implicit-check-not='{{warning|error}}:'
-
-namespace j {
-}
-// CHECK-WARN: warning: namespace 'j' not terminated with a closing comment [llvm-namespace-comment]
-// CHECK-WERR: error: namespace 'j' not terminated with a closing comment [llvm-namespace-comment,-warnings-as-errors]
-// CHECK-WERR-QUIET: error: namespace 'j' not terminated with a closing comment [llvm-namespace-comment,-warnings-as-errors]
-
-namespace k {
-}
-// CHECK-WARN: warning: namespace 'k' not terminated with a closing comment [llvm-namespace-comment]
-// CHECK-WERR: error: namespace 'k' not terminated with a closing comment [llvm-namespace-comment,-warnings-as-errors]
-// CHECK-WERR-QUIET: error: namespace 'k' not terminated with a closing comment [llvm-namespace-comment,-warnings-as-errors]
-
-// CHECK-WARN-NOT: treated as
-// CHECK-WERR: 2 warnings treated as errors
-// CHECK-WERR-QUIET-NOT: treated as
Removed: clang-tools-extra/trunk/test/clang-tidy/warnings-as-errors.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/warnings-as-errors.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/warnings-as-errors.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/warnings-as-errors.cpp (removed)
@@ -1,13 +0,0 @@
-// RUN: clang-tidy %s -checks='-*,llvm-namespace-comment' -- 2>&1 | FileCheck %s --check-prefix=CHECK-WARN -implicit-check-not='{{warning|error}}:'
-// RUN: not clang-tidy %s -checks='-*,llvm-namespace-comment' -warnings-as-errors='llvm-namespace-comment' -- 2>&1 | FileCheck %s --check-prefix=CHECK-WERR -implicit-check-not='{{warning|error}}:'
-// RUN: not clang-tidy %s -checks='-*,llvm-namespace-comment' -warnings-as-errors='llvm-namespace-comment' -quiet -- 2>&1 | FileCheck %s --check-prefix=CHECK-WERR-QUIET -implicit-check-not='{{warning|error}}:'
-
-namespace i {
-}
-// CHECK-WARN: warning: namespace 'i' not terminated with a closing comment [llvm-namespace-comment]
-// CHECK-WERR: error: namespace 'i' not terminated with a closing comment [llvm-namespace-comment,-warnings-as-errors]
-// CHECK-WERR-QUIET: error: namespace 'i' not terminated with a closing comment [llvm-namespace-comment,-warnings-as-errors]
-
-// CHECK-WARN-NOT: treated as
-// CHECK-WERR: 1 warning treated as error
-// CHECK-WERR-QUIET-NOT: treated as
Removed: clang-tools-extra/trunk/test/clang-tidy/zircon-temporary-objects.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/zircon-temporary-objects.cpp?rev=374539&view=auto
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/zircon-temporary-objects.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/zircon-temporary-objects.cpp (removed)
@@ -1,108 +0,0 @@
-// RUN: %check_clang_tidy %s zircon-temporary-objects %t -- \
-// RUN: -config="{CheckOptions: [{key: zircon-temporary-objects.Names, value: 'Foo;NS::Bar'}]}" \
-// RUN: -header-filter=.*
-
-// Should flag instances of Foo, NS::Bar.
-
-class Foo {
-public:
- Foo() = default;
- Foo(int Val) : Val(Val){};
-
-private:
- int Val;
-};
-
-namespace NS {
-
-class Bar {
-public:
- Bar() = default;
- Bar(int Val) : Val(Val){};
-
-private:
- int Val;
-};
-
-} // namespace NS
-
-class Bar {
-public:
- Bar() = default;
- Bar(int Val) : Val(Val){};
-
-private:
- int Val;
-};
-
-int func(Foo F) { return 1; };
-
-int main() {
- Foo F;
- Foo *F2 = new Foo();
- new Foo();
- Foo();
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: creating a temporary object of type 'Foo' is prohibited
- Foo F3 = Foo();
- // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: creating a temporary object of type 'Foo' is prohibited
-
- Bar();
- NS::Bar();
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: creating a temporary object of type 'NS::Bar' is prohibited
-
- int A = func(Foo());
- // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: creating a temporary object of type 'Foo' is prohibited
-
- Foo F4(0);
- Foo *F5 = new Foo(0);
- new Foo(0);
- Foo(0);
- // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: creating a temporary object of type 'Foo' is prohibited
- Foo F6 = Foo(0);
- // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: creating a temporary object of type 'Foo' is prohibited
-
- Bar(0);
- NS::Bar(0);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: creating a temporary object of type 'NS::Bar' is prohibited
-
- int B = func(Foo(0));
- // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: creating a temporary object of type 'Foo' is prohibited
-}
-
-namespace NS {
-
-void f() {
- Bar();
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: creating a temporary object of type 'NS::Bar' is prohibited
- Bar(0);
-// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: creating a temporary object of type 'NS::Bar' is prohibited
-}
-
-} // namespace NS
-
-template <typename Ty>
-Ty make_ty() { return Ty(); }
-// CHECK-MESSAGES: :[[@LINE-1]]:23: warning: creating a temporary object of type 'Foo' is prohibited
-// CHECK-MESSAGES: :[[@LINE-2]]:23: warning: creating a temporary object of type 'NS::Bar' is prohibited
-
-void ty_func() {
- make_ty<Bar>();
- make_ty<NS::Bar>();
- make_ty<Foo>();
-}
-
-// Inheriting the disallowed class does not trigger the check.
-
-class Bingo : NS::Bar {}; // Not explicitly disallowed
-
-void f2() {
- Bingo();
-}
-
-template <typename Ty>
-class Quux : Ty {};
-
-void f3() {
- Quux<NS::Bar>();
- Quux<Bar>();
-}
More information about the cfe-commits
mailing list