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

Side by Side Diff: tools/clang/rewrite_to_chrome_style/EditTracker.h

Issue 2597863002: rewrite_to_chrome_style: associate replacements with the affected file (Closed)
Patch Set: . Created 3 years, 12 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
OLDNEW
(Empty)
1 // Copyright 2016 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 #ifndef TOOLS_CLANG_REWRITE_TO_CHROME_STYLE_EDIT_TRACKER_H_
6 #define TOOLS_CLANG_REWRITE_TO_CHROME_STYLE_EDIT_TRACKER_H_
7
8 #include <map>
9
10 #include "clang/Basic/SourceLocation.h"
11 #include "clang/Basic/SourceManager.h"
12 #include "llvm/ADT/StringMap.h"
13 #include "llvm/ADT/StringRef.h"
14 #include "llvm/ADT/StringSet.h"
15
16 namespace llvm {
17 class raw_ostream;
18 } // namespace llvm
19
20 struct EditInfo {
21 std::string new_text;
22 llvm::StringSet<> filenames;
23 };
24
25 // Simple class that tracks the edits made by path. Used to dump the databaes
danakj 2016/12/22 21:06:40 the databaes are bae
26 // used by the Blink rebase helper.
27 class EditTracker {
28 public:
29 EditTracker() = default;
30
31 void Add(const clang::SourceManager& source_manager,
32 clang::SourceLocation location,
33 llvm::StringRef original_text,
34 llvm::StringRef new_text);
35
36 // Serializes the tracked edits to |output|. Emits:
37 // <filename>:<tag>:<original text>:<new text>
38 // for each distinct filename for each tracked edit.
39 void SerializeTo(llvm::StringRef tag, llvm::raw_ostream& output) const;
40
41 private:
42 EditTracker(const EditTracker&) = delete;
43 EditTracker& operator=(const EditTracker&) = delete;
44
45 // The string key is the original text.
46 llvm::StringMap<EditInfo> tracked_edits_;
47 };
48
49 #endif // #define TOOLS_CLANG_REWRITE_TO_CHROME_STYLE_EDIT_TRACKER_H_
OLDNEW
« no previous file with comments | « tools/clang/rewrite_to_chrome_style/CMakeLists.txt ('k') | tools/clang/rewrite_to_chrome_style/EditTracker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698