OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file defines a bunch of recurring problems in the Chromium C++ code. | 5 // This file defines a bunch of recurring problems in the Chromium C++ code. |
6 // | 6 // |
7 // Checks that are implemented: | 7 // Checks that are implemented: |
8 // - Constructors/Destructors should not be inlined if they are of a complex | 8 // - Constructors/Destructors should not be inlined if they are of a complex |
9 // class type. | 9 // class type. |
10 // - Missing "virtual" keywords on methods that should be virtual. | 10 // - Missing "virtual" keywords on methods that should be virtual. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 void CheckVirtualBodies(const clang::CXXMethodDecl* method); | 64 void CheckVirtualBodies(const clang::CXXMethodDecl* method); |
65 | 65 |
66 void CountType(const clang::Type* type, | 66 void CountType(const clang::Type* type, |
67 int* trivial_member, | 67 int* trivial_member, |
68 int* non_trivial_member, | 68 int* non_trivial_member, |
69 int* templated_non_trivial_member); | 69 int* templated_non_trivial_member); |
70 | 70 |
71 static RefcountIssue CheckRecordForRefcountIssue( | 71 static RefcountIssue CheckRecordForRefcountIssue( |
72 const clang::CXXRecordDecl* record, | 72 const clang::CXXRecordDecl* record, |
73 clang::SourceLocation& loc); | 73 clang::SourceLocation& loc); |
74 clang::DiagnosticsEngine::Level getErrorLevel(); | |
75 static bool IsRefCountedCallback(const clang::CXXBaseSpecifier* base, | 74 static bool IsRefCountedCallback(const clang::CXXBaseSpecifier* base, |
76 clang::CXXBasePath& path, | 75 clang::CXXBasePath& path, |
77 void* user_data); | 76 void* user_data); |
78 static bool HasPublicDtorCallback(const clang::CXXBaseSpecifier* base, | 77 static bool HasPublicDtorCallback(const clang::CXXBaseSpecifier* base, |
79 clang::CXXBasePath& path, | 78 clang::CXXBasePath& path, |
80 void* user_data); | 79 void* user_data); |
81 void PrintInheritanceChain(const clang::CXXBasePath& path); | 80 void PrintInheritanceChain(const clang::CXXBasePath& path); |
82 unsigned DiagnosticForIssue(RefcountIssue issue); | 81 unsigned DiagnosticForIssue(RefcountIssue issue); |
83 void CheckRefCountedDtors(clang::SourceLocation record_location, | 82 void CheckRefCountedDtors(clang::SourceLocation record_location, |
84 clang::CXXRecordDecl* record); | 83 clang::CXXRecordDecl* record); |
85 | 84 |
86 void CheckWeakPtrFactoryMembers(clang::SourceLocation record_location, | 85 void CheckWeakPtrFactoryMembers(clang::SourceLocation record_location, |
87 clang::CXXRecordDecl* record); | 86 clang::CXXRecordDecl* record); |
88 | 87 |
89 const Options options_; | |
90 | |
91 unsigned diag_method_requires_override_; | 88 unsigned diag_method_requires_override_; |
92 unsigned diag_redundant_virtual_specifier_; | 89 unsigned diag_redundant_virtual_specifier_; |
93 unsigned diag_base_method_virtual_and_final_; | 90 unsigned diag_base_method_virtual_and_final_; |
94 unsigned diag_no_explicit_dtor_; | 91 unsigned diag_no_explicit_dtor_; |
95 unsigned diag_public_dtor_; | 92 unsigned diag_public_dtor_; |
96 unsigned diag_protected_non_virtual_dtor_; | 93 unsigned diag_protected_non_virtual_dtor_; |
97 unsigned diag_weak_ptr_factory_order_; | 94 unsigned diag_weak_ptr_factory_order_; |
98 unsigned diag_bad_enum_last_value_; | 95 unsigned diag_bad_enum_last_value_; |
99 unsigned diag_note_inheritance_; | 96 unsigned diag_note_inheritance_; |
100 unsigned diag_note_implicit_dtor_; | 97 unsigned diag_note_implicit_dtor_; |
101 unsigned diag_note_public_dtor_; | 98 unsigned diag_note_public_dtor_; |
102 unsigned diag_note_protected_non_virtual_dtor_; | 99 unsigned diag_note_protected_non_virtual_dtor_; |
103 }; | 100 }; |
104 | 101 |
105 } // namespace chrome_checker | 102 } // namespace chrome_checker |
OLD | NEW |