OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 implements a Clang tool to rewrite all instances of | 5 // This implements a Clang tool to rewrite all instances of |
6 // scoped_refptr<T>'s implicit cast to T (operator T*) to an explicit call to | 6 // scoped_refptr<T>'s implicit cast to T (operator T*) to an explicit call to |
7 // the .get() method. | 7 // the .get() method. |
8 | 8 |
9 #include <assert.h> | 9 #include <assert.h> |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 clang::tooling::newFrontendActionFactory(&match_finder); | 412 clang::tooling::newFrontendActionFactory(&match_finder); |
413 int result = tool.run(factory.get()); | 413 int result = tool.run(factory.get()); |
414 if (result != 0) | 414 if (result != 0) |
415 return result; | 415 return result; |
416 | 416 |
417 // Serialization format is documented in tools/clang/scripts/run_tool.py | 417 // Serialization format is documented in tools/clang/scripts/run_tool.py |
418 llvm::outs() << "==== BEGIN EDITS ====\n"; | 418 llvm::outs() << "==== BEGIN EDITS ====\n"; |
419 for (const auto& r : replacements) { | 419 for (const auto& r : replacements) { |
420 std::string replacement_text = r.getReplacementText().str(); | 420 std::string replacement_text = r.getReplacementText().str(); |
421 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); | 421 std::replace(replacement_text.begin(), replacement_text.end(), '\n', '\0'); |
422 llvm::outs() << "r:" << r.getFilePath() << ":" << r.getOffset() << ":" | 422 llvm::outs() << "r:::" << r.getFilePath() << ":::" << r.getOffset() << ":::" |
423 << r.getLength() << ":" << replacement_text << "\n"; | 423 << r.getLength() << ":::" << replacement_text << "\n"; |
424 } | 424 } |
425 llvm::outs() << "==== END EDITS ====\n"; | 425 llvm::outs() << "==== END EDITS ====\n"; |
426 | 426 |
427 return 0; | 427 return 0; |
428 } | 428 } |
OLD | NEW |