llvm/clang/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp

//=== CastToStructChecker.cpp ----------------------------------*- C++ -*--===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This files defines CastToStructChecker, a builtin checker that checks for
// cast from non-struct pointer to struct pointer and widening struct data cast.
// This check corresponds to CWE-588.
//
//===----------------------------------------------------------------------===//

#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"

usingnamespaceclang;
usingnamespaceento;

namespace {
class CastToStructVisitor : public RecursiveASTVisitor<CastToStructVisitor> {};
}

bool CastToStructVisitor::VisitCastExpr(const CastExpr *CE) {}

namespace {
class CastToStructChecker : public Checker<check::ASTCodeBody> {};
} // end anonymous namespace

void ento::registerCastToStructChecker(CheckerManager &mgr) {}

bool ento::shouldRegisterCastToStructChecker(const CheckerManager &mgr) {}