| 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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 (*non_trivial_member)++; | 646 (*non_trivial_member)++; |
| 647 break; | 647 break; |
| 648 } | 648 } |
| 649 case Type::TemplateSpecialization: { | 649 case Type::TemplateSpecialization: { |
| 650 TemplateName name = | 650 TemplateName name = |
| 651 dyn_cast<TemplateSpecializationType>(type)->getTemplateName(); | 651 dyn_cast<TemplateSpecializationType>(type)->getTemplateName(); |
| 652 bool whitelisted_template = false; | 652 bool whitelisted_template = false; |
| 653 | 653 |
| 654 // HACK: I'm at a loss about how to get the syntax checker to get | 654 // HACK: I'm at a loss about how to get the syntax checker to get |
| 655 // whether a template is externed or not. For the first pass here, | 655 // whether a template is externed or not. For the first pass here, |
| 656 // just do simple string comparisons. | 656 // just do retarded string comparisons. |
| 657 // | |
| 658 // The check for "atomic_int" is a quick hack; The real fix will be to | |
| 659 // check the class after template instantiation. TODO(dcheng): Do the real | |
| 660 // fix. https://bugs.chromium.org/p/chromium/issues/detail?id=663463 | |
| 661 if (TemplateDecl* decl = name.getAsTemplateDecl()) { | 657 if (TemplateDecl* decl = name.getAsTemplateDecl()) { |
| 662 std::string base_name = decl->getNameAsString(); | 658 std::string base_name = decl->getNameAsString(); |
| 663 if (base_name == "basic_string" || base_name == "atomic_int") | 659 if (base_name == "basic_string") |
| 664 whitelisted_template = true; | 660 whitelisted_template = true; |
| 665 } | 661 } |
| 666 | 662 |
| 667 if (whitelisted_template) | 663 if (whitelisted_template) |
| 668 (*non_trivial_member)++; | 664 (*non_trivial_member)++; |
| 669 else | 665 else |
| 670 (*templated_non_trivial_member)++; | 666 (*templated_non_trivial_member)++; |
| 671 break; | 667 break; |
| 672 } | 668 } |
| 673 case Type::Elaborated: { | 669 case Type::Elaborated: { |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 } | 1014 } |
| 1019 } else if (non_reference_type->isPointerType()) { | 1015 } else if (non_reference_type->isPointerType()) { |
| 1020 non_reference_type = non_reference_type->getPointeeType(); | 1016 non_reference_type = non_reference_type->getPointeeType(); |
| 1021 continue; | 1017 continue; |
| 1022 } | 1018 } |
| 1023 break; | 1019 break; |
| 1024 } | 1020 } |
| 1025 } | 1021 } |
| 1026 | 1022 |
| 1027 } // namespace chrome_checker | 1023 } // namespace chrome_checker |
| OLD | NEW |