123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- #ifndef TOOLS_CLANG_PLUGINS_CHECKIPC_VISITOR_H_
- #define TOOLS_CLANG_PLUGINS_CHECKIPC_VISITOR_H_
- #include <vector>
- #include "clang/AST/AST.h"
- #include "clang/AST/ASTConsumer.h"
- #include "clang/AST/RecursiveASTVisitor.h"
- #include "clang/Frontend/CompilerInstance.h"
- #include "llvm/ADT/StringSet.h"
- namespace chrome_checker {
- class CheckIPCVisitor {
- public:
- explicit CheckIPCVisitor(clang::CompilerInstance& compiler);
- void set_context(clang::ASTContext* context) { context_ = context; }
- void BeginDecl(clang::Decl* decl);
- void EndDecl();
- void VisitTemplateSpecializationType(
- clang::TemplateSpecializationType* spec);
- void VisitCallExpr(clang::CallExpr* call_expr);
- private:
-
-
-
- bool ValidateWriteParam(const clang::CallExpr* call_expr);
- bool ValidateWriteParamSignature(const clang::CallExpr* call_expr);
- bool ValidateWriteParamArgument(const clang::Expr* arg_expr);
- bool ValidateCheckedTuple(
- const clang::TemplateSpecializationType* spec);
- template <typename T>
- const T* GetParentDecl() const;
- bool IsBlacklistedType(clang::QualType type) const;
- bool IsBlacklistedTypedef(const clang::TypedefNameDecl* tdef) const;
- struct CheckDetails {
- clang::QualType entry_type;
- clang::QualType exit_type;
- llvm::SmallVector<const clang::TypedefType*, 5> typedefs;
- };
- bool CheckType(clang::QualType type, CheckDetails* details) const;
- bool CheckIntegerType(clang::QualType type, CheckDetails* details) const;
- bool CheckTemplateArgument(const clang::TemplateArgument& arg,
- CheckDetails* details) const;
- void ReportCheckError(const CheckDetails& details,
- clang::SourceLocation loc,
- unsigned error);
- clang::CompilerInstance& compiler_;
- clang::ASTContext* context_;
- unsigned error_write_param_bad_type_;
- unsigned error_tuple_bad_type_;
- unsigned error_write_param_bad_signature_;
- unsigned note_see_here_;
- std::vector<const clang::Decl*> decl_stack_;
- llvm::StringSet<> blacklisted_typedefs_;
- };
- }
- #endif
|