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

Side by Side Diff: tools/clang/BindMigrate/Transform.h

Issue 7886056: Clang plugin that rewrites PostTask(_, NewRunnableMethod(...)) to PostTask(_, base::Bind(...)); (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix lifetime issue where BindMigrateAction is deleted before the ASTConsumer is finished. Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/clang/BindMigrate/README.chromium ('k') | tools/clang/BindMigrate/Transform.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <set>
6 #include <string>
7 #include <vector>
8
9 #include "clang/AST/RecursiveASTVisitor.h"
10
11 #include "Util.h"
12
13 #ifndef TOOLS_CLANG_BINDMIGRATE_TRANSFORM_H_
14 #define TOOLS_CLANG_BINDMIGRATE_TRANSFORM_H_
15
16 namespace clang {
17
18 class Stmt;
19 class Decl;
20 class Type;
21
22 class Transform {
23 public:
24 typedef std::vector<Transform*> TransformList;
25
26 virtual bool WouldTransformStmt(Stmt* statement) { return false; }
27 virtual bool WouldTransformDecl(Decl* decl) { return false; }
28 virtual bool WouldTransformType(Type* type) { return false; }
29
30 virtual void TransformStmt(Stmt *statement) {}
31 virtual void TransformDecl(Decl *decl) {}
32 virtual void TransformType(Type* type) {}
33 };
34
35 class TransformApplier : public RecursiveASTVisitor<TransformApplier> {
36 public:
37 // The transforms must outlive the TransformApplier;
38 TransformApplier(const Transform::TransformList& transforms);
39
40 virtual bool VisitStmt(Stmt *statement);
41 virtual bool VisitDecl(Decl *decl);
42 virtual bool VisitType(Type* type);
43
44 private:
45 std::vector<Transform*> transforms_;
46 };
47
48 class TransformCandidatePrinter :
49 public RecursiveASTVisitor<TransformCandidatePrinter> {
50 public:
51 // The transforms must outlive the TransformCandidatePrinter;
52 TransformCandidatePrinter(const Transform::TransformList& transforms,
53 SourceManager* source_manager);
54 virtual ~TransformCandidatePrinter();
55
56 virtual bool VisitStmt(Stmt *statement);
57 virtual bool VisitDecl(Decl *decl);
58 virtual bool VisitType(Type* type);
59
60 private:
61 void AddFileForLocation(SourceLocation location);
62
63 std::vector<Transform*> transforms_;
64 SourceManager* source_manager_;
65 std::set<std::string> filenames_;
66 };
67
68 } // namespace
69
70 #endif // TOOLS_CLANG_BINDMIGRATE_TRANSFORM_H_
OLDNEW
« no previous file with comments | « tools/clang/BindMigrate/README.chromium ('k') | tools/clang/BindMigrate/Transform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698