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> {
bool isArgumentType() const
UnaryExprOrTypeTrait getKind() const
const char *const LogicError
AnalysisDeclContext * getAnalysisDeclContext(const Decl *D)
static PathDiagnosticLocation createBegin(const Decl *D, const SourceManager &SM)
Create a location for the beginning of the declaration.
CHECKER * registerChecker()
Used to register checkers.
virtual Stmt * getBody() const
QualType getTypeOfArgument() const
Expr * IgnoreParens() LLVM_READONLY
bool isPointerType() const