OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This clang plugin checks various invariants of the Blink garbage | 5 // This clang plugin checks various invariants of the Blink garbage |
6 // collection infrastructure. | 6 // collection infrastructure. |
7 // | 7 // |
8 // Errors are described at: | 8 // Errors are described at: |
9 // http://www.chromium.org/developers/blink-gc-plugin-errors | 9 // http://www.chromium.org/developers/blink-gc-plugin-errors |
10 | 10 |
| 11 #include <algorithm> |
| 12 |
11 #include "Config.h" | 13 #include "Config.h" |
12 #include "JsonWriter.h" | 14 #include "JsonWriter.h" |
13 #include "RecordInfo.h" | 15 #include "RecordInfo.h" |
14 | 16 |
15 #include "clang/AST/AST.h" | 17 #include "clang/AST/AST.h" |
16 #include "clang/AST/ASTConsumer.h" | 18 #include "clang/AST/ASTConsumer.h" |
17 #include "clang/AST/RecursiveASTVisitor.h" | 19 #include "clang/AST/RecursiveASTVisitor.h" |
18 #include "clang/Frontend/CompilerInstance.h" | 20 #include "clang/Frontend/CompilerInstance.h" |
19 #include "clang/Frontend/FrontendPluginRegistry.h" | 21 #include "clang/Frontend/FrontendPluginRegistry.h" |
20 #include "clang/Sema/Sema.h" | 22 #include "clang/Sema/Sema.h" |
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 if (info->name().compare(0, SameSizeAs.size(), SameSizeAs) == 0) | 1650 if (info->name().compare(0, SameSizeAs.size(), SameSizeAs) == 0) |
1649 return true; | 1651 return true; |
1650 return options_.ignored_classes.find(info->name()) != | 1652 return options_.ignored_classes.find(info->name()) != |
1651 options_.ignored_classes.end(); | 1653 options_.ignored_classes.end(); |
1652 } | 1654 } |
1653 | 1655 |
1654 bool InIgnoredDirectory(RecordInfo* info) { | 1656 bool InIgnoredDirectory(RecordInfo* info) { |
1655 string filename; | 1657 string filename; |
1656 if (!GetFilename(info->record()->getLocStart(), &filename)) | 1658 if (!GetFilename(info->record()->getLocStart(), &filename)) |
1657 return false; // TODO: should we ignore non-existing file locations? | 1659 return false; // TODO: should we ignore non-existing file locations? |
| 1660 #if defined(LLVM_ON_WIN32) |
| 1661 std::replace(filename.begin(), filename.end(), '\\', '/'); |
| 1662 #endif |
1658 std::vector<string>::iterator it = options_.ignored_directories.begin(); | 1663 std::vector<string>::iterator it = options_.ignored_directories.begin(); |
1659 for (; it != options_.ignored_directories.end(); ++it) | 1664 for (; it != options_.ignored_directories.end(); ++it) |
1660 if (filename.find(*it) != string::npos) | 1665 if (filename.find(*it) != string::npos) |
1661 return true; | 1666 return true; |
1662 return false; | 1667 return false; |
1663 } | 1668 } |
1664 | 1669 |
1665 bool InCheckedNamespace(RecordInfo* info) { | 1670 bool InCheckedNamespace(RecordInfo* info) { |
1666 if (!info) | 1671 if (!info) |
1667 return false; | 1672 return false; |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2099 | 2104 |
2100 private: | 2105 private: |
2101 BlinkGCPluginOptions options_; | 2106 BlinkGCPluginOptions options_; |
2102 }; | 2107 }; |
2103 | 2108 |
2104 } // namespace | 2109 } // namespace |
2105 | 2110 |
2106 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( | 2111 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( |
2107 "blink-gc-plugin", | 2112 "blink-gc-plugin", |
2108 "Check Blink GC invariants"); | 2113 "Check Blink GC invariants"); |
OLD | NEW |