mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-14 12:12:07 +00:00
clang-rename YAML reader: address post-commit comments
llvm-svn: 278201
This commit is contained in:
parent
873219c406
commit
c29c81a03f
@ -59,10 +59,8 @@ static int helpMain(int argc, const char *argv[]);
|
||||
/// \brief An oldname -> newname rename.
|
||||
struct RenameAllInfo {
|
||||
std::string OldName;
|
||||
unsigned Offset;
|
||||
unsigned Offset = 0;
|
||||
std::string NewName;
|
||||
|
||||
RenameAllInfo() : Offset(0) {}
|
||||
};
|
||||
|
||||
LLVM_YAML_IS_SEQUENCE_VECTOR(RenameAllInfo)
|
||||
@ -70,7 +68,7 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(RenameAllInfo)
|
||||
namespace llvm {
|
||||
namespace yaml {
|
||||
|
||||
/// \brief Specialized MappingTraits to describe how a RenameAllInfo is /
|
||||
/// \brief Specialized MappingTraits to describe how a RenameAllInfo is
|
||||
/// (de)serialized.
|
||||
template <> struct MappingTraits<RenameAllInfo> {
|
||||
static void mapping(IO &IO, RenameAllInfo &Info) {
|
||||
@ -149,11 +147,12 @@ int subcommandMain(bool isRenameAll, int argc, const char **argv) {
|
||||
|
||||
if (!Input.empty()) {
|
||||
// Populate OldNames and NewNames from a YAML file.
|
||||
auto Buffer = llvm::MemoryBuffer::getFile(Input);
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> Buffer =
|
||||
llvm::MemoryBuffer::getFile(Input);
|
||||
if (!Buffer) {
|
||||
errs() << "clang-rename: failed to read " << Input << ": "
|
||||
<< Buffer.getError().message() << "\n";
|
||||
exit(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::vector<RenameAllInfo> Infos;
|
||||
|
@ -42,7 +42,7 @@ To get an offset of a symbol in a file run
|
||||
$ grep -FUbo 'foo' file.cpp
|
||||
|
||||
|
||||
The tool currently supports renaming actions inside a single Translation Unit
|
||||
The tool currently supports renaming actions inside a single translation unit
|
||||
only. It is planned to extend the tool's functionality to support multi-TU
|
||||
renaming actions in the future.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user