Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: tools/clang/plugins/FindBadConstructsConsumer.cpp

Issue 2267713003: clang plugin: Remove check-templates toggle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/clang/plugins/FindBadConstructsAction.cpp ('k') | tools/clang/plugins/Options.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return true; 210 return true;
211 } 211 }
212 212
213 bool FindBadConstructsConsumer::VisitVarDecl(clang::VarDecl* var_decl) { 213 bool FindBadConstructsConsumer::VisitVarDecl(clang::VarDecl* var_decl) {
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).
221 // That was only a mistake; once Chromium code passes these checks, we should
222 // remove the "check-templates" option and remove this code.
223 // See crbug.com/441916
224 if (!options_.check_templates && IsPodOrTemplateType(*record))
225 return;
226
227 bool implementation_file = InImplementationFile(record_location); 220 bool implementation_file = InImplementationFile(record_location);
228 221
229 if (!implementation_file) { 222 if (!implementation_file) {
230 // Only check for "heavy" constructors/destructors in header files; 223 // Only check for "heavy" constructors/destructors in header files;
231 // within implementation files, there is no performance cost. 224 // within implementation files, there is no performance cost.
232 225
233 // If this is a POD or a class template or a type dependent on a 226 // 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 227 // templated class, assume there's no ctor/dtor/virtual method
235 // optimization that we should do. 228 // optimization that we should do.
236 if (!IsPodOrTemplateType(*record)) 229 if (!IsPodOrTemplateType(*record))
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 } 1014 }
1022 } else if (non_reference_type->isPointerType()) { 1015 } else if (non_reference_type->isPointerType()) {
1023 non_reference_type = non_reference_type->getPointeeType(); 1016 non_reference_type = non_reference_type->getPointeeType();
1024 continue; 1017 continue;
1025 } 1018 }
1026 break; 1019 break;
1027 } 1020 }
1028 } 1021 }
1029 1022
1030 } // namespace chrome_checker 1023 } // namespace chrome_checker
OLDNEW
« no previous file with comments | « tools/clang/plugins/FindBadConstructsAction.cpp ('k') | tools/clang/plugins/Options.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698