31 : BR(br),
Checker(checker), AC(ac) {}
33 void VisitStmt(
Stmt *S) { VisitChildren(S); }
34 void VisitChildren(
Stmt *S);
38void WalkAST::VisitChildren(
Stmt *S) {
39 for (
Stmt *Child : S->children())
46 if (E->
getKind() != UETT_SizeOf)
66 BR.EmitBasicReport(AC->getDecl(),
Checker,
67 "Potential unintended use of sizeof() on pointer type",
69 "The code calls sizeof() on a pointer type. "
70 "This can produce an unexpected result.",
80class SizeofPointerChecker :
public Checker<check::ASTCodeBody> {
94bool ento::shouldRegisterSizeofPointerChecker(
const CheckerManager &mgr) {
AnalysisDeclContext contains the context data for the function, method or block under analysis.
Decl - This represents one declaration (or definition), e.g.
virtual Stmt * getBody() const
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
This represents one expression.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
A (possibly-)qualified type.
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Stmt - This represents one statement.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
bool isPointerType() const
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
QualType getTypeOfArgument() const
Gets the argument type, or the type of the argument expression, whichever is appropriate.
bool isArgumentType() const
UnaryExprOrTypeTrait getKind() const
AnalysisDeclContext * getAnalysisDeclContext(const Decl *D)
BugReporter is a utility class for generating PathDiagnostics for analysis.
CHECKER * registerChecker(AT &&... Args)
Used to register checkers.
static PathDiagnosticLocation createBegin(const Decl *D, const SourceManager &SM)
Create a location for the beginning of the declaration.
const char *const LogicError