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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 void CheckVirtualBodies(const clang::CXXMethodDecl* method); | 78 void CheckVirtualBodies(const clang::CXXMethodDecl* method); |
79 | 79 |
80 void CountType(const clang::Type* type, | 80 void CountType(const clang::Type* type, |
81 int* trivial_member, | 81 int* trivial_member, |
82 int* non_trivial_member, | 82 int* non_trivial_member, |
83 int* templated_non_trivial_member); | 83 int* templated_non_trivial_member); |
84 | 84 |
85 static RefcountIssue CheckRecordForRefcountIssue( | 85 static RefcountIssue CheckRecordForRefcountIssue( |
86 const clang::CXXRecordDecl* record, | 86 const clang::CXXRecordDecl* record, |
87 clang::SourceLocation& loc); | 87 clang::SourceLocation& loc); |
88 static bool IsRefCountedCallback(const clang::CXXBaseSpecifier* base, | 88 bool IsRefCounted(const clang::CXXBaseSpecifier* base, |
89 clang::CXXBasePath& path, | 89 clang::CXXBasePath& path); |
90 void* user_data); | |
91 static bool HasPublicDtorCallback(const clang::CXXBaseSpecifier* base, | 90 static bool HasPublicDtorCallback(const clang::CXXBaseSpecifier* base, |
92 clang::CXXBasePath& path, | 91 clang::CXXBasePath& path, |
93 void* user_data); | 92 void* user_data); |
94 void PrintInheritanceChain(const clang::CXXBasePath& path); | 93 void PrintInheritanceChain(const clang::CXXBasePath& path); |
95 unsigned DiagnosticForIssue(RefcountIssue issue); | 94 unsigned DiagnosticForIssue(RefcountIssue issue); |
96 void CheckRefCountedDtors(clang::SourceLocation record_location, | 95 void CheckRefCountedDtors(clang::SourceLocation record_location, |
97 clang::CXXRecordDecl* record); | 96 clang::CXXRecordDecl* record); |
98 | 97 |
99 void CheckWeakPtrFactoryMembers(clang::SourceLocation record_location, | 98 void CheckWeakPtrFactoryMembers(clang::SourceLocation record_location, |
100 clang::CXXRecordDecl* record); | 99 clang::CXXRecordDecl* record); |
101 | 100 |
102 unsigned diag_method_requires_override_; | 101 unsigned diag_method_requires_override_; |
103 unsigned diag_redundant_virtual_specifier_; | 102 unsigned diag_redundant_virtual_specifier_; |
104 unsigned diag_base_method_virtual_and_final_; | 103 unsigned diag_base_method_virtual_and_final_; |
105 unsigned diag_no_explicit_dtor_; | 104 unsigned diag_no_explicit_dtor_; |
106 unsigned diag_public_dtor_; | 105 unsigned diag_public_dtor_; |
107 unsigned diag_protected_non_virtual_dtor_; | 106 unsigned diag_protected_non_virtual_dtor_; |
108 unsigned diag_weak_ptr_factory_order_; | 107 unsigned diag_weak_ptr_factory_order_; |
109 unsigned diag_bad_enum_last_value_; | 108 unsigned diag_bad_enum_last_value_; |
110 unsigned diag_note_inheritance_; | 109 unsigned diag_note_inheritance_; |
111 unsigned diag_note_implicit_dtor_; | 110 unsigned diag_note_implicit_dtor_; |
112 unsigned diag_note_public_dtor_; | 111 unsigned diag_note_public_dtor_; |
113 unsigned diag_note_protected_non_virtual_dtor_; | 112 unsigned diag_note_protected_non_virtual_dtor_; |
114 }; | 113 }; |
115 | 114 |
116 } // namespace chrome_checker | 115 } // namespace chrome_checker |
117 | 116 |
118 #endif // TOOLS_CLANG_PLUGINS_FINDBADCONSTRUCTSCONSUMER_H_ | 117 #endif // TOOLS_CLANG_PLUGINS_FINDBADCONSTRUCTSCONSUMER_H_ |
OLD | NEW |