clang-tools 19.0.0git
Namespaces | Functions
BranchCloneCheck.cpp File Reference
#include "BranchCloneCheck.h"
#include "../utils/ASTUtils.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Analysis/CloneDetection.h"
#include "clang/Lex/Lexer.h"
#include "llvm/Support/Casting.h"

Go to the source code of this file.

Namespaces

namespace  clang
 ===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
 
namespace  clang::tidy
 
namespace  clang::tidy::bugprone
 

Functions

static bool areSwitchBranchesIdentical (const SwitchBranch &LHS, const SwitchBranch &RHS, const ASTContext &Context)
 Determines if the bodies of two branches in a switch statements are Type I clones of each other.
 
static bool isFallthroughSwitchBranch (const SwitchBranch &Branch)
 

Function Documentation

◆ areSwitchBranchesIdentical()

static bool areSwitchBranchesIdentical ( const SwitchBranch &  LHS,
const SwitchBranch &  RHS,
const ASTContext &  Context 
)
static

Determines if the bodies of two branches in a switch statements are Type I clones of each other.

This function only examines the body of the branch and ignores the case X: or default: at the start of the branch.

Definition at line 30 of file BranchCloneCheck.cpp.

References clang::tidy::utils::areStatementsIdentical().

Referenced by clang::tidy::bugprone::BranchCloneCheck::check().

◆ isFallthroughSwitchBranch()

static bool isFallthroughSwitchBranch ( const SwitchBranch &  Branch)
static

Definition at line 50 of file BranchCloneCheck.cpp.

References Decl.

Referenced by clang::tidy::bugprone::BranchCloneCheck::check().