clang-tools 3.8.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

Macros | Functions | Variables
ClangRename.cpp File Reference

This file implements a clang-rename tool that automatically finds and renames symbols in C++ code. More...

`#include "../USRFindingAction.h"`
`#include "../RenamingAction.h"`
`#include "clang/AST/ASTConsumer.h"`
`#include "clang/AST/ASTContext.h"`
`#include "clang/Basic/FileManager.h"`
`#include "clang/Basic/LangOptions.h"`
`#include "clang/Basic/TargetInfo.h"`
`#include "clang/Basic/TargetOptions.h"`
`#include "clang/Frontend/CommandLineSourceLoc.h"`
`#include "clang/Frontend/CompilerInstance.h"`
`#include "clang/Frontend/FrontendAction.h"`
`#include "clang/Frontend/TextDiagnosticPrinter.h"`
`#include "clang/Lex/Lexer.h"`
`#include "clang/Lex/Preprocessor.h"`
`#include "clang/Parse/ParseAST.h"`
`#include "clang/Parse/Parser.h"`
`#include "clang/Rewrite/Core/Rewriter.h"`
`#include "clang/Tooling/CommonOptionsParser.h"`
`#include "clang/Tooling/Refactoring.h"`
`#include "clang/Tooling/Tooling.h"`
`#include "llvm/ADT/IntrusiveRefCntPtr.h"`
`#include "llvm/Support/Host.h"`
`#include <ctype.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string>`
`#include <time.h>`
`#include <vector>`
Include dependency graph for ClangRename.cpp:

Go to the source code of this file.

## Macros
#define | CLANG_RENAME_VERSION "0.0.1"

## Functions
cl::OptionCategory | ClangRenameCategory ("Clang-rename options")
static cl::opt< std::string > | NewName ("new-name", cl::desc("The new name to change the symbol to."), cl::cat(ClangRenameCategory))
static cl::opt< unsigned > | SymbolOffset ("offset", cl::desc("Locates the symbol by offset as opposed to <line>:<column>."), cl::cat(ClangRenameCategory))
static cl::opt< bool > | Inplace ("i", cl::desc("Overwrite edited <file>s."), cl::cat(ClangRenameCategory))
static cl::opt< bool > | PrintName ("pn", cl::desc("Print the found symbol's name prior to renaming to stderr."), cl::cat(ClangRenameCategory))
static cl::opt< bool > | PrintLocations ("pl", cl::desc("Print the locations affected by renaming to stderr."), cl::cat(ClangRenameCategory))
static void | PrintVersion ()
int | main (int argc, const char **argv)

## Variables
const char | RenameUsage []

## Detailed Description

This file implements a clang-rename tool that automatically finds and renames symbols in C++ code.

Definition in file ClangRename.cpp.

## Macro Definition Documentation

#define CLANG_RENAME_VERSION "0.0.1"

Definition at line 75 of file ClangRename.cpp.

Referenced by PrintVersion().

## Function Documentation

cl::OptionCategory ClangRenameCategory | ( | "Clang-rename options" |  | ) |

Referenced by main().

static cl::opt<bool> Inplace | ( | "i" | ,
|  | cl:: | desc"Overwrite edited <file>s.",
|  | cl:: | catClangRenameCategory
| ) |  |
| static

Referenced by main().

int main | ( | int | argc,
|  | const char ** | argv
| ) |  |

Definition at line 88 of file ClangRename.cpp.

References ClangRenameCategory(), DiagOpts, File, Files, Inplace(), NewName(), PrintLocations(), PrintName(), PrintVersion(), RenameUsage, Rewrite, and SymbolOffset().

static cl::opt<std::string> NewName | ( | "new-name" | ,
|  | cl:: | desc"The new name to change the symbol to.",
|  | cl:: | catClangRenameCategory
| ) |  |
| static

Referenced by clang::tidy::readability::NamedParameterCheck::check(), clang::rename::RenamingASTConsumer::HandleTranslationUnit(), main(), and clang::rename::RenamingAction::newASTConsumer().

static cl::opt<bool> PrintLocations | ( | "pl" | ,
|  | cl:: | desc"Print the locations affected by renaming to stderr.",
|  | cl:: | catClangRenameCategory
| ) |  |
| static

Referenced by clang::rename::RenamingASTConsumer::HandleTranslationUnit(), main(), and clang::rename::RenamingAction::newASTConsumer().

static cl::opt<bool> PrintName | ( | "pn" | ,
|  | cl:: | desc"Print the found symbol's name prior to renaming to stderr.",
|  | cl:: | catClangRenameCategory
| ) |  |
| static

Referenced by main().

static void PrintVersion | ( |  | ) |
| static

Definition at line 77 of file ClangRename.cpp.

References CLANG_RENAME_VERSION.

Referenced by main().

static cl::opt<unsigned> SymbolOffset | ( | "offset" | ,
|  | cl:: | desc"Locates the symbol by offset as opposed to <line>:<column>.",
|  | cl:: | catClangRenameCategory
| ) |  |
| static

Referenced by clang::rename::NamedDeclFindingConsumer::HandleTranslationUnit(), main(), and clang::rename::USRFindingAction::newASTConsumer().

## Variable Documentation

const char RenameUsage[]

Initial value:
= "A tool to rename symbols in C/C++ code.\n\
clang-rename renames every occurrence of a symbol found at <offset> in\n\
<source0>. If -i is specified, the edited files are overwritten to disk.\n\
Otherwise, the results are written to stdout.\n"

Definition at line 83 of file ClangRename.cpp.

Referenced by main().