1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #ifndef TOOLS_CLANG_PLUGINS_CHROMECLASSTESTER_H_
- #define TOOLS_CLANG_PLUGINS_CHROMECLASSTESTER_H_
- #include <set>
- #include <vector>
- #include "Options.h"
- #include "clang/AST/ASTConsumer.h"
- #include "clang/AST/TypeLoc.h"
- #include "clang/Frontend/CompilerInstance.h"
- class ChromeClassTester {
- public:
- ChromeClassTester(clang::CompilerInstance& instance,
- const chrome_checker::Options& options);
- virtual ~ChromeClassTester();
- void CheckTag(clang::TagDecl*);
- clang::DiagnosticsEngine::Level getErrorLevel();
- protected:
- clang::CompilerInstance& instance() { return instance_; }
- clang::DiagnosticsEngine& diagnostic() { return diagnostic_; }
-
-
-
- enum class LocationType {
-
- kChrome,
-
-
- kBlink,
-
-
- kThirdParty,
- };
- LocationType ClassifyLocation(clang::SourceLocation loc);
-
-
- bool HasIgnoredBases(const clang::CXXRecordDecl* record);
-
-
- bool InImplementationFile(clang::SourceLocation location);
-
- const chrome_checker::Options options_;
- private:
- void BuildBannedLists();
-
-
- virtual void CheckChromeClass(LocationType location_type,
- clang::SourceLocation record_location,
- clang::CXXRecordDecl* record) = 0;
-
-
- bool IsIgnoredType(const std::string& base_name);
-
-
- bool GetFilename(clang::SourceLocation loc, std::string* filename);
- clang::CompilerInstance& instance_;
- clang::DiagnosticsEngine& diagnostic_;
-
- std::set<std::string> banned_directories_;
-
- std::set<std::string> ignored_record_names_;
-
- std::set<std::string> ignored_base_classes_;
- };
- #endif
|