Chromium Code Reviews| 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 "clang/Sema/Sema.h" | 10 #include "clang/Sema/Sema.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 CheckVarDecl(var_decl); | 214 CheckVarDecl(var_decl); |
| 215 return true; | 215 return true; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void FindBadConstructsConsumer::CheckChromeClass(SourceLocation record_location, | 218 void FindBadConstructsConsumer::CheckChromeClass(SourceLocation record_location, |
| 219 CXXRecordDecl* record) { | 219 CXXRecordDecl* record) { |
| 220 // By default, the clang checker doesn't check some types (templates, etc). | 220 // By default, the clang checker doesn't check some types (templates, etc). |
| 221 // That was only a mistake; once Chromium code passes these checks, we should | 221 // That was only a mistake; once Chromium code passes these checks, we should |
| 222 // remove the "check-templates" option and remove this code. | 222 // remove the "check-templates" option and remove this code. |
| 223 // See crbug.com/441916 | 223 // See crbug.com/441916 |
| 224 if (!options_.check_templates && IsPodOrTemplateType(*record)) | 224 if (IsPodOrTemplateType(*record)) |
|
hans
2016/08/24 23:33:19
Wait, if options_.check_templates is always true,
| |
| 225 return; | 225 return; |
| 226 | 226 |
| 227 bool implementation_file = InImplementationFile(record_location); | 227 bool implementation_file = InImplementationFile(record_location); |
| 228 | 228 |
| 229 if (!implementation_file) { | 229 if (!implementation_file) { |
| 230 // Only check for "heavy" constructors/destructors in header files; | 230 // Only check for "heavy" constructors/destructors in header files; |
| 231 // within implementation files, there is no performance cost. | 231 // within implementation files, there is no performance cost. |
| 232 | 232 |
| 233 // If this is a POD or a class template or a type dependent on a | 233 // If this is a POD or a class template or a type dependent on a |
| 234 // templated class, assume there's no ctor/dtor/virtual method | 234 // templated class, assume there's no ctor/dtor/virtual method |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1021 } | 1021 } |
| 1022 } else if (non_reference_type->isPointerType()) { | 1022 } else if (non_reference_type->isPointerType()) { |
| 1023 non_reference_type = non_reference_type->getPointeeType(); | 1023 non_reference_type = non_reference_type->getPointeeType(); |
| 1024 continue; | 1024 continue; |
| 1025 } | 1025 } |
| 1026 break; | 1026 break; |
| 1027 } | 1027 } |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 } // namespace chrome_checker | 1030 } // namespace chrome_checker |
| OLD | NEW |