| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 // virtual method overrides a method from a base class, only the override | 357 // virtual method overrides a method from a base class, only the override |
| 358 // specifier should be used. If the method should not be overridden by derived | 358 // specifier should be used. If the method should not be overridden by derived |
| 359 // classes, only the final specifier should be used. | 359 // classes, only the final specifier should be used. |
| 360 void FindBadConstructsConsumer::CheckVirtualSpecifiers( | 360 void FindBadConstructsConsumer::CheckVirtualSpecifiers( |
| 361 const CXXMethodDecl* method) { | 361 const CXXMethodDecl* method) { |
| 362 bool is_override = method->size_overridden_methods() > 0; | 362 bool is_override = method->size_overridden_methods() > 0; |
| 363 bool has_virtual = method->isVirtualAsWritten(); | 363 bool has_virtual = method->isVirtualAsWritten(); |
| 364 OverrideAttr* override_attr = method->getAttr<OverrideAttr>(); | 364 OverrideAttr* override_attr = method->getAttr<OverrideAttr>(); |
| 365 FinalAttr* final_attr = method->getAttr<FinalAttr>(); | 365 FinalAttr* final_attr = method->getAttr<FinalAttr>(); |
| 366 | 366 |
| 367 if (method->isPure()) | 367 if (method->isPure() && !options_.strict_virtual_specifiers) |
| 368 return; | 368 return; |
| 369 | 369 |
| 370 if (IsMethodInBannedOrTestingNamespace(method)) | 370 if (IsMethodInBannedOrTestingNamespace(method)) |
| 371 return; | 371 return; |
| 372 | 372 |
| 373 if (isa<CXXDestructorDecl>(method) && !options_.strict_virtual_specifiers) | 373 if (isa<CXXDestructorDecl>(method) && !options_.strict_virtual_specifiers) |
| 374 return; | 374 return; |
| 375 | 375 |
| 376 SourceManager& manager = instance().getSourceManager(); | 376 SourceManager& manager = instance().getSourceManager(); |
| 377 | 377 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 record->getTypeForDecl()->getAsCXXRecordDecl()) { | 743 record->getTypeForDecl()->getAsCXXRecordDecl()) { |
| 744 weak_ptr_factory_location = iter->getLocation(); | 744 weak_ptr_factory_location = iter->getLocation(); |
| 745 } | 745 } |
| 746 } | 746 } |
| 747 } | 747 } |
| 748 } | 748 } |
| 749 } | 749 } |
| 750 } | 750 } |
| 751 | 751 |
| 752 } // namespace chrome_checker | 752 } // namespace chrome_checker |
| OLD | NEW |