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/Lex/Lexer.h" | 8 #include "clang/Lex/Lexer.h" |
9 #include "llvm/Support/raw_ostream.h" | 9 #include "llvm/Support/raw_ostream.h" |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void FindBadConstructsConsumer::CheckChromeClass(SourceLocation record_location, | 94 void FindBadConstructsConsumer::CheckChromeClass(SourceLocation record_location, |
95 CXXRecordDecl* record) { | 95 CXXRecordDecl* record) { |
96 bool implementation_file = InImplementationFile(record_location); | 96 bool implementation_file = InImplementationFile(record_location); |
97 | 97 |
98 if (!implementation_file) { | 98 if (!implementation_file) { |
99 // Only check for "heavy" constructors/destructors in header files; | 99 // Only check for "heavy" constructors/destructors in header files; |
100 // within implementation files, there is no performance cost. | 100 // within implementation files, there is no performance cost. |
101 CheckCtorDtorWeight(record_location, record); | 101 CheckCtorDtorWeight(record_location, record); |
102 } | 102 } |
103 | 103 |
104 if (!implementation_file || options_.check_virtuals_in_implementations) { | 104 bool warn_on_inline_bodies = !implementation_file; |
105 bool warn_on_inline_bodies = !implementation_file; | |
106 | 105 |
107 // Check that all virtual methods are marked accordingly with both | 106 // Check that all virtual methods are marked accordingly with both |
108 // virtual and OVERRIDE. | 107 // virtual and OVERRIDE. |
109 CheckVirtualMethods(record_location, record, warn_on_inline_bodies); | 108 CheckVirtualMethods(record_location, record, warn_on_inline_bodies); |
110 } | |
111 | 109 |
112 CheckRefCountedDtors(record_location, record); | 110 CheckRefCountedDtors(record_location, record); |
113 | 111 |
114 if (options_.check_weak_ptr_factory_order) | 112 if (options_.check_weak_ptr_factory_order) |
115 CheckWeakPtrFactoryMembers(record_location, record); | 113 CheckWeakPtrFactoryMembers(record_location, record); |
116 } | 114 } |
117 | 115 |
118 void FindBadConstructsConsumer::CheckChromeEnum(SourceLocation enum_location, | 116 void FindBadConstructsConsumer::CheckChromeEnum(SourceLocation enum_location, |
119 EnumDecl* enum_decl) { | 117 EnumDecl* enum_decl) { |
120 if (!options_.check_enum_last_value) | 118 if (!options_.check_enum_last_value) |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 record->getTypeForDecl()->getAsCXXRecordDecl()) { | 676 record->getTypeForDecl()->getAsCXXRecordDecl()) { |
679 weak_ptr_factory_location = iter->getLocation(); | 677 weak_ptr_factory_location = iter->getLocation(); |
680 } | 678 } |
681 } | 679 } |
682 } | 680 } |
683 } | 681 } |
684 } | 682 } |
685 } | 683 } |
686 | 684 |
687 } // namespace chrome_checker | 685 } // namespace chrome_checker |
OLD | NEW |