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

Unified Diff: tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp

Issue 133463002: Stub clang plugin to check consistency of the Blink GC infrastructure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reverted gyp setup restructuring Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/clang/blink_gc_plugin/Makefile » ('j') | tools/clang/scripts/update.sh » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp
diff --git a/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp b/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4cae14a8e8af6d2cab0c7b7c046f30fa606f7bba
--- /dev/null
+++ b/tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp
@@ -0,0 +1,71 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This clang plugin checks various invariants of the Blink garbage
+// collection infrastructure.
+//
+// Checks that are implemented:
+// [currently none]
+
+#include "clang/AST/AST.h"
+#include "clang/AST/ASTConsumer.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/FrontendPluginRegistry.h"
+
+using namespace clang;
+using std::string;
+
+namespace {
+
+struct BlinkGCPluginOptions {
+ BlinkGCPluginOptions() {
+ }
+};
+
+// Main class containing checks for various invariants of the Blink
+// garbage collection infrastructure.
+class BlinkGCPluginConsumer : public ASTConsumer {
+ public:
+ BlinkGCPluginConsumer(CompilerInstance& instance,
+ const BlinkGCPluginOptions& options) {
+ }
+
+ virtual void HandleTranslationUnit(ASTContext& context) {
+ // FIXME: implement consistency checks.
+ }
+};
+
+
+class BlinkGCPluginAction : public PluginASTAction {
+ public:
+ BlinkGCPluginAction() {
+ }
+
+ protected:
+ // Overridden from PluginASTAction:
+ virtual ASTConsumer* CreateASTConsumer(CompilerInstance& instance,
+ llvm::StringRef ref) {
+ return new BlinkGCPluginConsumer(instance, options_);
+ }
+
+ virtual bool ParseArgs(const CompilerInstance& instance,
+ const std::vector<string>& args) {
+ bool parsed = true;
+
+ for (size_t i = 0; i < args.size() && parsed; ++i) {
+ parsed = false;
+ llvm::errs() << "Unknown blink-gc-plugin argument: " << args[i] << "\n";
+ }
+
+ return parsed;
+ }
+
+ private:
+ BlinkGCPluginOptions options_;
+};
+
+} // namespace
+
+static FrontendPluginRegistry::Add<BlinkGCPluginAction>
+X("blink-gc-plugin", "Check Blink GC invariants");
« no previous file with comments | « no previous file | tools/clang/blink_gc_plugin/Makefile » ('j') | tools/clang/scripts/update.sh » ('J')

Powered by Google App Engine
This is Rietveld 408576698