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 |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 DiagnosticsEngine::Note, kBaseRequiresFinalizationNote); | 854 DiagnosticsEngine::Note, kBaseRequiresFinalizationNote); |
855 diag_field_requires_finalization_note_ = diagnostic_.getCustomDiagID( | 855 diag_field_requires_finalization_note_ = diagnostic_.getCustomDiagID( |
856 DiagnosticsEngine::Note, kFieldRequiresFinalizationNote); | 856 DiagnosticsEngine::Note, kFieldRequiresFinalizationNote); |
857 diag_overridden_non_virtual_trace_note_ = diagnostic_.getCustomDiagID( | 857 diag_overridden_non_virtual_trace_note_ = diagnostic_.getCustomDiagID( |
858 DiagnosticsEngine::Note, kOverriddenNonVirtualTraceNote); | 858 DiagnosticsEngine::Note, kOverriddenNonVirtualTraceNote); |
859 diag_manual_dispatch_method_note_ = diagnostic_.getCustomDiagID( | 859 diag_manual_dispatch_method_note_ = diagnostic_.getCustomDiagID( |
860 DiagnosticsEngine::Note, kManualDispatchMethodNote); | 860 DiagnosticsEngine::Note, kManualDispatchMethodNote); |
861 } | 861 } |
862 | 862 |
863 void HandleTranslationUnit(ASTContext& context) override { | 863 void HandleTranslationUnit(ASTContext& context) override { |
| 864 // Don't run the plugin if the compilation unit is already invalid. |
| 865 if (diagnostic_.hasErrorOccurred()) |
| 866 return; |
| 867 |
864 CollectVisitor visitor; | 868 CollectVisitor visitor; |
865 visitor.TraverseDecl(context.getTranslationUnitDecl()); | 869 visitor.TraverseDecl(context.getTranslationUnitDecl()); |
866 | 870 |
867 if (options_.dump_graph) { | 871 if (options_.dump_graph) { |
868 std::error_code err; | 872 std::error_code err; |
869 // TODO: Make createDefaultOutputFile or a shorter createOutputFile work. | 873 // TODO: Make createDefaultOutputFile or a shorter createOutputFile work. |
870 json_ = JsonWriter::from(instance_.createOutputFile( | 874 json_ = JsonWriter::from(instance_.createOutputFile( |
871 "", // OutputPath | 875 "", // OutputPath |
872 err, // Errors | 876 err, // Errors |
873 true, // Binary | 877 true, // Binary |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1875 | 1879 |
1876 private: | 1880 private: |
1877 BlinkGCPluginOptions options_; | 1881 BlinkGCPluginOptions options_; |
1878 }; | 1882 }; |
1879 | 1883 |
1880 } // namespace | 1884 } // namespace |
1881 | 1885 |
1882 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( | 1886 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( |
1883 "blink-gc-plugin", | 1887 "blink-gc-plugin", |
1884 "Check Blink GC invariants"); | 1888 "Check Blink GC invariants"); |
OLD | NEW |