21 using namespace clang;
32 : BR(br),
Checker(checker), AC(ac) {}
34 void VisitStmt(
Stmt *
S) { VisitChildren(S); }
35 void VisitChildren(
Stmt *
S);
39 void WalkAST::VisitChildren(
Stmt *
S) {
40 for (
Stmt *Child : S->children())
67 BR.EmitBasicReport(AC->getDecl(),
Checker,
68 "Potential unintended use of sizeof() on pointer type",
70 "The code calls sizeof() on a pointer type. "
71 "This can produce an unexpected result.",
72 ELoc, ArgEx->getSourceRange());
81 class SizeofPointerChecker :
public Checker<check::ASTCodeBody> {
86 walker.Visit(D->getBody());
A (possibly-)qualified type.
bool isArgumentType() const
UnaryExprOrTypeTrait getKind() const
AnalysisDeclContext contains the context data for the function or method under analysis.
const char *const LogicError
AnalysisDeclContext * getAnalysisDeclContext(const Decl *D)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Expr - This represents one expression.
BugReporter is a utility class for generating PathDiagnostics for analysis.
static PathDiagnosticLocation createBegin(const Decl *D, const SourceManager &SM)
Create a location for the beginning of the declaration.
CHECKER * registerChecker()
Used to register checkers.
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
detail::InMemoryDirectory::const_iterator E
QualType getTypeOfArgument() const
Gets the argument type, or the type of the argument expression, whichever is appropriate.
Expr * IgnoreParens() LLVM_READONLY
IgnoreParens - Ignore parentheses.
bool isPointerType() const