Chromium Code Reviews| Index: tools/clang/plugins/ChromeClassTester.h |
| diff --git a/tools/clang/plugins/ChromeClassTester.h b/tools/clang/plugins/ChromeClassTester.h |
| index 5004f56619fbc13543017ccd33f89d53985fab8c..9a72ee416a60ab6cf6f259e7587e192bd71aad32 100644 |
| --- a/tools/clang/plugins/ChromeClassTester.h |
| +++ b/tools/clang/plugins/ChromeClassTester.h |
| @@ -21,8 +21,6 @@ class ChromeClassTester : public clang::ASTConsumer { |
| explicit ChromeClassTester(clang::CompilerInstance& instance); |
| virtual ~ChromeClassTester(); |
| - void BuildBannedLists(); |
| - |
| // ASTConsumer: |
| virtual void HandleTagDeclDefinition(clang::TagDecl* tag); |
| @@ -32,18 +30,24 @@ class ChromeClassTester : public clang::ASTConsumer { |
| // Emits a simple warning; this shouldn't be used if you require printf-style |
| // printing. |
| - void emitWarning(clang::SourceLocation loc, const char* error); |
| - |
| - // Utility method for subclasses to check if testing details are in this |
| - // class. Some tests won't care if a class has a ::testing member and others |
| - // will. |
| - bool InTestingNamespace(const clang::Decl* record); |
| + void emitWarning(const clang::SourceLocation& loc, const char* error); |
| // Utility method for subclasses to check if this class is in a banned |
| // namespace. |
| bool InBannedNamespace(const clang::Decl* record); |
| + // Utility method for subclasses to determine the namespace of the |
| + // specified record, if any. Unnamed namespaces will be identified as |
| + // "<anonymous namespace>". |
| + std::string GetNamespace(const clang::Decl* record); |
| + |
| + // Utility method for subclasses to check if this class is within an |
| + // implementation (.cc, .cpp, .mm) file. |
| + bool InImplementationFile(const clang::SourceLocation& location); |
| + |
| private: |
| + void BuildBannedLists(); |
| + |
| // Filtered versions of tags that are only called with things defined in |
| // chrome header files. |
| virtual void CheckChromeClass(const clang::SourceLocation& record_location, |
| @@ -51,12 +55,16 @@ class ChromeClassTester : public clang::ASTConsumer { |
| // Utility methods used for filtering out non-chrome classes (and ones we |
| // deliberately ignore) in HandleTagDeclDefinition(). |
| - std::string GetNamespace(const clang::Decl* record); |
| std::string GetNamespaceImpl(const clang::DeclContext* context, |
| - std::string candidate); |
| - bool InBannedDirectory(clang::SourceLocation loc); |
| + const std::string& candidate); |
| + bool InBannedDirectory(const clang::SourceLocation& loc); |
|
Nico
2012/04/11 22:27:26
a sourcelocation is an int, passing these by value
|
| bool IsIgnoredType(const std::string& base_name); |
| + // Attempts to determine the filename for the given SourceLocation. |
| + // Returns false if the filename could not be determined. |
| + bool GetFilename(const clang::SourceLocation& loc, |
|
Nico
2012/04/11 22:27:26
ditto
|
| + std::string* filename); |
| + |
| clang::CompilerInstance& instance_; |
| clang::DiagnosticsEngine& diagnostic_; |