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 #include "FindBadConstructsConsumer.h" | 5 #include "FindBadConstructsConsumer.h" |
6 | 6 |
7 #include "clang/Frontend/CompilerInstance.h" | 7 #include "clang/Frontend/CompilerInstance.h" |
8 #include "clang/AST/Attr.h" | 8 #include "clang/AST/Attr.h" |
9 #include "clang/Lex/Lexer.h" | 9 #include "clang/Lex/Lexer.h" |
10 #include "llvm/Support/raw_ostream.h" | 10 #include "llvm/Support/raw_ostream.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 diag_note_inheritance_ = | 120 diag_note_inheritance_ = |
121 diagnostic().getCustomDiagID(DiagnosticsEngine::Note, kNoteInheritance); | 121 diagnostic().getCustomDiagID(DiagnosticsEngine::Note, kNoteInheritance); |
122 diag_note_implicit_dtor_ = | 122 diag_note_implicit_dtor_ = |
123 diagnostic().getCustomDiagID(DiagnosticsEngine::Note, kNoteImplicitDtor); | 123 diagnostic().getCustomDiagID(DiagnosticsEngine::Note, kNoteImplicitDtor); |
124 diag_note_public_dtor_ = | 124 diag_note_public_dtor_ = |
125 diagnostic().getCustomDiagID(DiagnosticsEngine::Note, kNotePublicDtor); | 125 diagnostic().getCustomDiagID(DiagnosticsEngine::Note, kNotePublicDtor); |
126 diag_note_protected_non_virtual_dtor_ = diagnostic().getCustomDiagID( | 126 diag_note_protected_non_virtual_dtor_ = diagnostic().getCustomDiagID( |
127 DiagnosticsEngine::Note, kNoteProtectedNonVirtualDtor); | 127 DiagnosticsEngine::Note, kNoteProtectedNonVirtualDtor); |
128 } | 128 } |
129 | 129 |
| 130 bool FindBadConstructsConsumer::VisitDecl(clang::Decl* decl) { |
| 131 clang::TagDecl* tag_decl = dyn_cast<clang::TagDecl>(decl); |
| 132 if (tag_decl && tag_decl->isCompleteDefinition()) |
| 133 CheckTag(tag_decl); |
| 134 return true; |
| 135 } |
| 136 |
130 void FindBadConstructsConsumer::CheckChromeClass(SourceLocation record_location, | 137 void FindBadConstructsConsumer::CheckChromeClass(SourceLocation record_location, |
131 CXXRecordDecl* record) { | 138 CXXRecordDecl* record) { |
132 bool implementation_file = InImplementationFile(record_location); | 139 bool implementation_file = InImplementationFile(record_location); |
133 | 140 |
134 if (!implementation_file) { | 141 if (!implementation_file) { |
135 // Only check for "heavy" constructors/destructors in header files; | 142 // Only check for "heavy" constructors/destructors in header files; |
136 // within implementation files, there is no performance cost. | 143 // within implementation files, there is no performance cost. |
137 CheckCtorDtorWeight(record_location, record); | 144 CheckCtorDtorWeight(record_location, record); |
138 } | 145 } |
139 | 146 |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 // one of those, it means there is at least one member after a factory. | 759 // one of those, it means there is at least one member after a factory. |
753 if (weak_ptr_factory_location.isValid() && | 760 if (weak_ptr_factory_location.isValid() && |
754 !param_is_weak_ptr_factory_to_self) { | 761 !param_is_weak_ptr_factory_to_self) { |
755 diagnostic().Report(weak_ptr_factory_location, | 762 diagnostic().Report(weak_ptr_factory_location, |
756 diag_weak_ptr_factory_order_); | 763 diag_weak_ptr_factory_order_); |
757 } | 764 } |
758 } | 765 } |
759 } | 766 } |
760 | 767 |
761 } // namespace chrome_checker | 768 } // namespace chrome_checker |
OLD | NEW |