clang-tools  3.8.0
Classes | Functions
clang::tidy::misc Namespace Reference

Classes

class  ArgumentCommentCheck
 
class  AssignOperatorSignatureCheck
 Finds declarations of assign operators with the wrong return and/or argument types. More...
 
class  BoolPointerImplicitConversionCheck
 Checks for conditions based on implicit conversion from a bool pointer to bool. More...
 
class  DefinitionsInHeadersCheck
 
class  InaccurateEraseCheck
 Checks for inaccurate use of the erase() method. More...
 
class  InefficientAlgorithmCheck
 Warns on inefficient use of STL algorithms on associative containers. More...
 
class  MacroRepeatedSideEffectsCheck
 Checks for repeated argument with side effects in macros. More...
 
class  MiscModule
 
class  MoveConstantArgumentCheck
 
class  NewDeleteOverloadsCheck
 
class  SwappedArgumentsCheck
 Finds potentially swapped arguments by looking at implicit conversions. More...
 
class  UndelegatedConstructorCheck
 Finds creation of temporary objects in constructors that look like a function call to another constructor of the same class. More...
 
class  UniqueptrResetReleaseCheck
 Find and replace unique_ptr::reset(release()) with std::move(). More...
 
class  UnusedRAIICheck
 Finds temporaries that look like RAII objects. More...
 
class  VirtualNearMissCheck
 Checks for near miss of virtual methods. More...
 

Functions

*that are placed right before
the argument **code *void 
f (bool foo)
 Checks that argument comments match parameter names. More...
 
*** f (true)
 
static bool areTypesCompatible (QualType Left, QualType Right)
 
static const Expr * ignoreNoOpCasts (const Expr *E)
 Look through lvalue to rvalue and nop casts. More...
 
static bool isImplicitCastCandidate (const CastExpr *Cast)
 Restrict the warning to implicit casts that are most likely accidental. More...
 
static StringRef getAsString (const MatchFinder::MatchResult &Result, SourceRange R)
 Get a StringRef representing a SourceRange. More...
 
static bool isOverrideMethod (const CXXMethodDecl *MD)
 Finds out if the given method overrides some method. More...
 
static bool checkOverridingFunctionReturnType (const ASTContext *Context, const CXXMethodDecl *BaseMD, const CXXMethodDecl *DerivedMD)
 Checks whether the return types are covariant, according to C++[class.virtual]p7. More...
 
static bool checkParamTypes (const CXXMethodDecl *BaseMD, const CXXMethodDecl *DerivedMD)
 
static bool checkOverrideWithoutName (const ASTContext *Context, const CXXMethodDecl *BaseMD, const CXXMethodDecl *DerivedMD)
 
static bool checkOverrideByDerivedMethod (const CXXMethodDecl *BaseMD, const CXXMethodDecl *DerivedMD)
 Check whether BaseMD overrides DerivedMD. More...
 
static std::string generateMethodId (const CXXMethodDecl *MD)
 Generate unique ID for given MethodDecl. More...
 

Function Documentation

static bool clang::tidy::misc::areTypesCompatible ( QualType  Left,
QualType  Right 
)
static
static bool clang::tidy::misc::checkOverrideByDerivedMethod ( const CXXMethodDecl *  BaseMD,
const CXXMethodDecl *  DerivedMD 
)
static

Check whether BaseMD overrides DerivedMD.

Prerequisite: the class which BaseMD is in should be a base class of that DerivedMD is in.

Definition at line 163 of file VirtualNearMissCheck.cpp.

References checkParamTypes().

static bool clang::tidy::misc::checkOverrideWithoutName ( const ASTContext *  Context,
const CXXMethodDecl *  BaseMD,
const CXXMethodDecl *  DerivedMD 
)
static
Returns
true if derived method can override base method except for the name.

Definition at line 137 of file VirtualNearMissCheck.cpp.

References checkOverridingFunctionReturnType(), and checkParamTypes().

Referenced by clang::tidy::misc::VirtualNearMissCheck::check().

static bool clang::tidy::misc::checkOverridingFunctionReturnType ( const ASTContext *  Context,
const CXXMethodDecl *  BaseMD,
const CXXMethodDecl *  DerivedMD 
)
static

Checks whether the return types are covariant, according to C++[class.virtual]p7.

Similar with clang::Sema::CheckOverridingFunctionReturnType.

Returns
true if the return types of BaseMD and DerivedMD are covariant.

Check if the return types are covariant. BTy is the class type in return type of BaseMD. For example, B* Base::md() While BRD is the declaration of B.

Definition at line 32 of file VirtualNearMissCheck.cpp.

References Path, and clang::tidy::modernize::PointerType.

Referenced by checkOverrideWithoutName().

static bool clang::tidy::misc::checkParamTypes ( const CXXMethodDecl *  BaseMD,
const CXXMethodDecl *  DerivedMD 
)
static
Returns
true if the param types are the same.

Definition at line 120 of file VirtualNearMissCheck.cpp.

Referenced by checkOverrideByDerivedMethod(), and checkOverrideWithoutName().

* that are placed right before the argument* * code* void clang::tidy::misc::f ( bool  foo)

Checks that argument comments match parameter names.

The check understands argument comments in the form `/*parameter_name=

* * * clang::tidy::misc::f ( true  )
static std::string clang::tidy::misc::generateMethodId ( const CXXMethodDecl *  MD)
static

Generate unique ID for given MethodDecl.

The Id is used as key for 'PossibleMap'. Typical Id: "Base::func void (void)"

Definition at line 178 of file VirtualNearMissCheck.cpp.

static StringRef clang::tidy::misc::getAsString ( const MatchFinder::MatchResult &  Result,
SourceRange  R 
)
static

Get a StringRef representing a SourceRange.

Definition at line 50 of file SwappedArgumentsCheck.cpp.

References SM.

Referenced by clang::tidy::misc::SwappedArgumentsCheck::check().

static const Expr* clang::tidy::misc::ignoreNoOpCasts ( const Expr *  E)
static

Look through lvalue to rvalue and nop casts.

This filters out implicit conversions that have no effect on the input but block our view for other implicit casts.

Definition at line 28 of file SwappedArgumentsCheck.cpp.

Referenced by clang::tidy::misc::SwappedArgumentsCheck::check().

static bool clang::tidy::misc::isImplicitCastCandidate ( const CastExpr *  Cast)
static

Restrict the warning to implicit casts that are most likely accidental.

User defined or integral conversions fit in this category, lvalue to rvalue or derived to base does not.

Definition at line 39 of file SwappedArgumentsCheck.cpp.

Referenced by clang::tidy::misc::SwappedArgumentsCheck::check().

static bool clang::tidy::misc::isOverrideMethod ( const CXXMethodDecl *  MD)
static

Finds out if the given method overrides some method.

Definition at line 23 of file VirtualNearMissCheck.cpp.